Explore our new Cybersecurity Terms Glossary, explained by our experts.
Cybersecurity Terms Glossary
File upload vulnerabilities arise when an application accepts, stores, or processes a user-supplied file without adequate checks, often ending in remote code execution.

What Are File Upload Vulnerabilities?
An upload feature asks the application to take something entirely under the attacker’s control and put it somewhere on the server. Three separate decisions then have to be right: whether to accept the file, where to put it, and what to do with it afterwards. CWE-434 covers the first, and the consequences of getting it wrong range from stored cross-site scripting to a web shell and full compromise of the host.
Validation that looks sufficient usually is not. The common bypasses are well worn:
image/png..php leaves .php5, .phtml, .phar, and .inc. On IIS the equivalent gaps are .asp variants and .config; on Java platforms it is .jsp and .jspx.shell.PhP, a trailing space or dot on Windows, and multiple extensions such as photo.png.php all defeat naive string comparison.../../../var/www/html/shell.php writes outside the intended directory. See path traversal for the general case.Even where the file can never be executed, the content matters. An SVG is an XML document that may carry script, so it becomes stored cross-site scripting when served from your origin; the same XML parsing also opens the door to XXE injection. An HTML file served inline does the same thing more directly. A deliberately crafted archive can use relative paths to escape the extraction directory, a pattern known as Zip Slip, and a small compressed file can expand to fill the disk.
Processing is frequently the weakest link, because it hands the file to a complex native library. ImageTragick (CVE-2016-3714) allowed command execution through specially crafted images passed to ImageMagick, a library sitting behind countless thumbnail features. Office document converters, PDF renderers, and antivirus unpackers have all produced equivalents.
Content-Disposition: attachment and X-Content-Type-Options: nosniff.A worthwhile test does more than upload a script. It checks whether the stored file is reachable, what media type it is served with, whether the response renders inline, whether the filename influences the storage path, and whether the processing pipeline can be crashed or diverted. Logging helps afterwards: record who uploaded what, with the generated identifier and the detected type, so an incident response team can answer questions about a file that turns up later.
Where uploaded documents contain personal data, UK GDPR Article 32 applies to how they are stored and who can retrieve them, and a predictable download URL that exposes other customers’ documents is a reportable breach. Our web application security testing exercises upload, storage, and retrieval as one chain, because the flaw is usually in the join between them.
No. Magic bytes confirm how a file begins, not what it contains or how the server will treat it. A valid GIF header followed by script code satisfies the check and still executes if the web server routes the file by extension. Signature checking is useful as one layer alongside an extension allow-list, storage outside the web root, and re-encoding.
The original name is attacker-controlled data that is often used to build a filesystem path, a download URL, and a database record. Renaming to a server-generated identifier removes traversal sequences, dangerous extensions, encoding tricks, and collisions in a single step. Keep the original name as a display label in the database, escaped on output like any other untrusted string.
Not by default. SVG is XML, so it can contain script elements and event handlers that run when the image is rendered inline, and the XML parser itself may process external entities. If you need SVG, sanitise it with a parser-based library, serve it from a separate domain with a download disposition, or convert it to a raster format on upload.
It removes the code execution risk on your application server, which is the most severe outcome, and that is worth a great deal. It does not address stored cross-site scripting from HTML or SVG content, malicious documents delivered to other users, bucket permissions that expose files publicly, or exploits in whatever processes the file afterwards.
You May Be Interested In These
We use a few cookies that are needed to make this website work, and they are always on. We would also like to set analytics cookies, to see which pages are useful; functional cookies, so that our live chat works; and advertising cookies, to measure our campaigns. We will not set any of those until you say yes, and you can change your mind at any time from the Cookie Settings link in the footer.
Choose the cookies you are happy for us to use. Strictly necessary cookies are always on; everything else is off until you turn it on.
These cookies keep the website working: they hold your security checks, your form submissions and the choice you make here. The site cannot run without them, so they are always on.
These let our live chat open and remember your conversation, and let the newsletter sign-up work. Switch them off and the chat window will not appear.
These tell us which pages are read and how people find us, so that we can improve the site. The reports are about groups of visitors, never about you personally.
These let us measure our advertising and show you our adverts on other websites, such as LinkedIn, Google and Meta. Switch them off and you will still see adverts, but they will be less relevant.