CVE-2021-29084: Exploiting CRLF Header Injection in Synology NAS for Unauthenticated File Downloads
An unauthenticated endpoint on a Synology NAS reflected a user-supplied path parameter into an HTTP redirect without sanitising CRLF characters, allowing header injection. By injecting an X-Accel-Redirect header, an attacker who knows a target filename could download files shared via SMB.
Published on justintaft.com
Recently my CVE-2021-29084 went public (ZDI Link). We thought it would be fun to share my disclosure notes.
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
Root cause
Likely the endpoint used snprintf to build a redirect string from the path parameter without stripping carriage-return and line-feed characters, so injected CRLF sequences created new HTTP headers.
What the attacker needed
Network access to the NAS web portal; knowledge of the target filename
How it was found
- Send a request to the SecurityAdvisor report endpoint with a path parameter containing CRLF sequences and observe the injected headers in the 302 response.
- Inject an X-Accel-Redirect header pointing at a file under a volume path that nginx serves internally.
- Receive the file contents in the response body.
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.
HTTP responses are made of a status line, headers (like 'Location:') and a body. If a web application puts user input into a header without removing newline characters, an attacker can add extra headers of their own. Here that let the attacker tell the web server (nginx) to serve a file from the NAS that was only meant to be shared locally.
What is Misconfiguration?
Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.