CactuShop — 2 vulnerability checks

noctis ships 2 vulnerability checks for CactuShop, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

CactuShop payonline.asp / mailorder.asp strItems SQL injection

CVECVE-2004-1881
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/cactushop/CVE-2004-1881.yaml

CactuShop 5.x, a classic ASP e-commerce application, places the product IDs of the strItems basket parameter of payonline.asp and mailorder.asp into its database query without validation, so a remote attacker can run arbitrary SQL (and, on SQL Server, operating system commands through xp_cmdshell).

On the web root and /cactushop, this check requests both pages with a basket whose first product ID is followed by a random word. That value only makes the query fail to parse and changes nothing. The flaw is confirmed when the reply shows the database syntax error (SQL Server "Incorrect syntax near" or Access "in query expression") quoting the random word.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{v.d}}/{{v.page}}?strAgain=yes&CD_EmailAddress=noctis%40example.com&CD_Password=&CD_…
  3. Parses / computes the next value with a Rhai script
  4. Checks hit for \.asp strItems → finding QoD 75: CactuShop strItems SQL injection (CVE-2004-1881)

References:

Feed source — tests/vulnerabilities/cactushop/CVE-2004-1881.yaml
# CactuShop 5.x — payonline.asp / mailorder.asp strItems SQL injection
# (CVE-2004-1881). The same releases carry the CVE-2004-1882 popuplargeimage.asp
# cross-site scripting, see CVE-2004-1882.yaml next to this file.
#
# CactuShop (Cactusoft, classic ASP shop on SQL Server or Access) receives the
# basket as strItems, product IDs joined by "z" (strItems=214z165z), and splices
# each ID unquoted into its product query. Advisory (Nick Gudov, BID 10019,
# EDB-23898), stacked xp_cmdshell on SQL Server:
#   /payonline.asp?strAgain=yes&...&numItemCount=2&strItems=214;+exec+master..xp_cmdshell+'dir+c:'--z165z&strQuantities=6z2z&numShipMethod=1&btnProceed=Proceed
# NVD names mailorder.asp too (same parameters). The product sources were never
# published; the request follows the advisory.
#
# Detection (QoD 75), read-only: under the web root and /cactushop, both pages
# are requested with the advisory's parameters and a first basket ID followed by
# a stray word, strItems=214 NOCTIS<random>z165z. That value cannot run anything:
# the database only fails to parse the query. The flaw is confirmed when the
# reply carries the parser error quoting the injected word — SQL Server
# "Incorrect syntax near 'NOCTIS<random>'" or Jet/Access "Syntax error ... in
# query expression '... NOCTIS<random>'" — and is an error (HTTP 500) or names
# the database driver. A page that merely echoes the URL has no parser message
# in front of the word and is not reported. The word holds no "z", so it stays
# inside the first basket ID. The advisory's checkout parameters are kept so the
# request reaches the basket query; with an unparseable first ID that query fails
# before any order could be recorded.
#
# The OpenVAS/Greenbone NVT `pre2008/cactuShop_multiple_flaws.nasl` (OID
# 1.3.6.1.4.1.25623.1.0.15461, GPL-2.0-only) lists this CVE but only sends the
# CVE-2004-1882 XSS request; this feed proves the SQL injection itself.
# CVSS: NVD carries only a CVSS v2 score (7.5).
uid: 421f6377-e2fe-4cf3-bf96-c34350adfab3
name: "CactuShop payonline.asp / mailorder.asp strItems SQL injection (CVE-2004-1881)"
description: |
  CactuShop 5.x, a classic ASP e-commerce application, places the product IDs
  of the strItems basket parameter of payonline.asp and mailorder.asp into its
  database query without validation, so a remote attacker can run arbitrary
  SQL (and, on SQL Server, operating system commands through xp_cmdshell).

  On the web root and /cactushop, this check requests both pages with a basket
  whose first product ID is followed by a random word. That value only makes
  the query fail to parse and changes nothing. The flaw is confirmed when the
  reply shows the database syntax error (SQL Server "Incorrect syntax near" or
  Access "in query expression") quoting the random word.
cves: [CVE-2004-1881]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [cactushop, cactusoft, e-commerce, asp, mssql, access, sqli]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2004-1881"
  - "http://www.securityfocus.com/bid/10019"
  - "https://www.exploit-db.com/exploits/23898"

steps:
  - id: gen-marker
    action: script
    code: |
      let tok = "NOCTIS" + rand_int(10000000, 99999999);
      #{ tok: tok,
         re: "(?i)(query expression|incorrect syntax near|unclosed quotation mark)[^\\r\\n]{0,200}" + tok }
    store_as: sc

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

  # ── Per install dir × page (loop group) ───────────────────────────────────
  - id: init-r
    action: set_var
    var_name: r
    var_value: {status: 0, body: ""}
    loop:
      var: v
      over:
        - {d: "", page: "payonline.asp"}
        - {d: "", page: "mailorder.asp"}
        - {d: "/cactushop", page: "payonline.asp"}
        - {d: "/cactushop", page: "mailorder.asp"}

  - id: probe
    action: http_request
    method: GET
    path: "{{v.d}}/{{v.page}}?strAgain=yes&CD_EmailAddress=noctis%40example.com&CD_Password=&CD_AffiliateID=&CD_CardholderCountry=200&CD_ShippingCountry=200&CD_ShippingPostcode=&strPaymentSystem=email&CP_CouponCode=&numLanguageID=1&numCurrencyID=1&numItemCount=2&strItems=214%20{{sc.tok}}z165z&strQuantities=6z2z&numShipMethod=1&btnProceed=Proceed"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'hit == ""'
    store_as: r

  - id: check
    action: script
    condition: 'hit == ""'
    code: |
      let b = if type_of(r.body) == "string" { r.body } else { "" };
      let drv = r.status == 500 || ereg("(?i)80040e14|JET Database Engine|ODBC|OLE DB|SQL Server", b);
      if r.status != 0 && drv && ereg(sc.re, b) {
        let m = eregmatch("(?i)(Syntax error[^<\\r\\n]{0,40}?in query expression|Syntax error[^<'\\r\\n]{0,40}|Incorrect syntax near|Unclosed quotation mark)", b);
        let what = if type_of(m) == "array" && m.len() > 0 { m[0] } else { "SQL syntax error" };
        v.d + "/" + v.page + " strItems: HTTP " + r.status + ", \"" + what + "\" quoting " + sc.tok
      } else { "" }
    store_as: hit

  # ── Finding ───────────────────────────────────────────────────────────────
  - id: report
    action: match
    source: hit
    pattern: "\\.asp strItems"
    condition: 'hit != ""'
    on_match:
      finding:
        title: "CactuShop strItems SQL injection (CVE-2004-1881)"
        description: "CactuShop passed the strItems basket parameter into its database query unvalidated: the injected word reached the SQL parser and came back in its syntax error. An attacker can run arbitrary SQL against the shop database (customer and order data, administrator password) and, on SQL Server, operating system commands through xp_cmdshell."
        remediation: "Upgrade CactuShop to a release that validates the strItems product IDs as numbers and uses parameterised queries; on SQL Server, run the shop under a database account without access to xp_cmdshell."
        confidence_delta: 0.50
        qod: 75
        evidence: "{{hit}}"
      stop: true

CactuShop popuplargeimage.asp strImageTag cross-site scripting

CVECVE-2004-1882
Severitymedium · CVSS 4.3
Categoryxss — XSS
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/cactushop/CVE-2004-1882.yaml

CactuShop 5.x, a classic ASP e-commerce application, prints the strImageTag parameter of its picture pop-up page popuplargeimage.asp into the page without HTML encoding, so a crafted link runs attacker script in the browser of a shop user who follows it.

On the web root and /cactushop, this check requests popuplargeimage.asp with a strImageTag holding a script element that carries a random marker. The flaw is confirmed when the page (HTTP 200) returns that script element unescaped, and a random page of the same directory, given the same parameter, does not (which rules out servers that echo any URL).

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{v.d}}/popuplargeimage.asp?strImageTag={{sc.p}}
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET {{v.d}}/{{sc.ctl}}?strImageTag={{sc.p}}
  5. Parses / computes the next value with a Rhai script
  6. Checks hit for popuplargeimage\.asp\? → finding QoD 75: CactuShop popuplargeimage.asp cross-site scripting (CVE-2004-1882)

References:

Feed source — tests/vulnerabilities/cactushop/CVE-2004-1882.yaml
# CactuShop 5.x — popuplargeimage.asp strImageTag reflected cross-site scripting
# (CVE-2004-1882). The same releases carry the CVE-2004-1881 strItems SQL
# injection, see CVE-2004-1881.yaml next to this file.
#
# CactuShop (Cactusoft, classic ASP shop) opens product pictures in
# popuplargeimage.asp, which prints the strImageTag parameter (a whole <img> tag)
# into the page as HTML. Advisory vectors (Nick Gudov, BID 10020, EDB-23899):
#   /popuplargeimage.asp?strImageTag=<script>alert(document.cookie)</script>
#   /popuplargeimage.asp?strImageTag=<img src="uploads/images_products_large/113.gif" onLoad="alert(document.cookie)">
# The product sources were never published; the vector follows the advisory.
#
# Detection (QoD 75): popuplargeimage.asp is requested under the web root and
# /cactushop with strImageTag=<script>alert(/noctis<random>/)</script>. The flaw
# is confirmed when the reply (HTTP 200) carries that script element verbatim.
# A random .asp name in the same directory is then requested with the same
# query: a server that echoes any URL raw (catch-all page, reflector) also
# reflects it there and is not reported; a 404 page echoing the URL
# HTML-encoded does not mask the flaw.
#
# Ported from OpenVAS/Greenbone NVT `pre2008/cactuShop_multiple_flaws.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.15461, GPL-2.0-only): the same request at the web
# root with a static `<script>foo</script>` marker, skipped when the host
# reflects XSS generically. Differences: random marker (no static page can
# match), /cactushop is tried too, and the generic reflection control is done
# per directory with the same query.
# CVSS: NVD carries only a CVSS v2 score (4.3).
uid: f47899dc-f984-4de6-a0b7-1ff57541e39b
name: "CactuShop popuplargeimage.asp strImageTag cross-site scripting (CVE-2004-1882)"
description: |
  CactuShop 5.x, a classic ASP e-commerce application, prints the strImageTag
  parameter of its picture pop-up page popuplargeimage.asp into the page
  without HTML encoding, so a crafted link runs attacker script in the browser
  of a shop user who follows it.

  On the web root and /cactushop, this check requests popuplargeimage.asp with
  a strImageTag holding a script element that carries a random marker. The
  flaw is confirmed when the page (HTTP 200) returns that script element
  unescaped, and a random page of the same directory, given the same
  parameter, does not (which rules out servers that echo any URL).
cves: [CVE-2004-1882]
cvss: 4.3
severity: medium
category: xss
confidence_base: 0.30
tags: [cactushop, cactusoft, e-commerce, asp, xss, reflected]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2004-1882"
  - "http://www.securityfocus.com/bid/10020"
  - "https://www.exploit-db.com/exploits/23899"

steps:
  - id: gen-marker
    action: script
    code: |
      let tok = "noctis" + rand_int(10000000, 99999999);
      #{ tok: tok,
         want: "<script>alert(/" + tok + "/)</script>",
         p: "%3Cscript%3Ealert%28%2F" + tok + "%2F%29%3C%2Fscript%3E",
         ctl: "noctis" + rand_hex(6) + ".asp" }
    store_as: sc

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

  # ── Per install dir (loop group) ──────────────────────────────────────────
  - id: init-r
    action: set_var
    var_name: r
    var_value: {status: 0, body: ""}
    loop:
      var: v
      over:
        - {d: ""}
        - {d: "/cactushop"}

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

  - id: probe
    action: http_request
    method: GET
    path: "{{v.d}}/popuplargeimage.asp?strImageTag={{sc.p}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'hit == ""'
    store_as: r

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

  # Generic-reflection control: same query on a random page of the directory.
  - id: control
    action: http_request
    method: GET
    path: "{{v.d}}/{{sc.ctl}}?strImageTag={{sc.p}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'hit == "" && reflected'
    store_as: c

  - id: check
    action: script
    condition: 'hit == ""'
    code: |
      let cb = if type_of(c.body) == "string" { c.body } else { "" };
      if reflected && !cb.contains(sc.want) { v.d + "/popuplargeimage.asp?strImageTag=" } else { "" }
    store_as: hit

  # ── Finding ───────────────────────────────────────────────────────────────
  - id: report
    action: match
    source: hit
    pattern: "popuplargeimage\\.asp\\?"
    condition: 'hit != ""'
    on_match:
      finding:
        title: "CactuShop popuplargeimage.asp cross-site scripting (CVE-2004-1882)"
        description: "CactuShop returned a script element passed in the strImageTag parameter of popuplargeimage.asp without HTML encoding: a crafted link runs attacker script in the browser of a shop user who follows it, in the context of the site (session cookies, administration pages)."
        remediation: "Upgrade CactuShop to a release that HTML-encodes strImageTag (or builds the image tag from a product ID server-side) before printing it."
        confidence_delta: 0.50
        qod: 75
        evidence: "{{hit}} + script element returned {{sc.want}} unescaped (HTTP 200); a random page of the same directory did not reflect it"
      stop: true

View these feeds on GitHub