Zero Day in jQuery Plugin Impacts Thousands of Applications
Thousands of projects are possibly impacted by a jQuery File Upload plugin vulnerability that has been actively exploited in the wild, a security researcher has discovered.
Tracked as CVE-2018-9206, the security bug impacts older versions of the plugin as well, going all the way back to 2010, Akamai researcher Larry Cashdollar found out. At the moment, there are over 7,800 forks of the plugin, and their vast majority carry the original vulnerability.
jQuery File Upload is a jQuery widget “with multiple file selection, drag&drop support, progress bars, validation and preview images, audio and video.” The plugin works with a broad range of server-side platforms that support standard HTML form file uploads: PHP, Python, Ruby on Rails, Java, Node.js, Go, and others.
While analyzing the package’s source, Cashdollar discovered two PHP files named upload.php and UploadHandler.php, which contained the file upload code. Files were saved to the files/ directory in the web server’s root path, and the researcher was able to leverage this to upload a web shell and run commands on the server.
“A browser connection to the test web server with cmd=id returned the user id of the web server’s running process,” the researcher notes.
Any project that uses the plugin’s code — and possibly code derived from it — is vulnerable and there are even YouTube videos available on how the bug can be exploited in similar software packages.
“This package has been included in various other packages and this code included in the projects web accessible path. It’s actively being exploited in the wild,” the researcher told the plugin author.
Apparently, the issue was caused by Apache disabling support for .htaccess in version 2.3.9. While the move was meant to improve performance and to prevent users from overriding security features that were configured on the server, it also left some developers and their projects open to attacks.
The jQuery File Upload PHP implementation, which relied on the .htaccess file for security, was affected too. The bug was addressed in the plugin by only allowing file uploads to be of a content-type image.
However, all projects relying on the jQuery File Upload code would be vulnerable, even if the fork authors changed the original code to suit their own project. These range from stand-alone web applications to WordPress plugins and other content management systems.
“I’ve done some testing against the 1000 forks of the original code and it seems only 36 were not vulnerable. I found these only required a slight tweak to my exploit to get the majority of them working,” Cashdollar, who also published proof-of-concept (PoC) code, explains.
The flaw would open any project used in production to data exfiltration, malware infection, defacement, and other types of attacks. One other issue would be that it’s virtually impossible to determine how many of the projects forked from the vulnerable plugin are being properly maintained or how many are being used in production environments.