Critical Arbitrary File Upload Vulnerability Patched in wpDiscuz Plugin
The wpDiscuz plugin allowed unauthenticated users to upload arbitrary files, including PHP, because its mime type check could be bypassed by adding image magic bytes to a PHP file. Attackers could then access the uploaded file and execute it, achieving remote code execution.
wordfence.com
Published on wordfence.com
On June 19th, our Threat Intelligence team discovered a vulnerability present in Comments – wpDiscuz, a WordPress plugin installed on over 80,000 sites. This flaw gave unauthenticated attackers the ability to upload arbitrary files, including PHP files, and achieve remote code execution on a vulnerable site’s server.
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 plugin relied on content-based mime type detection (mime_content_type or finfo_file) without also checking the file extension, so a PHP file with image magic bytes was accepted as an image.
Impact
An attacker could execute commands on the server and potentially control every site on the hosting account; Wordfence firewall users were protected.
What the attacker needed
WpDiscuz 7.0.0 to 7.0.4; no authentication required
The fix
The vulnerability was fixed in version 7.0.5.
How it was found
- Create a PHP file and prepend PNG magic bytes to it.
- Upload the file as a comment attachment using a multipart request with a .php filename.
- The server responds with the file path.
- Access the uploaded file to execute the PHP code.
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 plugin lets people attach images to comments, but it checked the file type by looking at the file's content. A malicious user could put a few bytes that look like a PNG image at the start of a PHP script, and the check would think it was an image. The file would be saved on the server, and because the server runs PHP files, the attacker could then run their own code.
What is File upload?
An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.