In-depth lesson · File upload
Tips for beginners
Every point the File upload reports back under this heading, best-backed first, each with the reports it is seen in.
-
Start with the features that already take files: profile pictures, avatars, logos, signatures, chat attachments, bug report forms, CV and resume uploads, theme assets and snippet features. These are the places the evidence shows repeatedly. Read the page's JavaScript to find the real submit endpoint and the uploads directory rather than guessing.
Seen in 6 reports
-
Try the known bypass variations in order: trailing space after a script extension, a null byte between two extensions, an image magic string prepended to a script file, and a declared image content type on an executable file. Each of these defeated a real check in the evidence.
Seen in 4 reports
-
On appliance and enterprise admin interfaces, test whether an upload endpoint accepts a server side script type and then executes it. Backup, workflow and document server products have long been a source of arbitrary upload and execution.
Seen in 3 reports
-
Check whether the type check is only in the browser. If the page filters by extension or drag and drop, send the request directly and see whether the server still accepts it. A client side only check is one of the most common findings in this set.
Seen in 2 reports
-
Check unauthenticated endpoints and public reachability. Find an upload endpoint that needs no authentication and check whether uploaded files are publicly reachable. Enumerate directories to find an upload folder that returns success without authentication.
-
Look at cloud storage backed uploads. Request a signed direct upload URL from a Rails Active Storage endpoint, upload a file to the bucket, and check whether it can be served from the site's domain. Also check whether attachments with the same filename overwrite another user's file.
-
Do not report acceptance of a dangerous type as if it were code execution. Show the stored path, show the file being served, and where possible show it executing in a browser or being reached by another user. If you cannot show that, say clearly what you did show.
-
Remember the upload adjacent cases. Plant a symlink at a privileged service's log path and force it to log, or point a cache option at a symlink and run a failing request, then check whether the write follows the link. These are worth testing where a service writes to a user writable directory.
Seen in 2 reports
-
Try the filename and extension parameters, not only the file body. Send a save image request with filename and extension parameters and test whether traversal writes outside the intended directory, or whether changing the extension to a server side script type creates a reachable file.
Seen in 1 report
-
Test the remote URL option on avatar and image features. The remote avatar URL path skipped the file type checks that the direct upload path applied, so point the URL parameter at a non image file and see whether any type is accepted.
Seen in 1 report
-
Stay inside scope. Staging or subdomain sites run by large organisations can expose arbitrary file upload, but that does not make every subdomain fair game. Confirm the asset is in scope before you spend time on it, and do not test third party services the program does not list.
Seen in 1 report
-
Read the source when the target is open source. Reviewing the upload filter in a CMS or framework to find a bypass, then uploading a dangerous type, is a reliable route and the evidence shows it working across several projects.
Seen in 1 report