AdPeeps — 2 vulnerability checks
noctis ships 2 vulnerability checks for AdPeeps, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
AdPeeps index.php uid Reflected Cross-Site Scripting
| CVE | CVE-2009-4939 |
|---|---|
| Severity | medium · CVSS 4.3 |
| Category | xss — XSS |
| Services | http, https |
| Detection | script, set_var, http_request, match · highest QoD 75 |
| Feed | tests/vulnerabilities/adpeeps/CVE-2009-4939.yaml |
Tests AdPeeps (8.5d1 and earlier) for the reflected cross-site scripting in the uid parameter, which index.php prints unescaped inside a quoted HTML attribute. Under /adpeeps and in the web root, the feed first requires the AdPeeps control panel on index.php, then sends uid a quote and a script element that only carries a random marker, on the administrator login page, the advertiser login page and the default page in turn. It reports the install when a 200 reply contains the attribute breakout followed by that exact script element unescaped. A control request putting the same payload in an unknown parameter must not reflect it, so a page that echoes any parameter is not reported. The script is harmless and only reaches the scanner.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{t.dir}}/index.php - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{t.dir}}/index.php?{{t.q}}uid={{sc.payload}} - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{t.dir}}/index.php?{{t.q}}uid=100000&{{sc.marker}}={{sc.payload}} - Parses / computes the next value with a Rhai script
- Checks
hitfor^reflected$→ finding QoD 75: AdPeeps index.php uid Reflected Cross-Site Scripting (CVE-2009-4939)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2009-4939
- https://www.exploit-db.com/exploits/8818
- https://lists.openwall.net/bugtraq/2009/05/27/15
Feed source — tests/vulnerabilities/adpeeps/CVE-2009-4939.yaml
# AdPeeps index.php uid reflected cross-site scripting — CVE-2009-4939
#
# AdPeeps 8.5d1 and earlier (Impact Software banner / text ad rotator, PHP +
# MySQL, commercial, no source published) prints the uid request parameter
# unescaped inside a double-quoted attribute on index.php, its adminlogin
# and login_lookup actions and the view_adrates page (InterN0T advisory,
# Bugtraq 2009-05-27, EDB-8818: uid="><script>alert(0)</script>). With
# magic_quotes_gpc on, PHP prepends a backslash to the quote (\"), which
# does not stop the breakout in HTML.
#
# Detection (benign — the injected script only names a random marker and is
# shown to nobody but the scanner): on /adpeeps and the web root, GET
# index.php and require the AdPeeps control panel (">Ad Peeps" link or the
# ">Advertisement Management Control Panel<" title); then GET
# index.php?loc=adminlogin&uid="><script>alert(/<marker>/)</script>
# (then loc=login_lookup, then no loc), percent-encoded, and report when a
# 200 reply contains the attribute breakout followed by that exact script
# element, unescaped (QoD 75). A control request carries the same payload in
# an unknown parameter: AdPeeps never prints that one, so a page that
# reflects it too is a generic reflector, not this flaw, and is not
# reported (fail-closed).
#
# Improvements over the source NASL:
# - The NASL never sends an XSS payload: it reports this CVE from the
# view_adrates mysql_result() warning (the CVE-2009-4943 path
# disclosure, see CVE-2009-4943.yaml). The feed proves the reflection
# itself with a random marker.
# - The adminlogin / login_lookup pages are probed first: they do not run
# the failing account query that view_adrates runs.
# - Unknown-parameter control against generic reflectors.
#
# CVSS: CVE-2009-4939 v2 4.3 (NVD has no v3 score).
#
# Ported from OpenVAS/Greenbone NVT 2010/gb_adpeeps_mult_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.801414, GPL-2.0-only).
uid: aa956b6c-a28e-4159-8701-a3b27c078155
name: "AdPeeps index.php uid Reflected Cross-Site Scripting (CVE-2009-4939)"
description: |
Tests AdPeeps (8.5d1 and earlier) for the reflected cross-site scripting in
the uid parameter, which index.php prints unescaped inside a quoted HTML
attribute. Under /adpeeps and in the web root, the feed first requires the
AdPeeps control panel on index.php, then sends uid a quote and a script
element that only carries a random marker, on the administrator login
page, the advertiser login page and the default page in turn. It reports
the install when a 200 reply contains the attribute breakout followed by
that exact script element unescaped. A control request putting the same
payload in an unknown parameter must not reflect it, so a page that echoes
any parameter is not reported. The script is harmless and only reaches the
scanner.
cves: [CVE-2009-4939]
cvss: 4.3
severity: medium
category: xss
confidence_base: 0.30
tags: [adpeeps, php, xss, reflected-xss, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2009-4939"
- "https://www.exploit-db.com/exploits/8818"
- "https://lists.openwall.net/bugtraq/2009/05/27/15"
# OpenVAS/Greenbone NASL 2010/gb_adpeeps_mult_vuln.nasl (GPL-2.0-only)
steps:
# ── Random marker and the exact reflection to look for ────────────────────
- id: gen-marker
action: script
code: |
let m = "noctis" + oob_token.sub_string(0, 8) + oob_token.sub_string(9, 4);
#{ marker: m,
script: "<script>alert(/" + m + "/)</script>",
payload: "%22%3E%3Cscript%3Ealert(/" + m + "/)%3C/script%3E" }
store_as: sc
# ── Loop group: every following step runs once per (folder, page) ────────
- id: init-home
action: set_var
var_name: home
var_value: {status: 0, body: ""}
loop:
var: t
over:
- {dir: "/adpeeps", q: "loc=adminlogin&"}
- {dir: "/adpeeps", q: "loc=login_lookup&"}
- {dir: "/adpeeps", q: ""}
- {dir: "", q: "loc=adminlogin&"}
- {dir: "", q: "loc=login_lookup&"}
- {dir: "", q: ""}
# Reset per pass: a reflector (or a failed control) on one page does not
# stop the next page from being tested.
- id: init-hit
action: set_var
var_name: hit
var_value: ""
- id: init-is-adpeeps
action: set_var
var_name: is_adpeeps
var_value: false
- id: init-probe-r
action: set_var
var_name: probe_r
var_value: {status: 0, body: ""}
# "" = control not sent yet, then "clean" / "dirty".
- id: init-ctrl-clean
action: set_var
var_name: ctrl_clean
var_value: ""
- id: init-ctrl-r
action: set_var
var_name: ctrl_r
var_value: {status: 0, body: ""}
- id: fetch-home
action: http_request
method: GET
path: "{{t.dir}}/index.php"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'hit == ""'
store_as: home
- id: gate
action: script
condition: 'hit == ""'
code: |
let b = if type_of(home.body) == "string" { home.body } else { "" };
home.status == 200 && (b.contains(">Ad Peeps") || b.contains(">Advertisement Management Control Panel<"))
store_as: is_adpeeps
- id: probe
action: http_request
method: GET
path: "{{t.dir}}/index.php?{{t.q}}uid={{sc.payload}}"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'hit == "" && is_adpeeps'
store_as: probe_r
# The quote must close the attribute right before the unescaped script
# element ("> — also found inside \"> when magic_quotes_gpc is on).
- id: probe-check
action: script
condition: 'hit == "" && is_adpeeps'
code: |
let body = if type_of(probe_r.body) == "string" { probe_r.body } else { "" };
if probe_r.status == 200 && body.contains("\">" + sc.script) { "reflected" } else { "" }
store_as: hit
# ── Control: the same payload in an unknown parameter ─────────────────────
# AdPeeps does not print unknown parameters, so a page that reflects this
# one echoes everything: not reported. Fail-closed — no control reply, no
# finding.
- id: control
action: http_request
method: GET
path: "{{t.dir}}/index.php?{{t.q}}uid=100000&{{sc.marker}}={{sc.payload}}"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'hit != "" && ctrl_clean == ""'
store_as: ctrl_r
- id: control-check
action: script
condition: 'hit != "" && ctrl_clean == ""'
code: |
let body = if type_of(ctrl_r.body) == "string" { ctrl_r.body } else { "" };
if ctrl_r.status != 0 && !body.contains(sc.script) { "clean" } else { "dirty" }
store_as: ctrl_clean
# ── Finding ───────────────────────────────────────────────────────────────
- id: report
action: match
source: hit
pattern: "^reflected$"
condition: 'ctrl_clean == "clean"'
on_match:
finding:
title: "AdPeeps index.php uid Reflected Cross-Site Scripting (CVE-2009-4939)"
description: "An unauthenticated request to AdPeeps index.php with the uid parameter set to a quote and a script element carrying a random marker returned the attribute breakout and that script element unescaped. An attacker can send a victim, such as the AdPeeps administrator, a link that runs any script in the site's origin."
remediation: "No vendor fix for this flaw is documented: restrict access to AdPeeps or remove it, or make index.php cast uid to an integer (or HTML-escape it with htmlspecialchars) before printing it."
confidence_delta: 0.50
qod: 75
evidence: "{{t.dir}}/index.php?{{t.q}}uid=\"><script>alert(/{{sc.marker}}/)</script> was reflected unescaped after the attribute breakout: \">{{sc.script}}; the same payload in an unknown parameter was not"
stop: trueAdPeeps index.php view_adrates uid Installation Path Disclosure
| CVE | CVE-2009-4943 |
|---|---|
| Severity | medium · CVSS 5.0 |
| Category | exposure — Exposure |
| Services | http, https |
| Detection | script, set_var, http_request, match · highest QoD 75 |
| Feed | tests/vulnerabilities/adpeeps/CVE-2009-4943.yaml |
Tests AdPeeps (8.5d1 and earlier) for the error message that discloses the installation path: index.php?loc=view_adrates reads the account named by the uid parameter with mysql_result() without checking that it exists, and PHP prints a warning quoting the full path of the script. Under /adpeeps and in the web root, the feed first requires the AdPeeps control panel on index.php, then requests the ad rates page with a random account number that does not exist. It reports the install when the reply carries the mysql_result() "Unable to jump to row 0 on MySQL result" warning with the "in <path> on line <n>" part, and quotes the disclosed path. Read-only: the probe only views a page.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/index.php - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/index.php?loc=view_adrates&uid={{rnd_uid}} - Parses / computes the next value with a Rhai script
- Checks
hitfor\.php[0-9]?$→ finding QoD 75: AdPeeps index.php view_adrates uid Installation Path Disclosure (CVE-2009-4943)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2009-4943
- https://www.exploit-db.com/exploits/8818
- https://lists.openwall.net/bugtraq/2009/05/27/15
Feed source — tests/vulnerabilities/adpeeps/CVE-2009-4943.yaml
# AdPeeps index.php view_adrates uid installation path disclosure — CVE-2009-4943
#
# AdPeeps 8.5d1 and earlier (Impact Software banner / text ad rotator, PHP +
# MySQL, commercial, no source published) looks up the account named by uid
# on index.php?loc=view_adrates and reads the first row with mysql_result()
# without checking that the account exists. For an unknown uid PHP prints
# "mysql_result(): Unable to jump to row 0 on MySQL result index N in
# <script path> on line N", which hands the absolute install path to an
# unauthenticated visitor (InterN0T advisory, Bugtraq 2009-05-27, EDB-8818).
#
# Detection (read-only): on /adpeeps and the web root, GET index.php and
# require the AdPeeps control panel (">Ad Peeps" link or the
# ">Advertisement Management Control Panel<" title); then GET
# index.php?loc=view_adrates&uid=<random 9-digit number> and report when the
# reply carries the mysql_result() "Unable to jump to row 0 on MySQL result"
# warning together with the " in <path> on line <n>" part that discloses the
# path (QoD 75). The disclosed path is quoted in the evidence.
#
# Improvements over the source NASL:
# - The NASL sends a fixed uid (1000000), which may be a real account on a
# busy install; the feed uses a random 9-digit uid, never an account.
# - The NASL reports on the warning text alone; the feed requires the
# " in <file>.php on line" part, i.e. the path disclosure the CVE is
# about (a handler that prints the warning without the path is not
# reported), and quotes the disclosed path in the evidence.
# - The NASL reports CVE-2009-4939 (XSS) and CVE-2009-4945 (default
# admin/admin password) from this probe too; the XSS is proven
# separately in CVE-2009-4939.yaml. The default password is not tested:
# no public record gives the admin login request, and a login attempt
# can lock or alert on the account.
#
# CVSS: CVE-2009-4943 v2 5.0 (NVD has no v3 score).
#
# Ported from OpenVAS/Greenbone NVT 2010/gb_adpeeps_mult_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.801414, GPL-2.0-only).
uid: 0b35a79b-eab6-4f7d-9bdd-3440365c3ffd
name: "AdPeeps index.php view_adrates uid Installation Path Disclosure (CVE-2009-4943)"
description: |
Tests AdPeeps (8.5d1 and earlier) for the error message that discloses the
installation path: index.php?loc=view_adrates reads the account named by
the uid parameter with mysql_result() without checking that it exists, and
PHP prints a warning quoting the full path of the script. Under /adpeeps
and in the web root, the feed first requires the AdPeeps control panel on
index.php, then requests the ad rates page with a random account number
that does not exist. It reports the install when the reply carries the
mysql_result() "Unable to jump to row 0 on MySQL result" warning with the
"in <path> on line <n>" part, and quotes the disclosed path. Read-only: the
probe only views a page.
cves: [CVE-2009-4943]
cvss: 5.0
severity: medium
category: exposure
confidence_base: 0.30
tags: [adpeeps, php, mysql, information-disclosure, path-disclosure, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2009-4943"
- "https://www.exploit-db.com/exploits/8818"
- "https://lists.openwall.net/bugtraq/2009/05/27/15"
# OpenVAS/Greenbone NASL 2010/gb_adpeeps_mult_vuln.nasl (GPL-2.0-only)
steps:
# Random account number (9 digits) that no install has.
- id: gen-uid
action: script
code: 'rand_int(100000000, 999999999).to_string()'
store_as: rnd_uid
- id: init-hit
action: set_var
var_name: hit
var_value: ""
# ── Loop group: every following step runs once per install folder ────────
- id: init-home
action: set_var
var_name: home
var_value: {status: 0, body: ""}
loop:
var: dir
over: ["/adpeeps", ""]
- id: init-is-adpeeps
action: set_var
var_name: is_adpeeps
var_value: false
- id: init-rates
action: set_var
var_name: rates
var_value: {status: 0, body: ""}
- id: fetch-home
action: http_request
method: GET
path: "{{dir}}/index.php"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'hit == ""'
store_as: home
- id: gate
action: script
condition: 'hit == ""'
code: |
let b = if type_of(home.body) == "string" { home.body } else { "" };
home.status == 200 && (b.contains(">Ad Peeps") || b.contains(">Advertisement Management Control Panel<"))
store_as: is_adpeeps
- id: probe
action: http_request
method: GET
path: "{{dir}}/index.php?loc=view_adrates&uid={{rnd_uid}}"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'hit == "" && is_adpeeps'
store_as: rates
# The mysql_result() warning with the path of the script that raised it.
- id: probe-check
action: script
condition: 'hit == "" && is_adpeeps'
code: |
let b = if type_of(rates.body) == "string" { rates.body } else { "" };
let out = "";
if b.contains("mysql_result()") && b.contains("Unable to jump to row 0 on MySQL result") {
let m = eregmatch("Unable to jump to row 0 on MySQL result(?: index [0-9]+)?\\s+in\\s+(?:<b>)?([^<>\\r\\n]{1,300}?\\.php[0-9]?)(?:</b>)?\\s+on\\s+line", b);
if type_of(m) == "array" && m.len() > 1 {
out = m[1];
}
}
out
store_as: hit
# ── Finding ───────────────────────────────────────────────────────────────
- id: report
action: match
source: hit
pattern: "\\.php[0-9]?$"
on_match:
finding:
title: "AdPeeps index.php view_adrates uid Installation Path Disclosure (CVE-2009-4943)"
description: "An unauthenticated request to AdPeeps index.php?loc=view_adrates with an account number that does not exist returned the PHP mysql_result() \"Unable to jump to row 0 on MySQL result\" warning, which quotes the absolute path of the script on the server. The path helps an attacker aim other attacks (file inclusion, traversal) at the host."
remediation: "Turn off display_errors in the PHP configuration of the site (log errors instead of printing them). No vendor fix for this flaw is documented: restrict access to AdPeeps or remove it."
confidence_delta: 0.50
qod: 75
evidence: "{{dir}}/index.php?loc=view_adrates&uid={{rnd_uid}} returned the mysql_result() \"Unable to jump to row 0 on MySQL result\" warning disclosing the script path {{hit}}"
stop: true