File Upload and PHP on IIS: >=? and <=* and "=.
PHP on IIS converts certain characters in uploaded filenames when saving to Windows, so a filename containing angle brackets or quotes can become a blocked extension like .config. An attacker could use this to overwrite sensitive files such as web.config despite extension blacklists.
soroush.me
Published on soroush.me
In file upload attack, sometimes overwriting existing sensitive files such as web.config, .htaccess, or crossdomain.xml is needed in order to bypass protections around the uploaded files.
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 PHP on IIS maps certain characters in the uploaded filename to different characters when creating the file on Windows, so the saved name differs from the name checked by the uploader.
Impact
An attacker could overwrite sensitive files such as web.config in the upload directory, which may bypass upload protections; the text does not demonstrate code execution.
What the attacker needed
PHP running on IIS with FastCGI; an upload feature that saves files to disk; a blacklist or extension check on the filename
The fix
Uploaders should not rely on blacklists or on the client-supplied filename; they should normalise and validate the final saved name and store uploads outside sensitive directories.
How it was found
- Send a file upload request with a filename that uses the character conversions to form a blocked name such as web.config.
- If that name would overwrite another file in the same directory, use an alternative combination of characters to produce the same target name.
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.
When you upload a file, the server usually checks its name and extension to decide whether to accept it. On IIS with PHP, some characters in the filename are silently changed when the file is saved, so a name that looks harmless can turn into a dangerous one like web.config. This lets an attacker sneak past a blocklist that only checks the original name.
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.