当前位置:网站首页>Don't be afraid of xxE vulnerabilities: understand their ferocity and detection methods
Don't be afraid of xxE vulnerabilities: understand their ferocity and detection methods
2022-06-11 05:57:00 【Longzhi Devops solution】

today ,XML External entities (XXE) Loopholes are still everywhere , Although recommendations to protect against these vulnerabilities have been an integral part of security standards for many years . In this article , We will try to uncover XXE The mysterious veil of loopholes , And introduce our rules to help you detect and prevent them .
summary
XML The entity is in XML Document type definition of the document (DOCTYPE) Declarative . If the value of an entity is retrieved from within the document , Then it is internal , If its value is a URI, Then it is external . When subsequently XML When entity references are used in documents , The reference is replaced by the value retrieved for it . for example , following XML Document through URI Retrieve from file xxe The value of the entity , Then embed its contents in the document :

Handle XML File applications should be careful to restrict external entities to authorized file systems and network resources , Otherwise, it will cause any file leakage and server-side request forgery (SSRF) The attack opened the door :

Be careful : Entities can be generic , Pictured above , It can also be a parameter entity . The only difference between the two is that the parameter entity only exists in DTD Defined and used in .
How to detect XXE Loophole ?
Use rules S2755 To save
To help developers understand this topic , The rules S2755 Medium “XML The parser should not be vulnerable to XXE attack ” Apply to SonarLint、SonarCloud And all versions of SonarQube Medium C#、Java、JS/TS、Python、PHP and C/C++.
whenever XML When the processor is configured incorrectly , Even if it only parses trusted XML file , This rule can also cause problems . We think , Controlling and restricting the use of external entities has only the following advantages :
- For performance reasons : It is a good practice to reduce the dependence on external resources .
- For safety reasons : It's hard to guarantee trust XML The file has not been tampered with by a malicious third party in some place or transmission ( As shown below ).
- Generally speaking : Once you start parsing XML file , Configure it safely in the project XML The parser makes sense , Even if you think they are credible . such , If XML The parser handles other things that you have no control over XML file , You don't have to worry about the future XXE The risk of vulnerability .
Don't believe it ? have a look S2755 In various well-known open source projects written in different programming languages , Some actual and serious vulnerabilities found :
- Previous articles https://blog.sonarsource.com/wordpress-xxe-security-vulnerability in , We talked about the most popular PHP CMS WordPress 5.7 (CVE-2021-29447) Medium XXE Loophole , When an authenticated user uploads a media file :

- pikepdf 2.9.2 (CVE-2021-29421) Medium XXE Loophole , This is a for operating PDF Of documents Python library , When parsing PDF XMP Metadata ( be based on XML) when :

- WxJava 3.7.4.A Medium XXE Loophole , This is a platform for developing wechat mobile payment applications Java SDK:

- In parsing the... From the partner vulnerability scanning tool XML When you file , The popular Python Vulnerability management tools DefectDojo 1.6.4 Medium XXE Loophole :

- Java XMPP The server Openfire Medium XXE Loophole :

assessment S2755 Suggestions for problems
Evaluate... In your own projects XXE When there is a vulnerability problem , Keep the following points in mind :
- Consider the worst case , For example, malicious system users manipulate XML file , Or retrieve XML File's infected partner application .
- Read your XML Documentation of the processor , Especially parsing XXE Default behavior of .
- as everyone knows ,Office file 、RSS、PDF、SOAP、SVG、XML-RPC、XMPP Many file formats and technical parts are based on XML standard , So it's hard to notice that by parsing these files , There may be XXE Loophole . therefore , If a rule is triggered S2755, Please don't be surprised , for example , In from PDF File parsing XMP Metadata .
Generalization
In this article , We have seen popular and open source projects written in different programming languages XXE Vulnerability example . I explained how to evaluate XXE Loopholes and rules S2755 What are the benefits of , But only you can prevent the vulnerability , So next time we'll talk about how to fix them .
The authors introduce :

ERIC THEROND
Security researchers
Source of the article :https://blog.sonarsource.com/understanding-xxe-vulnerabilities
边栏推荐
- Error:Execution failed for task ':app:buildNative'. & gt; A problem occurred'x/x/x/'NDK build' error resolution
- ELK日志系统实战(六):技术选型之vector与filebeat对比
- Cocoatouch framework and building application interface
- qmake 实现QT工程pro脚本转vs解决方案
- Xposed bypasses 360 reinforcement to get a real classloader
- Jsonobject jsonarray for parsing
- NDK learning notes (14) create an avi video player using avilib+window
- 配置Rust编译环境
- Manually splicing dynamic JSON strings
- Gilde failed to go to the listener to call back the reason record when loading the Gaussian blur image
猜你喜欢

Exploration of kangaroo cloud data stack on spark SQL optimization based on CBO

NDK learning notes (XI) POSIX sockect local communication

Using Internet of things technology to accelerate digital transformation

微信自定义组件---样式--插槽

Cocoapods installation error

"All in one" is a platform to solve all needs, and the era of operation and maintenance monitoring 3.0 has come

Goodbye 2021 Hello 2022

Moteur de modèle de moteur thymeleaf

The artistic director and production designer of Disney's Mandalorian revealed the virtual scene production behind it

If the MAC fails to connect with MySQL, it will start and report an error
随机推荐
NDK R21 compiles ffmpeg 4.2.2 (x86, x86_64, armv7, armv8)
YOLOv5的Tricks | 【Trick8】图片采样策略——按数据集各类别权重采样
Error:Execution failed for task ':app:buildNative'. & gt; A problem occurred'x/x/x/'NDK build' error resolution
Quartz2d drawing technology
handler
After adding the header layout to the recyclerview, use the adapter Notifyitemchanged (POS,'test') invalid local refresh
qmake 实现QT工程pro脚本转vs解决方案
11. Gesture recognition
那个酷爱写代码的少年后来怎么样了——走近华为云“瑶光少年”
Combing route - Compaction Technology
Get the value of program exit
Multithreading tutorial (XXV) atomic array
Super (subclass)__ init__ And parent class__ init__ ()
Using Internet of things technology to accelerate digital transformation
Pycharm usage experience
Adapter the problem of executing only one animation in multiple frames
Getting started with kotlin
Do we really need conference headphones?
URL in flask_ for
Informatica:数据质量管理六步法