CVE-2021-45467: CWP CentOS Web Panel – preauth RCE
A file inclusion flaw in CentOS Web Panel allowed bypassing a path traversal check using null bytes, enabling unauthenticated access to restricted API endpoints. Combined with a file write vulnerability, an attacker could achieve remote code execution as root.
Published on octagon.net
CentOS Web Panel or commonly known as CWP is a popular web hosting management software, used by over 200,000 unique servers, that can be found on Shodan or Census. The vulnerability chain that we used to exploit a full preauth remote command execution as root uses file inclusion (CVE-2021-45467) and file write…
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 file inclusion protection used a string check that ignored null bytes, while the underlying file functions treated them as part of the path, allowing traversal.
Impact
An unauthenticated attacker could execute arbitrary commands as root on servers running the vulnerable panel.
What the attacker needed
Network access to the panel; no authentication required
The fix
The file inclusion was patched by blocking the null-byte sequence, but the bypass with multiple null bytes still worked, so a more robust fix is needed.
How it was found
- Send a request to the loader script with a crafted scripts parameter containing null bytes to bypass the dot check.
- Use the file inclusion to reach the API endpoint that creates a new API key.
- Use the newly created API key to call an API function that writes attacker-controlled content to a file.
- Use the file inclusion again to include the written file, achieving remote code execution.
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.
CentOS Web Panel is software for managing web servers. A security check meant to stop attackers from including files from other folders could be tricked by inserting special null characters, letting someone reach parts of the panel that should require a password. By also writing a file, an attacker could run commands on the server without logging in.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.