What is XML external entity (XXE) injection? - ICSS

Introduction

XML External Entity Injection (also known as XXE) is a web security flaw that allows an attacker to interfere with an application's XML data processing. It frequently enables an attacker to examine files on the application server's disc and interact with any back-end or external systems that the programme can access.

An attacker can escalate a XXE assault to compromise the underlying server or other back-end infrastructure in some cases by exploiting the XXE vulnerability to launch server-side request forgery (SSRF) attacks.

XML external entity (XXE) Injection

What are the different forms of XXE attacks?

There are several forms of XXE attacks: Using XXE to obtain files, in which an external entity is defined that contains the contents of a file and is returned in the application's response.

  • Using XXE to launch SSRF attacks, where an external entity is defined by a URL to a back-end system.
  • Exfiltrate data out-of-band using blind XXE, where sensitive data is sent from the application server to a system controlled by the attacker.

Using blind XXE to retrieve data via error messages, the attacker can cause a parsing error message containing sensitive data.

Using XXE to obtain files

To launch a XXE injection attack that obtains an arbitrary file from the server's filesystem, you must change the provided XML in two ways:

  • Introduce (or modify) a DOCTYPE element that establishes an external entity providing the file's path.
  • To use the declared external entity, edit a data value in the XML that is returned in the application's response.

Assume a shopping application checks a product's stock level by delivering the following XML to the server:

<?xml version="1.0" encoding="UTF-8"?><stockChck><prdctId>556</prdctId></stockChck>

Because the application has no XXE defences, you can use the XXE vulnerability to retrieve the /etc/passwd file by providing the following XXE payload:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE foo [ <!ENTITY xxe SYSTEM "file:///etc/passwd"> ]>

<stockChck><prdctId>&xxe;</prdctId></stockChck>

This XXE payload defines an external entity &xxe; whose value is the contents of the /etc/passwd file, and it makes use of the entity within the prdctId value. The contents of the file are included in the application's response as a result of this:

Invalid product ID: root:x:0:0:root:/root:/bin/bash

daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin

bin:x:2:2:bin:/bin:/usr/sbin/nologin

...

Blind XXE vulnerabilities

Many XXE vulnerabilities remain unnoticed. This indicates that the application does not return the values of any defined external entities in its answers, making direct access to server-side files impossible.Blind XXE vulnerabilities can still be discovered and exploited, but more sophisticated techniques are required.

Out-of-band techniques can occasionally be used to uncover vulnerabilities and attack them in order to exfiltrate data. Furthermore, you can occasionally cause XML parsing mistakes, which result in the revealing of sensitive data within error messages.

XXE attacks via file upload

Many XXE vulnerabilities remain unnoticed. This indicates that the application does not return the values of any defined external entities in its answers, making direct access to server-side files impossible.Blind XXE vulnerabilities can still be discovered and exploited, but more sophisticated techniques are required.

Out-of-band techniques can occasionally be used to uncover vulnerabilities and attack them in order to exfiltrate data. Furthermore, you can occasionally cause XML parsing mistakes, which result in the revealing of sensitive data within error messages.

How to Identify and Test XXE Vulnerabilities

Burp Suite's web vulnerability scanner can find the vast majority of XXE vulnerabilities fast and reliably.

Manually testing for XXE vulnerabilities often entails the following steps:

  • Testing for file retrieval by constructing an external object based on a well-known operating system file and incorporating that entity into data returned by the application's response.
  • Testing for blind XXE vulnerabilities involves creating an external entity based on a URL to a system that you control and watching for interactions with that system.
  • The Burp Collaborator client is ideal for this.
  • Using an XInclude attack to try to obtain a well-known operating system file, we tested for susceptible inclusion of user-supplied non-XML data within a server-side XML document.

How to prevent XXE vulnerabilities

Almost all XXE vulnerabilities originate as a result of the application's XML parsing library supporting potentially harmful XML features that the programme does not require or intends to utilise. Disabling those functionalities is the simplest and most efficient technique to avoid XXE assaults.

In general, disabling external entity resolution and XInclude support is sufficient. This is normally accomplished using configuration settings or by altering default behaviour programmatically. For further information on how to disable superfluous capabilities, consult the documentation for your XML parsing library or API.

Why Choose Indian Cyber Security Solutions (ICSS) ?

Indian cyber security Solutions is one of best institute of India among other institute in India. ICSS offer as CEHv11 Courses in India as well as kali Linux. ICSS has won as many award for giving the online training as well as offline training. Its way of giving the training is unique which is easily adapted by the student as well as the professional. Due to way how ICSS trained the student it has got as many award some of award are Tech Brand of 2020,Ten most trusting cyber security certification provider 2021 and many more.

Among the many Ethical Hacking course in India, Indian Cyber Security Solutions would be the right for you to join. We have the right set of practical lab classes set up for students to learn as well as industry grade trainers who would conduct the classes and impart the right set of Cyber Security Knowledge to students. Our efforts have been acknowledged by various reputed administrative institutes, such as "Top Ten Training Institutes in India in 2020 by Silicon India; as well as Ten Most Trusted Training & Cyber Security Certifications Provider, 2021 by The Knowledge Review.

As an Education Institute, we are also cyber security service provider to corporate organization. Services like VAPT, Web Penetration Testing, Network Penetration Testing, Mobile Application Penetration Testing to corporate organization like IRCTC, HDFC, Cambridge Technologies, and many more. With this, Indian Cyber Security Solutions have been acknowledged as the 20 Tech Brands of 2021. by Business Connect India.

Our Cyber Security Services

Cyber Security is extremely important for every organisation and that we understand that data theft avoided is better than data theft done. Thus we also provide cyber security services to various MNCs across India. Our team is professional in providing Web Application Penetration Testing, Network Penetration Testing, Mobile Application Penetration Testing to clients.

We this, we have been acknowledged as the top 20 most Cyber Security Trusted Brands for 2021 by The Global Hues. We stand by to our commitment in providing the right cyber security training to students. We have provided services to clients like Madhya Pradesh Gramin Bank, Odisha State Pollution Control Board, HDFC Life Insurance Corporation, Qatar Development Bank and many more.


CERTIFIED COMPANY


MEMBER OF



OUR ADDRESS

KOLKATA

Globsyn Crystals Building,5th Floor, Unit-4, Webel MoreKolkata – 700091

BANGALORE

Chirush Mansion, 3478J HAL 2nd Stage,13th A Main Road Indiranagar Bangalore – 560008 Land Mark: Behind New Horizon School

CANADA141E34

Indian Cyber Security Solutions Cyber Security Research & Analytics Center Vine Avenue Moncton NB,Canada, PO E1E 1J9

AUSTRALIA

Indian Cyber Security Solutions Australia (Research and Development Center)11 Darling Street, Hughesdale Melbourne VIC. 3166

© 2021 Indian Cyber Security Solutions | Green Fellow IT Security Pvt. Ltd.