Skip to content

Commit 26bcba1

Browse files
committed
Add info on mitigations of image processing vulnerabilities.
1 parent fe44d34 commit 26bcba1

3 files changed

Lines changed: 48 additions & 14 deletions

File tree

README.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,31 @@
11
# jQuery File Upload Plugin
22

3+
## Description
4+
File Upload widget with multiple file selection, drag&drop support, progress bars, validation and preview images, audio and video for jQuery.
5+
Supports cross-domain, chunked and resumable file uploads and client-side image resizing. Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads.
6+
7+
## Demo
8+
[Demo File Upload](https://blueimp.github.io/jQuery-File-Upload/)
9+
310
## ⚠️ Security Notice
411
Security related releases:
512

13+
* [v9.25.1](https://github.com/blueimp/jQuery-File-Upload/releases/tag/v9.25.1) Mitigates some [Potential vulnerabilities with PHP+ImageMagick](VULNERABILITIES.md#potential-vulnerabilities-with-php+imagemagick).
614
* [v9.24.1](https://github.com/blueimp/jQuery-File-Upload/releases/tag/v9.24.1) Fixes a [Remote code execution vulnerability in the PHP component](VULNERABILITIES.md#remote-code-execution-vulnerability-in-the-php-component).
715
* v[9.10.1](https://github.com/blueimp/jQuery-File-Upload/releases/tag/9.10.1) Fixes an [Open redirect vulnerability in the GAE components](VULNERABILITIES.md#open-redirect-vulnerability-in-the-gae-components).
816
* Commit [4175032](https://github.com/blueimp/jQuery-File-Upload/commit/41750323a464e848856dc4c5c940663498beb74a) (*fixed in all tagged releases*) Fixes a [Cross-site scripting vulnerability in the Iframe Transport](VULNERABILITIES.md#cross-site-scripting-vulnerability-in-the-iframe-transport).
917

1018
Please read the [SECURITY](SECURITY.md) document for instructions on how to securely configure your Webserver for file uploads.
1119

12-
## Demo
13-
[Demo File Upload](https://blueimp.github.io/jQuery-File-Upload/)
14-
15-
## Description
16-
File Upload widget with multiple file selection, drag&drop support, progress bars, validation and preview images, audio and video for jQuery.
17-
Supports cross-domain, chunked and resumable file uploads and client-side image resizing. Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads.
18-
1920
## Setup
20-
⚠️ **Notice:**
21-
Please read the [Security recommendations](SECURITY.md) before setting up the project.
22-
2321
* [How to setup the plugin on your website](https://github.com/blueimp/jQuery-File-Upload/wiki/Setup)
2422
* [How to use only the basic plugin (minimal setup guide).](https://github.com/blueimp/jQuery-File-Upload/wiki/Basic-plugin)
2523

2624
## Features
2725
* **Multiple file upload:**
2826
Allows to select multiple files at once and upload them simultaneously.
2927
* **Drag & Drop support:**
30-
Allows to upload files by dragging them from your desktop or filemanager and dropping them on your browser window.
28+
Allows to upload files by dragging them from your desktop or file manager and dropping them on your browser window.
3129
* **Upload progress bar:**
3230
Shows a progress bar indicating the upload progress for individual files and for all uploads combined.
3331
* **Cancelable uploads:**

SECURITY.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ For an in-depth understanding of the potential security risks of providing file
33

44
To securely setup the project to serve uploaded files, please refer to the sample [Secure file upload serving configurations](#secure-file-upload-serving-configurations).
55

6+
To mitigate potential vulnerabilities in image processing libraries, please refer to the [Secure image processing configurations](#secure-image-processing-configurations).
7+
68
By default, all sample upload handlers allow only upload of image files, which mitigates some attack vectors, but should not be relied on as the only protection.
79

810
Please also have a look at the [list of fixed vulnerabilities](VULNERABILITIES.md) in jQuery File Upload, which relates mostly to the sample server-side upload handlers and how they have been configured.
@@ -109,3 +111,23 @@ location ^~ /path/to/project/server/php/files {
109111
}
110112
}
111113
```
114+
115+
## Secure image processing configurations
116+
The following configuration mitigates [potential image processing vulnerabilities with ImageMagick](VULNERABILITIES.md#potential-vulnerabilities-with-php+imagemagick) by limiting the attack vectors to a small subset of image types (`GIF/JPEG/PNG`).
117+
118+
Please also consider using alternative, safer image processing libraries like [libvips](https://github.com/libvips/libvips) or [imageflow](https://github.com/imazen/imageflow).
119+
120+
## ImageMagick config
121+
It is recommended to disable all non-required ImageMagick coders via [policy.xml](https://wiki.debian.org/imagemagick/security).
122+
To do so, locate the ImageMagick `policy.xml` configuration file and add the following policies:
123+
124+
```xml
125+
<?xml version="1.0" encoding="UTF-8"?>
126+
<!-- ... -->
127+
<policymap>
128+
<!-- ... -->
129+
<policy domain="delegate" rights="none" pattern="*" />
130+
<policy domain="coder" rights="none" pattern="*" />
131+
<policy domain="coder" rights="read | write" pattern="{GIF,JPEG,PNG}" />
132+
</policymap>
133+
```

VULNERABILITIES.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
# ⚠️ List of fixed vulnerabilities
22

3+
## Potential vulnerabilities with PHP+ImageMagick
4+
> Mitigated: 2018-10-25 (GMT)
5+
6+
The sample [PHP upload handler](server/php/UploadHandler.php) before [v9.25.1](https://github.com/blueimp/jQuery-File-Upload/releases/tag/v9.25.1) did not validate file signatures before invoking [ImageMagick](https://www.imagemagick.org/) (via [Imagick](http://php.net/manual/en/book.imagick.php)).
7+
Verifying those [magic bytes](https://en.wikipedia.org/wiki/List_of_file_signatures) mitigates potential vulnerabilities when handling input files other than `GIF/JPEG/PNG`.
8+
9+
Please also configure ImageMagick to only enable the coders required for `GIF/JPEG/PNG` processing, e.g. with the sample [ImageMagick config](SECURITY.md#imagemagick-config).
10+
11+
**Further information:**
12+
* Commit containing the mitigation: [fe44d34](https://github.com/blueimp/jQuery-File-Upload/commit/fe44d34be43be32c6b8d507932f318dababb25dd)
13+
* [ImageTragick](https://imagetragick.com/)
14+
* [CERT Vulnerability Note VU#332928](https://www.kb.cert.org/vuls/id/332928)
15+
* [ImageMagick CVE entries](https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=imagemagick)
16+
317
## Remote code execution vulnerability in the PHP component
4-
> Fixed: 2018-10-23
18+
> Fixed: 2018-10-23 (GMT)
519
620
The sample [PHP upload handler](server/php/UploadHandler.php) before [v9.24.1](https://github.com/blueimp/jQuery-File-Upload/releases/tag/v9.24.1) allowed to upload all file types by default.
721
This opens up a remote code execution vulnerability, unless the server is configured to not execute (PHP) files in the upload directory (`server/php/files`).
@@ -33,7 +47,7 @@ The provided [.htaccess](server/php/files/.htaccess) file includes instructions
3347
* [OWASP - Unrestricted File Upload](https://www.owasp.org/index.php/Unrestricted_File_Upload)
3448
3549
## Open redirect vulnerability in the GAE components
36-
> Fixed: 2015-06-12
50+
> Fixed: 2015-06-12 (GMT)
3751
3852
The sample Google App Engine upload handlers before v[9.10.1](https://github.com/blueimp/jQuery-File-Upload/releases/tag/9.10.1) accepted any URL as redirect target, making it possible to use the Webserver's domain for phishing attacks.
3953
@@ -42,7 +56,7 @@ The sample Google App Engine upload handlers before v[9.10.1](https://github.com
4256
* [OWASP - Unvalidated Redirects and Forwards Cheat Sheet](https://www.owasp.org/index.php/Unvalidated_Redirects_and_Forwards_Cheat_Sheet)
4357
4458
## Cross-site scripting vulnerability in the Iframe Transport
45-
> Fixed: 2012-08-09
59+
> Fixed: 2012-08-09 (GMT)
4660
4761
The [redirect page](cors/result.html) for the [Iframe Transport](js/jquery.iframe-transport.js) before commit [4175032](https://github.com/blueimp/jQuery-File-Upload/commit/41750323a464e848856dc4c5c940663498beb74a) (*fixed in all tagged releases*) allowed executing arbitrary JavaScript in the context of the Webserver.
4862

0 commit comments

Comments
 (0)