w-Agora — 1 vulnerability check

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

← All products · Feeds on GitHub

w-Agora search.php bn Parameter Reflected XSS

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

Tests the w-Agora PHP forum for the reflected cross-site scripting in the bn (forum name) parameter of search.php. The feed requests search.php and search.php3 under the web root, /w-agora, /wagora, /agora, /forum, /forums and /news with bn set to an HTML tag built from a random marker. For an unknown forum, a vulnerable w-Agora answers with a "Could not access configuration file" warning that quotes the configuration path built from bn without escaping it. The finding requires that warning to hold this scan's tag verbatim inside the path, followed by the .php or .php3 extension the application appends. A version that HTML-escapes the value is not reported. The request only renders an error message and changes nothing on the server.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{script}}?bn=%3C{{tok}}%3E
  3. Parses / computes the next value with a Rhai script
  4. Checks xss_proof for ^Could not access configuration file: <b>[^<>]*<noctis[0-9a-f]{12}>\.… → finding QoD 75: w-Agora search.php bn Parameter Reflected XSS (CVE-2010-4868)

References:

Feed source — tests/vulnerabilities/w-agora/CVE-2010-4868.yaml
# w-Agora search.php bn reflected XSS — CVE-2010-4868
#
# w-Agora 4.2.1 and earlier (init.inc, read in the SourceForge 4.2.1 "php" and
# "php3" tarballs, same code in 4.1.6 and 4.2.0) take the forum name `bn`
# (register_globals), keep its basename(), and look for conf/<bn>.<ext>. When
# neither that file nor conf/site_<site>.<ext> exists (site = bn up to the
# first "_"), init.inc runs
#     msgWarning ("Forum <b>$forum_name</b> does not exist<br>Could not access configuration file: <b>$cfg_file</b>", ...);
# and msgWarning() (include/misc_func.php) echoes the message raw, so markup
# in bn is rendered on the page. 4.2.1 is the last release; there is no fix.
#
# Detection (benign, read-only): GET <dir>/search.php and search.php3 with
# bn=<noctis<random>> (percent-encoded; no "/" so basename() keeps it, no "_"
# so the warning path is taken, no quote so magic_quotes_gpc cannot alter it)
# on the usual install dirs. Reported when the page holds, verbatim,
# "Could not access configuration file: <b>…<noctis<random>>.php</b>" (or
# .php3): the tag is unescaped and the server added the config path around it.
# QoD 75.
#
# Improvements over the source NASL:
#   - Random marker per scan, inert tag (no script): a page that always shows
#     a fixed tag in that warning is not reported.
#   - The marker must sit inside the config-file path the application builds
#     (conf/... + .php/.php3 suffix), so a generic URL reflector does not match.
#   - Installs under /w-agora, /wagora, /agora, /forum, /forums and /news are
#     probed, besides the web root.
#
# CVE-2010-4867 (the same advisory's "bn=..\1" local file inclusion) is not
# covered: bn goes through basename() before the include in every release
# read (4.1.6, 4.2.0, 4.2.1), which strips "/" everywhere and "\" on Windows,
# so the request only prints the same "Could not access configuration file"
# warning — there is no file inclusion to prove.
#
# Ported from OpenVAS/Greenbone NVT 2010/gb_w-agora_44370.nasl (GPL-2.0-only).
# Vulnerable code read from sourceforge.net/projects/w-agora (4.2.1).
uid: e3829f29-dca7-4522-bb13-6b672e926a36
name: "w-Agora search.php bn Parameter Reflected XSS (CVE-2010-4868)"
description: |
  Tests the w-Agora PHP forum for the reflected cross-site scripting in the
  bn (forum name) parameter of search.php. The feed requests search.php and
  search.php3 under the web root, /w-agora, /wagora, /agora, /forum, /forums
  and /news with bn set to an HTML tag built from a random marker. For an
  unknown forum, a vulnerable w-Agora answers with a "Could not access
  configuration file" warning that quotes the configuration path built from
  bn without escaping it. The finding requires that warning to hold this
  scan's tag verbatim inside the path, followed by the .php or .php3
  extension the application appends. A version that HTML-escapes the value
  is not reported. The request only renders an error message and changes
  nothing on the server.
cves: [CVE-2010-4868]
cvss: 4.3
severity: medium
category: xss
confidence_base: 0.30
tags: [w-agora, forum, xss, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2010-4868"
  - "https://www.exploit-db.com/exploits/34906"
  - "https://sourceforge.net/projects/w-agora/"
  # OpenVAS/Greenbone NASL 2010/gb_w-agora_44370.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 script path. Each pass
  # resets the values it reads, so nothing is left over from the previous one.
  - id: init-probe-r
    action: set_var
    var_name: probe_r
    var_value: {status: 0, body: ""}
    loop:
      var: script
      over:
        - "/search.php"
        - "/search.php3"
        - "/w-agora/search.php"
        - "/w-agora/search.php3"
        - "/wagora/search.php"
        - "/wagora/search.php3"
        - "/agora/search.php"
        - "/agora/search.php3"
        - "/forum/search.php"
        - "/forum/search.php3"
        - "/forums/search.php"
        - "/forums/search.php3"
        - "/news/search.php"
        - "/news/search.php3"

  - id: probe
    action: http_request
    method: GET
    path: "{{script}}?bn=%3C{{tok}}%3E"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 8
    store_as: probe_r

  # The warning quoting the config path built around the unescaped tag — or "".
  - id: reflection
    action: script
    code: |
      let out = "";
      if probe_r.status == 200 && type_of(probe_r.body) == "string" {
        let m = eregmatch("Could not access configuration file: <b>[^<>]*<" + tok + ">\\.php3?</b>", probe_r.body);
        if type_of(m) == "array" && m.len() > 0 {
          out = m[0];
        }
      }
      out
    store_as: xss_proof

  - id: report
    action: match
    source: xss_proof
    pattern: '^Could not access configuration file: <b>[^<>]*<noctis[0-9a-f]{12}>\.php3?</b>$'
    on_match:
      finding:
        title: "w-Agora search.php bn Parameter Reflected XSS (CVE-2010-4868)"
        description: "A w-Agora search page requested with an HTML tag as the forum name (bn) answered with its \"Could not access configuration file\" warning quoting the configuration path built from that value without escaping it, so the tag is rendered as markup. An attacker can send a crafted link that runs script in the browser of a forum user in the context of the site."
        remediation: "w-Agora is no longer maintained and no release fixes this flaw: remove it or restrict access to it (for example behind web-server authentication), and migrate to a maintained forum. As a stopgap, HTML-escape the message printed by msgWarning() in include/misc_func.php."
        confidence_delta: 0.55
        qod: 75
        evidence: "GET {{script}}?bn=%3C<marker>%3E returned HTTP 200 with the unescaped tag in the warning: {{xss_proof}}"
      stop: true

View these feeds on GitHub