Upload a web.config File for Fun & Profit
The web.config file in IIS can be uploaded to bypass file upload protections, allowing an attacker to run ASP code, remove hidden segment restrictions, or create XSS in error pages. An attacker could upload a web.config file to execute code or access uploaded web shells directly.
soroush.me
Published on soroush.me
The web.config file plays an important role in storing IIS7 (and higher) settings. It is very similar to a .htaccess file in Apache web 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
Likely the file upload feature allows uploading a web.config file, which IIS interprets as configuration, enabling an attacker to override server settings.
Impact
An attacker could run ASP code, access uploaded web shells, or create XSS, potentially leading to code execution or client-side attacks.
What the attacker needed
File upload feature; IIS 7 or higher
The fix
The file upload feature should block uploading web.config files or restrict their contents.
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 server called IIS uses a file named web.config to control how it behaves. If a website lets you upload files, you might be able to upload a web.config file that changes the server's rules, for example to run code or make hidden files accessible. This is similar to uploading a .htaccess file on Apache servers.
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.