Skip to content
File upload Write-up Beginner

How I could have Hacked IIT Guwahati’s website

The complaint booking portal's file upload checked the file extension and showed an error for non-JPG/PNG files, but still processed the request, so a PHP file was written to the server. An attacker could upload a PHP shell and potentially take down or deface the website.

Sai Krishna Kothapalli Follow

Published on medium.com

{{media:1}}

Sai Krishna Kothapalli, on medium.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

Likely the upload handler printed an error for disallowed extensions but did not stop processing, so the file was still written to the server.

Impact

An attacker could upload a PHP shell and potentially take down or deface the entire website.

What the attacker needed

Access to the complaint booking portal; ability to upload files

The fix

The fix was to add an else case so the request is only processed when the file passes the check.

How it was found

  1. Open the complaint booking portal's file upload feature.
  2. Try to upload a file with a .php extension.
  3. Observe the warning that only JPG and PNG files are allowed.
  4. Notice that the request is still processed and the PHP file is written to the 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 file upload feature is supposed to reject dangerous file types like PHP scripts. Here, the site showed an error message but still saved the file, so an attacker could upload a script that runs on the server. This is like a bouncer who says 'you can't come in' but leaves the door open anyway.

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.

More by Sai Krishna Kothapalli

View all

4 more disclosed reports, best first.

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.