osCMax — 1 vulnerability check

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

← All products · Feeds on GitHub

osCMax admin login username reflected XSS

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

Tests osCMax (2.5.0 and earlier) for the reflected cross-site scripting in the username field of /admin/login.php?action=process. The feed posts a username holding an inert tag pair with a random token under the usual install folders and reports the flaw when the "Wrong Username" error page returns that tag with its angle brackets unencoded. No script is sent and nothing is changed on the server.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request POST {{dir}}/admin/login.php?action=process with a crafted body
  3. Parses / computes the next value with a Rhai script
  4. Checks found for /admin/login\.php$ → finding QoD 75: osCMax admin login username reflected XSS (CVE-2012-1664)

References:

Feed source — tests/vulnerabilities/oscmax/CVE-2012-1664.yaml
# osCMax <= 2.5.0 — reflected XSS in the admin login (CVE-2012-1664).
#
# The "username" field posted to /admin/login.php?action=process is put into
# the "Wrong Username or password" error page without encoding. Fixed in 2.5.1.
# The same advisory lists many other admin parameters and a SQL injection
# (CVE-2012-1665); this feed checks the login form only, which needs no
# session and no register_globals, so it covers CVE-2012-1664 alone.
#
# Detection (benign proof): the posted username carries inert tags with a
# per-run random token. The finding needs the error page ("Wrong Username" and
# "error") to hold the tag with its angle brackets unencoded. No script is sent.
#
# Ported from OpenVAS/Greenbone NVT 2015/gb_oscmax_multiple_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.805566, GPL-2.0-only). Deviations: an inert tag
# instead of <script>alert(document.cookie)</script>; the per-run token must
# come back; several install folders are tried (the source used the detected
# location).
uid: 621ef387-5c03-4d7f-a02e-ff9bd5308d66
name: "osCMax admin login username reflected XSS (CVE-2012-1664)"
description: |
  Tests osCMax (2.5.0 and earlier) for the reflected cross-site scripting in
  the username field of /admin/login.php?action=process. The feed posts a
  username holding an inert tag pair with a random token under the usual
  install folders and reports the flaw when the "Wrong Username" error page
  returns that tag with its angle brackets unencoded. No script is sent and
  nothing is changed on the server.
cves: [CVE-2012-1664]
cvss: 4.3
severity: medium
category: xss
confidence_base: 0.30
tags: [oscmax, oscommerce, xss, reflected, admin-login]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2012-1664"
  - "https://seclists.org/bugtraq/2012/Apr/20"
  # OpenVAS/Greenbone NASL 2015/gb_oscmax_multiple_vuln.nasl (GPL-2.0-only)

steps:
  - id: mint
    action: script
    store_as: tok
    code: 'rand_hex(8)'

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

  - id: init-r
    action: set_var
    var_name: r
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["", "/oscmax", "/osCMax", "/catalog"]

  - id: probe
    action: http_request
    method: POST
    path: "{{dir}}/admin/login.php?action=process"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "username='<noctis{{tok}}>x</noctis{{tok}}>&password=noctis"
    store_as: r

  # Error page of the login form with this run's tag unencoded.
  - id: check
    action: script
    store_as: found
    code: |
      let b = if type_of(r.body) == "string" { r.body } else { "" };
      let low = tolower(b);
      if r.status == 200 && stridx(low, "wrong username") >= 0 && stridx(low, "error") >= 0
         && stridx(b, "<noctis" + tok + ">x</noctis" + tok + ">") >= 0 { dir + "/admin/login.php" } else { found }

  - id: report
    action: match
    source: found
    pattern: "/admin/login\\.php$"
    condition: 'found != ""'
    on_match:
      finding:
        title: "osCMax admin login username reflected XSS (CVE-2012-1664)"
        description: "The username posted to {{found}}?action=process came back in the \"Wrong Username\" error page with its angle brackets unencoded: the inert tag pair carrying this run's random token appeared as markup. An attacker can run script in an administrator's browser by luring them to a page that posts such a value."
        remediation: "Upgrade osCMax to 2.5.1 or later, and restrict /admin to trusted networks."
        confidence_delta: 0.45
        qod: 75
        evidence: "POST {{found}}?action=process with username='<noctis{{tok}}>x</noctis{{tok}}> returned the tag unencoded in the error page"
      stop: true

View these feeds on GitHub