OSClass — 1 vulnerability check

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

← All products · Feeds on GitHub

OSClass < 2.3.5 search page reflected XSS

CVECVE-2012-0973, CVE-2012-0974, CVE-2012-5162, CVE-2012-5163
Severitymedium · CVSS 4.3
Categoryxss — XSS
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/osclass/CVE-2012-0973.yaml

Tests an OSClass classifieds site for the reflected cross-site scripting flaw of releases before 2.3.5: the search page copies the sCity, sPattern, sPriceMax and sPriceMin parameters into the HTML without escaping them. The test first confirms OSClass from the admin login page in each usual install directory, then requests the search page with an inert tag carrying a per-scan random marker and reports the host when that tag comes back unescaped in a 200 reply. The same releases are also affected by SQL injection in the sCategory parameter and in the admin category actions (CVE-2012-0973, CVE-2012-5162) and by an admin-side XSS (CVE-2012-5163); those are not probed.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{dir}}/oc-admin/index.php
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET {{dir}}/index.php?page=search&sCity=%22%3E%3C{{marker}}%3E
  5. Parses / computes the next value with a Rhai script
  6. HTTP(S) request GET {{dir}}/index.php?page=search&sPattern=%22%3E%3C{{marker}}%3E
  7. Parses / computes the next value with a Rhai script
  8. Checks hit for index\.php\?page=search → finding QoD 75: OSClass < 2.3.5 search page reflected XSS (CVE-2012-0974)

References:

Feed source — tests/vulnerabilities/osclass/CVE-2012-0973.yaml
# OSClass before 2.3.5 — reflected XSS in the search page (CVE-2012-0974), found
# together with the SQL injections CVE-2012-0973 (sCategory) and CVE-2012-5162
# (oc-admin ajax id) and the admin XSS CVE-2012-5163, all fixed in 2.3.5.
#
# The tracking issue lists all four; the request that can be proven without
# touching the database is the reflected XSS of CVE-2012-0974 (sCity, sPattern,
# sPriceMax, sPriceMin of the search page, Params::getParam does not escape),
# so the finding names only that CVE (step-level cves). The SQL injections are
# not probed: sCategory needs an error/boolean differential calibrated on a real
# instance, and the oc-admin actions need an admin session.
#
# Ported from OpenVAS/Greenbone NVT `2012/gb_osclass_mult_xss_n_sql_inj_vuln.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.802970, GPL-2.0-only): the admin login page must be
# OSClass, then <dir>/index.php?page=search&sCity=">alert-script is reflected.
# Differences from the NASL:
#   - the reflected payload is an inert, per-scan random tag (`"><noctis-<hex>>`)
#     instead of a fixed script with alert(document.cookie); a cached page or a
#     page that merely contains the fixed string cannot match;
#   - the NASL reads the body with an egrep over the whole reply; here the
#     reply must be a 200 and the exact unescaped `"><tag>` sequence must come
#     back, so a patched server that HTML-escapes the value never matches;
#   - the other vulnerable parameters (sPattern, sPriceMax, sPriceMin) are tried
#     when sCity is filtered, and more install directories are covered
#     (/osclass is the NASL's only fixed one, plus /oc, /classifieds, /ads).
# CVSS: NVD carries only a CVSS v2 score (4.3) for CVE-2012-0974.
uid: 3d6595df-5bf9-411c-9257-5d43d098432e
name: "OSClass < 2.3.5 search page reflected XSS (CVE-2012-0974)"
description: |
  Tests an OSClass classifieds site for the reflected cross-site scripting flaw
  of releases before 2.3.5: the search page copies the sCity, sPattern,
  sPriceMax and sPriceMin parameters into the HTML without escaping them. The
  test first confirms OSClass from the admin login page in each usual install
  directory, then requests the search page with an inert tag carrying a
  per-scan random marker and reports the host when that tag comes back
  unescaped in a 200 reply. The same releases are also affected by SQL
  injection in the sCategory parameter and in the admin category actions
  (CVE-2012-0973, CVE-2012-5162) and by an admin-side XSS (CVE-2012-5163); those
  are not probed.
cves: [CVE-2012-0973, CVE-2012-0974, CVE-2012-5162, CVE-2012-5163]
cvss: 4.3
severity: medium
category: xss
confidence_base: 0.30
tags: [osclass, classifieds, php, xss, web-abuse]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2012-0974"
  - "https://nvd.nist.gov/vuln/detail/CVE-2012-0973"
  - "https://nvd.nist.gov/vuln/detail/CVE-2012-5162"
  - "https://nvd.nist.gov/vuln/detail/CVE-2012-5163"
  - "OpenVAS/Greenbone NASL 2012/gb_osclass_mult_xss_n_sql_inj_vuln.nasl (GPL-2.0-only)"

steps:
  # Per-scan marker: "noctis" + 16 lowercase hex chars.
  - id: mint-marker
    action: script
    code: '"noctis" + rand_hex(8)'
    store_as: marker

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

  # ── Per candidate install path (loop group) ───────────────────────────────
  - id: init-admin
    action: set_var
    var_name: admin
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["/osclass", "", "/oc", "/classifieds", "/ads"]

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

  # Product gate: the admin login page of OSClass.
  - id: fetch-admin
    action: http_request
    method: GET
    path: "{{dir}}/oc-admin/index.php"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 8
    condition: 'hit == ""'
    store_as: admin

  - id: gate
    action: script
    condition: 'hit == ""'
    code: |
      let b = if type_of(admin.body) == "string" { admin.body } else { "" };
      admin.status == 200 && stridx(b, ">OSClass admin panel login<") >= 0 && stridx(b, "\"OSClass\">") >= 0
    store_as: is_osclass

  # Reflection probes: the tag is `"><noctis-<hex>>`, URL-encoded.
  - id: probe-city
    action: http_request
    method: GET
    path: "{{dir}}/index.php?page=search&sCity=%22%3E%3C{{marker}}%3E"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 8
    condition: 'hit == "" && is_osclass'
    store_as: page

  - id: check-city
    action: script
    condition: 'hit == "" && is_osclass'
    code: |
      let b = if type_of(page.body) == "string" { page.body } else { "" };
      if page.status == 200 && stridx(b, "\"><" + marker + ">") >= 0 { dir + "/index.php?page=search sCity" } else { "" }
    store_as: hit

  - id: probe-pattern
    action: http_request
    method: GET
    path: "{{dir}}/index.php?page=search&sPattern=%22%3E%3C{{marker}}%3E"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 8
    condition: 'hit == "" && is_osclass'
    store_as: page

  - id: check-pattern
    action: script
    condition: 'hit == "" && is_osclass'
    code: |
      let b = if type_of(page.body) == "string" { page.body } else { "" };
      if page.status == 200 && stridx(b, "\"><" + marker + ">") >= 0 { dir + "/index.php?page=search sPattern" } else { "" }
    store_as: hit

  # ── Finding ───────────────────────────────────────────────────────────────
  - id: report
    action: match
    source: hit
    pattern: "index\\.php\\?page=search"
    on_match:
      finding:
        title: "OSClass < 2.3.5 search page reflected XSS (CVE-2012-0974)"
        description: "The OSClass search page copies a request parameter into the HTML without escaping it: a request carrying an inert tag with a random marker got the tag back as markup. A crafted link therefore runs attacker-chosen script in a visitor's browser. The same releases are also affected by SQL injection in sCategory and in the admin category actions, which this test does not probe."
        remediation: "Upgrade OSClass to 2.3.5 or later."
        cves: [CVE-2012-0974]
        confidence_delta: 0.50
        qod: 75
        evidence: "{{hit}} reflected the marker tag unescaped"
      stop: true

View these feeds on GitHub