当前位置:网站首页>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
边栏推荐
- NFC Development -- difference between ID card and IC card (M1 card and CPU card) (III)
- Database basic instruction set
- Vscode plug-in development
- Wechat custom component - style - slot
- View controller and navigation mode
- getBackgroundAudioManager控制音乐播放(类名的动态绑定)
- JS -- reference type
- Super (subclass)__ init__ And parent class__ init__ ()
- Manually splicing dynamic JSON strings
- 使用Batch管理VHD
猜你喜欢

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

Warmly celebrate that yeyanxiu, senior consultant of Longzhi, won the title of "atlassian Certified Expert"

跨境电商测评自养号团队应该怎么做?

NDK learning notes (V)

getBackgroundAudioManager控制音乐播放(类名的动态绑定)

NDK learning notes (XI) POSIX sockect local communication

NFC Development -- difference between ID card and IC card (M1 card and CPU card) (III)

Es IK installation error

ThymeleafEngine模板引擎

View controller and navigation mode
随机推荐
Es IK installation error
Fix [no Internet, security] problem
亚马逊、速卖通、Lazada、虾皮平台在用911+VM的环境可以进行产号、养号、补单等操作吗?
VSCode插件开发
Slide the receleview horizontally to the far right to listen to the page loading function
获取程序exit的值
ELK日志系统实战(五):安装vector并将数据输出到es、clickhouse案例
NDK learning notes (VII) system configuration, users and groups
使用Batch设置IP地址
Multithreading tutorial (XXVI) field updater and atomic accumulator
Cocoatouch framework and building application interface
Super (subclass)__ init__ And parent class__ init__ ()
Using batch enumeration files
Share an RSA encryption and decryption tool class, including public key encryption, private key decryption, private key encryption, public key decryption, private key signature, public key verificatio
Using Internet of things technology to accelerate digital transformation
Thymeleafengine template engine
使用Batch读取注册表
ImageView supporting single finger sliding and double finger scaling
Aurora im live chat
SQLite one line SQL implementation updates if there is one, inserts if there is none, multiple conditions, complex conditions