Skip to content
RCE Write-up Advanced

QNAP Poisoned XML Command Injection (Silently Patched)

A QNAP NAS device fetches an XML file over plain HTTP from update.qnap.com and passes the contents of its <img> tags to a system call without sanitisation, allowing command injection. An attacker who can intercept or redirect that HTTP request (via man-in-the-middle or DNS hijack) could execute arbitrary commands on the device.

Jacob Baines Follow

Published on rapid7.com

CVE-2020-2509 was added to CISA’s Known Exploited Vulnerabilities Catalog in April 2022, and it was listed as one of the “Additional Routinely Exploited Vulnerabilities in 2021” in CISA’s 2021 Top Routinely Exploited Vulnerabilities alert. However, CVE-2020-2509 has no public exploit, and no other organizations have…

Rapid7, on rapid7.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.

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

How it worked

Impact

An attacker who can man-in-the-middle or DNS-hijack the device's connection to update.qnap.com could execute arbitrary code on the QNAP device.

What the attacker needed

Man-in-the-middle or DNS hijack of update.qnap.com; network access to the QNAP device

The fix

The fix changed the XML download to HTTPS and replaced the system call with an execl wrapper called qnap_exec.

How it was found

  1. Set up a malicious DNS entry or man-in-the-middle so update.qnap.com resolves to an attacker-controlled server.
  2. Host a crafted XML file containing a malicious <img> value on that server.
  3. Send a request to /cgi-bin/qnapmsg.cgi?lang=eng on the QNAP device to trigger the download.
  4. The device downloads the XML over HTTP and parses it.
  5. The <img> value is passed to a wget command, executing the injected command.

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 write-up has not been written yet. The Original tab links to the source.

The device downloads a file from the internet using an unencrypted connection and then runs parts of that file as commands without checking them. Someone who can tamper with that connection, for example by controlling the network or the DNS server, can make the device run their commands. This is called command injection because untrusted input ends up being executed by the operating system.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by Jacob Baines

View all

2 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.