Agora — 1 vulnerability check

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

← All products · Feeds on GitHub

Agora.cgi Debug Mode cart_id Reflected Cross-Site Scripting

CVECVE-2001-1199
Severityhigh · CVSS 7.5
Categoryxss — XSS
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/agora/CVE-2001-1199.yaml

Tests Agora.cgi 3.0a through 4.0g, a Perl shopping cart, for the reflected cross-site scripting in the cart_id parameter, which the cart prints in its debug output without escaping when debug mode is on. Under /store, /cgi-bin/store, /cgi-bin, /agora, /shop and the web root, the feed requests agora.cgi?cart_id=<script>alert(/marker/)</script>&xm=on&product=HTML, where the marker is random for each scan, and reports the install when that exact script element comes back unescaped in a 200 reply. A control request sending the same payload to a random, absent .cgi script in the same folder must not reflect it, so a server that echoes any parameter is not reported. The script is harmless and only reaches the scanner.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{dir}}/agora.cgi?cart_id=%3Cscript%3Ealert(/{{sc.marker}}/)%3C/script%3E&xm=on&produ…
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET {{dir}}/{{sc.marker}}.cgi?cart_id=%3Cscript%3Ealert(/{{sc.marker}}/)%3C/script%3E&xm=…
  5. Parses / computes the next value with a Rhai script
  6. Checks hit for ^reflected$ → finding QoD 75: Agora.cgi Debug Mode cart_id Reflected Cross-Site Scripting (CVE-2001-1199)

References:

Feed source — tests/vulnerabilities/agora/CVE-2001-1199.yaml
# Agora.cgi debug-mode cart_id reflected cross-site scripting — CVE-2001-1199
#
# Agora.cgi 3.0a through 4.0g (agoracgi.com Perl shopping cart), when debug
# mode is enabled, prints the cart_id request parameter in its diagnostic
# output without HTML escaping (BID 3702, Bugtraq 2001-12-17 by Tamer Sahin;
# vendor reply 2002-01-24: the 4.0x diagnostics show the cart_id "exactly as
# given"). The feed sends the advisory request
#   /store/agora.cgi?cart_id=<script>...</script>&xm=on&product=HTML
#
# Detection (benign — the injected script only names a random marker and is
# shown to nobody but the scanner): GET
#   <dir>/agora.cgi?cart_id=<script>alert(/<marker>/)</script>&xm=on&product=HTML
# (percent-encoded) and look for that exact, unescaped script element in a 200
# reply (QoD 75).
#
# Improvements over the reference check:
#   - The reference only tries /store and matches a fixed string; the feed
#     also walks the usual install folders (/store, /cgi-bin/store, /cgi-bin,
#     /agora, /shop, web root) and sends a random marker per scan, so a page
#     that always shows a fixed script is not reported.
#   - A control request sends the same payload to a random, absent .cgi
#     script in the same folder: a server that reflects it there too is a
#     generic parameter reflector, not Agora, and is not reported
#     (fail-closed: no control reply, no finding).
#
# CVSS: CVE-2001-1199 v2 7.5 (NVD has no v3 score).
#
# Ported from OpenVAS/Greenbone NVT pre2008/agora.nasl
# (OID 1.3.6.1.4.1.25623.1.0.10836, GPL-2.0-only).
uid: 28f95e65-5f2f-4b55-8065-51d25a02afb9
name: "Agora.cgi Debug Mode cart_id Reflected Cross-Site Scripting (CVE-2001-1199)"
description: |
  Tests Agora.cgi 3.0a through 4.0g, a Perl shopping cart, for the reflected
  cross-site scripting in the cart_id parameter, which the cart prints in its
  debug output without escaping when debug mode is on. Under /store,
  /cgi-bin/store, /cgi-bin, /agora, /shop and the web root, the feed requests
  agora.cgi?cart_id=<script>alert(/marker/)</script>&xm=on&product=HTML,
  where the marker is random for each scan, and reports the install when that
  exact script element comes back unescaped in a 200 reply. A control request
  sending the same payload to a random, absent .cgi script in the same folder
  must not reflect it, so a server that echoes any parameter is not reported.
  The script is harmless and only reaches the scanner.
cves: [CVE-2001-1199]
cvss: 7.5
severity: high
category: xss
confidence_base: 0.30
tags: [agora, agora-cgi, shopping-cart, perl, cgi, xss, reflected-xss, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2001-1199"
  - "http://www.securityfocus.com/bid/3702"
  - "https://seclists.org/bugtraq/2002/Jan/301"
  - "https://www.exploit-db.com/exploits/21184"
  # OpenVAS/Greenbone NASL pre2008/agora.nasl (GPL-2.0-only)

steps:
  # ── Random marker and the exact script element to look for ───────────────
  - id: gen-marker
    action: script
    code: |
      let m = "noctis" + oob_token.sub_string(0, 8) + oob_token.sub_string(9, 4);
      #{ marker: m, want: "<script>alert(/" + m + "/)</script>" }
    store_as: sc

  # ── Loop group: every following step runs once per folder ────────────────
  - id: init-probe-r
    action: set_var
    var_name: probe_r
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["/store", "/cgi-bin/store", "/cgi-bin", "/agora", "/shop", ""]

  - id: init-ctrl-r
    action: set_var
    var_name: ctrl_r
    var_value: {status: 0, body: ""}

  - id: init-ctrl-clean
    action: set_var
    var_name: ctrl_clean
    var_value: false

  - id: init-hit
    action: set_var
    var_name: hit
    var_value: ""

  - id: probe
    action: http_request
    method: GET
    path: "{{dir}}/agora.cgi?cart_id=%3Cscript%3Ealert(/{{sc.marker}}/)%3C/script%3E&xm=on&product=HTML"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    store_as: probe_r

  - id: check
    action: script
    code: |
      let body = if type_of(probe_r.body) == "string" { probe_r.body } else { "" };
      if probe_r.status == 200 && body.contains(sc.want) { "reflected" } else { "" }
    store_as: hit

  # ── Control: the same payload to a random, absent .cgi script ───────────
  - id: control
    action: http_request
    method: GET
    path: "{{dir}}/{{sc.marker}}.cgi?cart_id=%3Cscript%3Ealert(/{{sc.marker}}/)%3C/script%3E&xm=on&product=HTML"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    condition: 'hit != ""'
    store_as: ctrl_r

  - id: control-check
    action: script
    condition: 'hit != ""'
    code: |
      let body = if type_of(ctrl_r.body) == "string" { ctrl_r.body } else { "" };
      ctrl_r.status != 0 && !body.contains(sc.want)
    store_as: ctrl_clean

  # ── Finding ───────────────────────────────────────────────────────────────
  - id: report
    action: match
    source: hit
    pattern: "^reflected$"
    condition: "ctrl_clean == true"
    on_match:
      finding:
        title: "Agora.cgi Debug Mode cart_id Reflected Cross-Site Scripting (CVE-2001-1199)"
        description: "An unauthenticated request to agora.cgi with the cart_id parameter set to a script element carrying a random marker returned that script element unescaped in the page, while an absent script in the same folder did not reflect it. The cart is running in debug mode and prints cart_id as received: an attacker can send a shopper a link that runs any script in the store's origin, for example to steal the session cookie."
        remediation: "Turn debug mode off on production stores and upgrade Agora.cgi past 4.0g (the product is long unsupported: move to a maintained shopping cart)."
        confidence_delta: 0.50
        qod: 75
        evidence: "{{dir}}/agora.cgi?cart_id=<script>alert(/{{sc.marker}}/)</script>&xm=on&product=HTML was reflected unescaped: {{sc.want}}; the same payload sent to an absent script ({{dir}}/{{sc.marker}}.cgi) was not"
      stop: true

View these feeds on GitHub