Your NAS is not your NAS !
A heap overflow in Netatalk's DSI packet handling allowed an unauthenticated attacker to overwrite thread-local storage and execute code on Synology NAS devices. The same flaw affected QNAP and Asustor NAS when AFP was enabled.
Tech Editorials #RCE #NAS #IoT #Pwn2Own
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
The code used a user-supplied offset field as the length for a memory copy without checking it against the fixed buffer size, causing a heap overflow.
Impact
An unauthenticated attacker could execute code and obtain a reverse shell on Synology NAS with default settings, and on QNAP and Asustor NAS when AFP was enabled; Synology's stack guard required a brute-force step, while QNAP and Asustor lacked stack guard and were easier to exploit.
What the attacker needed
AFP service enabled (default on Synology); network access to the AFP port; no authentication required
The fix
The vulnerability was fixed in Netatalk 3.1.13 and vendor updates; disabling AFP is also recommended.
How it was found
- Connect to the AFP service on the NAS.
- Send a DSI packet with a data offset larger than the server quantum.
- The oversized length causes a heap overflow into thread-local storage.
- Brute-force the stack guard byte by byte using the connection behaviour.
- Forge a destructor list structure in a known memory area.
- Trigger session close to execute the chosen function and gain a shell.
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.
Netatalk is a file-sharing service used by NAS devices to talk to Macs. A mistake in how it checked the size of incoming data let an attacker send too much data and overwrite memory, which could lead to running their own commands on the device. No login was needed on Synology because the service was on by default.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.