Analyzing the PHP files
TerraMaster TOS 4.2.29 contains an unauthenticated information leak that exposes the admin password hash and MAC address, which can be chained with an OS command injection in the createRaid function to achieve remote command execution as root.
octagon.net
Published on octagon.net
This report explains how researchers at Octagon Networks were able to chain two interesting vulnerabilities to achieve unauthenticated remote command execution as root on TerraMaster NAS devices running TOS version 4.2.29. Patches are distributed for 4.2.31 now.
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 web application fails to properly authenticate requests to certain functions and passes user-supplied input directly to a shell command without sanitisation.
Impact
An unauthenticated attacker could execute arbitrary commands as root on the NAS device, leading to full compromise.
What the attacker needed
Network access to the device; no authentication required
The fix
The vulnerabilities were fixed in TOS version 4.2.31.
How it was found
- Send a request to the webNasIPS function to obtain the admin password hash and MAC address.
- Use the leaked MAC address to compute the required TIMESTAMP and SIGNATURE headers.
- Send a request to the createRaid function with a crafted raidtype parameter containing a shell command.
- The command is executed as root on the device.
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.
This report describes two bugs in a network storage device. The first bug lets anyone read the admin password hash and the device's network address without logging in. The second bug lets an attacker run system commands on the device, and by combining both, an attacker can take full control without any credentials.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.