Skip to content
File upload Write-up Intermediate

File Upload Bypass On Indrive

The file upload form only enforced file type restrictions on the client side, and the server accepted client-calculated checksums and file sizes. An attacker could bypass the restrictions and upload arbitrary files, such as PHP scripts, to an S3 bucket, though this did not lead to remote code execution.

medium.com

Published on medium.com

welcome to my first write-up. I started bug hunting about 3 months ago, and this was one of my first findings, so I would love to share it.

Mahmoud Elsaidy, 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 server trusted client-side validation and client-calculated checksums and file sizes, allowing an attacker to bypass file type restrictions.

Impact

An attacker could bypass file type restrictions and upload arbitrary files, potentially leading to increased storage costs and bandwidth consumption if no server-side size limits exist, but this did not lead to remote code execution.

What the attacker needed

Access to the upload form; ability to intercept and modify requests

The fix

The server should enforce file type restrictions and validate file size and checksum server-side, rather than relying on client-provided values.

How it was found

  1. Intercept the upload request and remove client-side file type restrictions.
  2. Change the file extension to .php and modify the Content-Type header.
  3. Observe that the server returns HTTP 200 for the modified request.
  4. Upload a valid PDF to see the two requests: one to get a pre-signed S3 URL and one to send metadata.
  5. Use the pre-signed URL to send a PUT request with a PHP file, including correct Content-Type, Content-Length, and Content-MD5 headers.
  6. Receive a 200 OK response confirming the PHP file was uploaded.

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 CVs, but it only checked the file type in the browser, not on the server. The server also trusted numbers the browser sent about the file, so someone could change the file to a dangerous type and still upload it. This is like a bouncer who only checks your ticket at the door but not inside.

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.