url欺诈--HTML5无刷修改url

 window.history.pushState({},0,'http://'+window.location.host+'/'+url); 

url--要修改的网址

a标签欺诈
<script>
window.onclick = function(){        //触发单击事件,修改链接
   document.links[0].setAttribute('href','http://google.com');
}
</script>

URL域名欺骗
Http://www.sohu.com@www.baidu.com  实际访问Http://baidu.com

http://www.microsoft.com&item=q209354@www.baidu.com  实际访问Http://baidu.com

http://www.microsoft.com&item=q209354@110   实际访问域名为:http://0.0.0.110/ 的网址,每个域名都可以转换为十进制的IP地址
数字用这个欺诈更爽

摘要原文:http://wiki.gimoo.net/art/11_14517.html

 

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>HTML5无刷修改url - 琼台博客</title>
        <script type="text/javascript">
            function changeURL(){
                var url = document.getElementById('url').value;
                window.history.pushState({},0,'http://'+window.location.host+'/'+url);      
            }
 
        </script> 
    </head>
    <body>
        <h1>html5无刷新改变url</h1>
        <div id="info" style="margin:30px 0;">
            页面真实地址:
            <span style="color:red;"><script type="text/javascript">document.write(window.location.href);</script></span>
        </div>
        <div>
        请输入要改变地URL字符串:<input id='url' type="text" />
        <button onclick="changeURL();">点击无刷改变url</button>
        </div>
        <div style="color:red;margin-top:30px;">请使用支持html5的浏览器访问</div>
        <div style="margin-top:30px;"><a href="http://www.qttc.net/201303292.html" target="_blank">《html5无刷新改变URL》</a> - 琼台博客</div>
    </body>
 
</html>

 测试可用
URL缺陷:
当前 URL 的同一个域或源中的相对或绝对 URL。 


文章地址:http://www.qttc.net/201303292.html 

IP,来源,欺骗

test2.php
 <?php
echo ' <meta charset="UTF-8">';
function GetIP() {
    if (!empty($_SERVER["HTTP_CLIENT_IP"]))
        $cip = $_SERVER["HTTP_CLIENT_IP"];
    else if (!empty($_SERVER["HTTP_X_FORWARDED_FOR"]))
        $cip = $_SERVER["HTTP_X_FORWARDED_FOR"];
    else if (!empty($_SERVER["REMOTE_ADDR"]))
        $cip = $_SERVER["REMOTE_ADDR"];
    else
        $cip = "无法获取!";
    return $cip;
}
echo "<br>访问IP: " . GetIP() . "<br>";
echo "<br>访问来路: " . $_SERVER["HTTP_REFERER"];
//         echo "<br/>".$_SERVER['HTTP_REFERER'];

?>

由test1.php访问test2.php
在test2.php中显示来源 

未伪造时ip和访问链接

伪造HTTP_REFERER 

//test1.php,在已拥有test2.php文件的情况下访问test1.php
//方法1
<?php
function curl_post($url){
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     //curl_setopt($ch, CURLOPT_HTTPHEADER, $headerArr);  //构造IP 
     curl_setopt($ch, CURLOPT_REFERER, 'http://www.google.com'); 
     $output = curl_exec($ch);
     curl_close($ch);
     return $output;
}
?>
//方法2
<?php
$opts = array(
  'http'=>array(
    'method'=>"GET",
  )
);
$context = stream_context_create($opts);
// Open the file using the HTTP headers set above
var_dump(file_get_contents('http://test.com/test2.php', false, $context));
?> 

运行结果


IP伪造 

 
function curl_post($url){
    $headers =ARRAY('X-FORWARDED-FOR:9.8.8.8');//代理IP
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_REFERER, 'http://www.google.com'); //伪造网址
     curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);  //构造 代理IP
     $output = curl_exec($ch);
     curl_close($ch);
     return $output;
}
var_dump(curl_post("http://test.com/test2.php"));

运行结果:



 

"X-FORWARDED-FOR" 是代理服务器通过 HTTP Headers 提供的客户端IP。代理服务器可以伪造任何IP。

要防止伪造,不要读这个IP即可(同时告诉用户不要用HTTP 代理)。

如果是PHP,$_SERVER['REMOTE_ADDR'] 就是跟你服务器直接连接的IP

echo "<br/>真实IP:".$_SERVER['REMOTE_ADDR']; 

所以呢!还的找个替换这真是ip的办法

友情建议,入侵他人计算机,有他人计算机发出请求,获取数据,在由中转数据到该去的地方



 



 


 



 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值