XML External Entity (XXE) injection
??Cn (also known as XXE) is a web security vulnerability that allows an attacker to interfere with an application's processing of XML data.
??It often allows an attacker to view files on the application server filesystem and to interact with any back-end or external systems that the application itself can access.
???An attacker can also escalate an XXE attack to compromise the underlying server or other back-end infrastructure by leveraging the XXE vulnerability to perform server-side request forgery (SSRF) attacks.
Types of XXE attacks?:-
There are various types of XXE attacks:
??Exploiting XXE to retrieve files?: where an external entity is defined containing the contents of a file, and returned in the application's response.
??Exploiting XXE to perform SSRF attacks : where an external entity is defined based on a URL to a back-end system.
??Exploiting blind XXE exfiltrate data out-of-band : where sensitive data is transmitted from the application server to a system that the attacker controls.
??Exploiting Blind XXE to retrieve data via error messages : where the attacker can trigger a parsing error message containing sensitive data.
How do XXE vulnerabilities arise?:-
??Applications that use the XML format to transmit data between the browser and the server do this virtually and always use a standard library or platform API to process the XML data on the server.
领英推荐
??XXE vulnerabilities arise because the XML specification contains various potentially dangerous features and standard parsers support these features even if they are not normally used by the application.
How to test for XXE vulnerabilities?:-
??The vast majority of XXE vulnerabilities can be found quickly and reliably using Burp Suite's?Web Vulnerability scanner.
??We can find the file retrieval vulnerability?by defining an external entity based on a well-known operating system file and using that entity in data that is returned in the application's response.?
??Blind XXE Vulnerabilities?can be found?by defining an external entity based on a URL to a system that you control and monitoring for interactions with that system.?
??Testing for vulnerable inclusion of user-supplied non-XML data within a server-side XML document by using an XInclude attack?to try to retrieve a well-known operating system file.
How to prevent XXE vulnerabilities?:-
??Virtually all XXE vulnerabilities arise because the application's XML parsing library supports potentially dangerous XML features that the application does not need or Intend to use. The easiest and most effective way to prevent XXE attacks is to disable those features.
??Usually it is sufficient to disable resolution of external entities and disable support for?XInclude.
??This can usually be done via configuration options or by programmatically overriding default behavior.?