How to Fake your Referer

in #httpspoof8 years ago

It will allow you to fake http referer when sending traffic. 


The requirement:

Transfer, including any parameters (even dynamically generated) to a 

destination link, whilst replacing the original referer info in the surfer's 

browser to a new referer of our choice.


If the script is hosted on

http://test.com


construct fake referer urls like:

http://test.com/?url=DestUrlIncludingParameters&referer=FakeRefUrl


1. Save the following code as index.php and upload to the domain of your choice. The domain will "handle" the redirections.


<?php

// Extract URI minus http://handlerdomain.com/

$full_url = urldecode($_SERVER['REQUEST_URI']);

// Extract urls we need

$l = strlen($full_url);

$p_referer = strpos ($full_url, 'referer=');

$p_dest_2 = $p_referer - 1;

$p_referer = strpos ($full_url, '=',$p_referer) + 1;

$url_referer = substr ($full_url , $p_referer);

$p_dest_1 = strpos ($full_url, '=') + 1;

$l = $p_dest_2 - $p_dest_1;

$url_dest = substr ($full_url , $p_dest_1, $l);


// Create self-posting form.

if ($url_referer != '') {

    echo '<html><head><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"></head><body>

    <form action="'.urldecode($url_referer).'" method="post" id="myform">

    <input type="hidden" name="ref_spoof" value="'.urldecode($url_dest).'">

    </form><script language="JavaScript"> document.getElementById(\'myform\').submit();</script></body></html>';

} else {

    echo 'You must provide a referer';

}

?>


Insert the following code in any page (must either be a php page, or an 

html page on a server which will execute php code within html files), any 

WP page or post, or, if wanting to be able to use "any" post on your WP 

blog as your referer, insert it in the WP header.php file (this will even permit 

a fake referer to be a post which doesn't actually exist):


<?php

if ($_POST['ref_spoof'] != NULL) {

    $offer = urldecode($_POST['ref_spoof']);

    $p1 = strpos ($offer, '?') + 1;

    $url_par = substr ($offer , $p1);

    $paryval = split ('&', $url_par);

    $p = array();

    foreach ($paryval as $value) {

        $p[] = split ('=',$value);

    }

    echo'<html><head><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"></head><body><form action="'.$offer.'" method="get" id="myform">';

    foreach ($p as $value) {

        echo '<input type="hidden" name="'.$value[0].'" value="'.$value[1].'">';

    }

    echo '</form><script language="JavaScript"> document.getElementById(\'myform\').submit();</script></body></html>';

}

?>


3. Usage:


Say, for example, you upload the first file, as index.php, to handler.com, 

and you place the second code in a Wordpress Header.php, on myfavewpsite.com, which, say, 

has a post like: myfavewpsite.com/post-with-ads.


Now, you want to send your visitors to this offer link:


myCPAnetwork.com?oid=12345&pid=6789&sid=yy7456


The link you would post or display or send your visitors to would be:


http://test.com/?url=myCPAnetwork.com?oid=12345&pid=6789&sid=yy7456&referer=myfavewpsite.com/post-with-ads


Sort:  

Congratulations @dharmakirti! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Happy Birthday - 1 Year on Steemit
Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

Congratulations @dharmakirti! You have received a personal award!

2 Years on Steemit
Click on the badge to view your Board of Honor.

Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Congratulations @dharmakirti! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 3 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!