Skip to content
File upload Write-up Intermediate

X2Engine <= 4.1.7 (FileUploadsFilter.php) Unrestricted File Upload Vulnerability

The upload filter used a case-sensitive blacklist, so an attacker could upload a file with a capitalised extension to bypass it. If the filesystem or web server treats extensions case-insensitively, the uploaded PHP script could be executed.

karmainsecurity.com

Published on karmainsecurity.com

The vulnerability exists because of the FileUploadsFilter::EXTBLACKLIST constant, which is a regular expression for blacklisted files. Due to a lack of case-insensitive matching, the global upload filter could be bypassed by uploading a malicious file with capital letters within the extension.

The author, on karmainsecurity.com

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 file extension blacklist was applied with a case-sensitive regular expression, so uppercase or mixed-case extensions were not matched.

Impact

An attacker could upload and execute arbitrary PHP scripts if the filesystem or web server handles extensions case-insensitively.

What the attacker needed

Ability to upload files; case-insensitive filesystem or server

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.

A web application lets users upload files but tries to block dangerous ones like PHP scripts by checking the file extension against a list. The check only looked for lowercase extensions, so a file ending in .PHP instead of .php slipped through. If the server treats both the same, the uploaded script can run on the server.

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.

Similar reports

View all

Same bug class and techniques, clearest first.

Unrestricted file upload

The lesson behind this report.

An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.