Difference between revisions of "Unrestricted File Upload"
|Line 19:||Line 19:|
* the a
Revision as of 18:39, 18 April 2010
This is a Vulnerability. To view all vulnerabilities, please see the Vulnerability Category page.
Last revision (mm/dd/yy): 04/18/2010
Uploaded files represent a significant risk to applications. The first step in many attacks is to get some code to the system to be attacked. Then the attack only needs to find a way to get the code executed. Using a file upload helps the attacker accomplish the first step.
The consequences of unrestricted file upload can vary, including complete system takeover, an overloaded file system, forwarding attacks to backend systems, and simple defacement. It depends on what the application does with the uploaded file, including where it is stored.
There are really two different classes of problems here. The first is with the file metadata, like the path and filename. These are generally provided by the transport, such as HTTP multipart encoding. This data may trick the application into overwriting a critical file or storing the file in a bad location. You must validate the metadata extremely carefully before using it.
The other class of problem is with the file content. The range of problems here depends entirely on what the file is used for. See the examples below for some ideas about how files might be misused. To protect against this type of attack, you should analyze everything your application does with files and think carefully about what processing and interpreters are involved.
- The impact of this attack is high but the likelihood is low. So, the severity of this type of attack is Medium.
- The website can be defaced.
- The web server can be compromised by uploading and executing a web-shell which can: run a command, browse the system files, browse the local resources, attack to other servers, and exploit the local vulnerabilities, and so on.
- This attack can make the website vulnerable to some other types of attacks such as XSS.
- An attacker might be able to put a phishing page into the website.
- Local file inclusion vulnerabilities can be exploited by uploading a malicious file into the server.
- Local vulnerabilities of real-time monitoring tools such as an antivirus can be exploited by uploading a harmful file.
- A malicious file can be uploaded on the server in order to have a chance to be executed by administrator or webmaster later.
- The web server might be used as a warez server by a bad guy in order to be host of malwares, illegal software, steganographic objects, and so on.
Attacks on application platform
- Upload .jsp file into web tree - jsp code executed as web user
- Upload .gif to be resized - image library flaw exploited
- Upload huge files - file space denial of service
- Upload file using malicious path or name - overwrite critical file
- Upload file containing personal data - other users access it
- Upload file containing "tags" - tags get executed as part of being "included" in a web page
Attacks on other systems
- Upload .exe file into web tree - victims download trojaned executable
- Upload virus infected file - victims' machines infected
- Upload .html file containing script - victim experiences Cross-site Scripting (XSS)
Related Technical Impacts