Skip to content
File upload Write-up Intermediate

Uncovering a Critical Vulnerability: From Unrestricted File Uploa

A forgotten image upload endpoint accepted ASP.NET web service and handler files (.asmx and .ashx) that the server then compiled and executed. By uploading a custom web service, the tester could list directories, read files such as web.config, and write files, amounting to remote code execution and full compromise.

Muhammad Sameer Follow

Published on medium.com

During a recent Vulnerability Assessment and Penetration Testing (VAPT) engagement, I identified an unusual endpoint: /uploadimage. At first glance, it appeared to be a leftover testing or legacy feature.

Muhammad Sameer, 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 endpoint validated only common script extensions, while the server was configured to compile and execute ASP.NET web services and handlers from the upload directory, and the app pool identity had broad read/write access.

Impact

The tester could read sensitive configuration and credential files and write to server directories, which the report describes as remote code execution and full application compromise; the text says the issue has since been patched.

What the attacker needed

Reachable upload endpoint; no account mentioned in the text

The fix

The report says the vulnerability was responsibly disclosed and has since been patched; the root-cause section implies the fix should restrict uploads to safe types, stop executing uploaded files, and reduce the app pool's privileges.

How it was found

  1. Find a live upload endpoint that returns a public URL for each uploaded file.
  2. Try common server-side extensions such as PHP, ASPX and JSP; all are blocked.
  3. Fuzz less common extensions and find that .asmx and .ashx upload successfully.
  4. Request the uploaded .asmx file and observe a server-side execution error rather than a WAF block.
  5. Craft and iterate on .asmx web service payloads until execution is confirmed.
  6. Use the uploaded web services to list directories, read files and test write access.

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 website let people upload files, and it was meant to accept only pictures. The tester found that it also accepted special server-side files that the server then ran as small programs. Because those programs ran with the server's own permissions, the tester could read and write files on the machine, which is effectively taking control of it.

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.