CANDID — 2 vulnerability checks
noctis ships 2 vulnerability checks for CANDID, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
CANDID image/view.php image_id parameter SQL injection
| CVE | CVE-2010-4979 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | sqli — SQL injection |
| Services | http, https |
| Detection | set_var, script, http_request, match · highest QoD 75 |
| Feed | tests/vulnerabilities/candid/CVE-2010-4979.yaml |
CANDID (image gallery script) puts the image_id parameter of image/view.php into an SQL query without escaping it, allowing unauthenticated SQL injection against the application database.
Under the web root and /candid, this check requests image/view.php with image_id=1 as a control, then again with a single quote and a random inert marker appended to the value. A MySQL syntax error that quotes the marker back and appears only for the quoted request proves the value reaches the query unescaped. 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 {{adir}}/image/view.php?image_id=1 - HTTP(S) request
GET {{adir}}/image/view.php?image_id=1%27{{mkr.v}} - Parses / computes the next value with a Rhai script
- Checks
res.sqlifor^true$→ finding QoD 75: CANDID image/view.php image_id parameter SQL injection (CVE-2010-4979)
References:
Feed source — tests/vulnerabilities/candid/CVE-2010-4979.yaml
# CANDID — image/view.php image_id parameter SQL injection (CVE-2010-4979)
#
# image/view.php puts the image_id parameter into an SQL query without
# escaping it. The cross-site scripting flaw of the same script
# (CVE-2010-4978) is the sibling feed CVE-2010-4978.yaml.
#
# Detection (per candidate install dir: web root, /candid):
# 1. QoD 75 — image/view.php?image_id=1 (control) carries no database error,
# then image_id=1'MARK (a quote followed by a random marker) answers with
# a MySQL syntax error that quotes the marker back.
#
# Read-only: the only payload is a quote and an inert marker; nothing is
# written and no data is read from the database.
#
# Ported from OpenVAS/Greenbone NVT `2016/gb_candid_sql_nd_xss_vuln.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.807583, GPL-2.0-only). Differences: the NASL
# sends a fixed marker without a control request; here the error must appear
# only for the quoted request and must echo a per-run random marker.
# CVSS: NVD carries only a CVSS v2 score (7.5).
uid: 143e9e2c-db75-488c-8ed6-4ca9790972d9
name: "CANDID image/view.php image_id parameter SQL injection (CVE-2010-4979)"
description: |
CANDID (image gallery script) puts the image_id parameter of
image/view.php into an SQL query without escaping it, allowing
unauthenticated SQL injection against the application database.
Under the web root and /candid, this check requests image/view.php with
image_id=1 as a control, then again with a single quote and a random inert
marker appended to the value. A MySQL syntax error that quotes the marker
back and appears only for the quoted request proves the value reaches the
query unescaped. Nothing is written and no data is read from the database.
cves: [CVE-2010-4979]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [candid, php, sqli, error-based]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2010-4979"
- "https://www.exploit-db.com/exploits/34219"
steps:
# 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-ctl
action: set_var
var_name: ctl_resp
var_value: {status: 0, body: ""}
loop:
over: ["", "/candid"]
var: adir
- id: init-inj
action: set_var
var_name: inj_resp
var_value: {status: 0, body: ""}
- id: mk
action: script
code: |
#{ v: "NCT" + rand_hex(6) }
store_as: mkr
- id: control
action: http_request
method: GET
port: "{{port}}"
path: "{{adir}}/image/view.php?image_id=1"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
store_as: ctl_resp
- id: inject
action: http_request
method: GET
port: "{{port}}"
path: "{{adir}}/image/view.php?image_id=1%27{{mkr.v}}"
condition: 'ctl_resp.status == 200 && type_of(ctl_resp.body) == "string" && !ereg("(?i)(error in your SQL syntax|mysql_fetch|MySQL server version)", ctl_resp.body)'
tls_insecure: true
follow_redirects: false
timeout_secs: 15
store_as: inj_resp
- id: check
action: script
code: |
let ib = if type_of(inj_resp.body) == "string" { inj_resp.body } else { "" };
let sqli = inj_resp.status >= 200 && inj_resp.status < 500 && ereg("(?i)error in your SQL syntax", ib) && ib.contains(mkr.v);
#{ sqli: sqli }
store_as: res
- id: report-sqli
action: match
source: res.sqli
pattern: "^true$"
condition: "res.sqli"
on_match:
finding:
title: "CANDID image/view.php image_id parameter SQL injection (CVE-2010-4979)"
description: "A quote and a random marker appended to the image_id parameter of image/view.php made CANDID print a database syntax error quoting the marker, while the same request without them did not: the value reaches an SQL query unescaped, so an unauthenticated attacker can run arbitrary SQL against the application database."
remediation: "Cast image_id to an integer or use parameterised queries in image/view.php; upgrade or replace CANDID, which is no longer maintained."
confidence_delta: 0.45
qod: 75
evidence: "{{adir}}/image/view.php: image_id=1 answers without a database error, image_id=1' + marker answers with an SQL syntax error quoting the marker"
stop: trueCANDID image/view.php image_id parameter cross-site scripting
| CVE | CVE-2010-4978 |
|---|---|
| Severity | medium · CVSS 4.3 |
| Category | xss — XSS |
| Services | http, https |
| Detection | set_var, script, http_request, match · highest QoD 75 |
| Feed | tests/vulnerabilities/candid/CVE-2010-4978.yaml |
CANDID (image gallery script) prints the image_id parameter of image/view.php back into the page without HTML-encoding it, allowing reflected cross-site scripting.
Under the web root and /candid, this check requests image/view.php with image_id set to a script tag wrapping a random inert marker and reports the issue when the reply is an HTML page carrying the whole tag verbatim. The same payload sent to a non-existent look-alike script must not be reflected, which rules out servers that echo any request. Nothing is written on the target.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{adir}}/image/view.php?image_id=%3Cscript%3E{{mkr.v}}%3C/script%3E - HTTP(S) request
GET {{adir}}/image/nonexistent-{{mkr.v}}.php?image_id=%3Cscript%3E{{mkr.v}}%3C/script%3E - Parses / computes the next value with a Rhai script
- Checks
res.xssfor^true$→ finding QoD 75: CANDID image/view.php image_id parameter cross-site scripting (CVE-2010-4978)
References:
Feed source — tests/vulnerabilities/candid/CVE-2010-4978.yaml
# CANDID — image/view.php image_id parameter reflected cross-site scripting (CVE-2010-4978)
#
# image/view.php prints the image_id parameter back into the page without
# HTML-encoding it. The SQL injection of the same script (CVE-2010-4979) is
# the sibling feed CVE-2010-4979.yaml.
#
# Detection (per candidate install dir: web root, /candid):
# 1. QoD 75 — image/view.php?image_id=<script>MARK</script> (MARK random per
# run) comes back with the tag unencoded in an HTML reply, while a
# look-alike path that is not image/view.php does not reflect it.
#
# Read-only: two GETs with a random inert marker, nothing is written.
#
# Ported from OpenVAS/Greenbone NVT `2016/gb_candid_sql_nd_xss_vuln.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.807583, GPL-2.0-only). Differences: the NASL
# only checks the SQL error; here the XSS is proven with a random inert marker
# and a negative-path control that rules out a generic reflector.
# CVSS: NVD carries only a CVSS v2 score (4.3).
uid: 25f660ed-3a2d-4921-bb4d-7826b32a75b2
name: "CANDID image/view.php image_id parameter cross-site scripting (CVE-2010-4978)"
description: |
CANDID (image gallery script) prints the image_id parameter of
image/view.php back into the page without HTML-encoding it, allowing
reflected cross-site scripting.
Under the web root and /candid, this check requests image/view.php with
image_id set to a script tag wrapping a random inert marker and reports
the issue when the reply is an HTML page carrying the whole tag verbatim.
The same payload sent to a non-existent look-alike script must not be
reflected, which rules out servers that echo any request. Nothing is
written on the target.
cves: [CVE-2010-4978]
cvss: 4.3
severity: medium
category: xss
confidence_base: 0.30
tags: [candid, php, xss, reflected]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2010-4978"
- "https://www.exploit-db.com/exploits/34220"
steps:
# 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-xss
action: set_var
var_name: xss_resp
var_value: {status: 0, body: ""}
loop:
over: ["", "/candid"]
var: adir
- id: init-ctl
action: set_var
var_name: ctl_resp
var_value: {status: 0, body: ""}
- id: mk
action: script
code: |
#{ v: "NCT" + rand_hex(6) }
store_as: mkr
- id: reflect
action: http_request
method: GET
port: "{{port}}"
path: "{{adir}}/image/view.php?image_id=%3Cscript%3E{{mkr.v}}%3C/script%3E"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
store_as: xss_resp
- id: control
action: http_request
method: GET
port: "{{port}}"
path: "{{adir}}/image/nonexistent-{{mkr.v}}.php?image_id=%3Cscript%3E{{mkr.v}}%3C/script%3E"
condition: 'xss_resp.status == 200 && type_of(xss_resp.body) == "string" && xss_resp.body.contains("<script>" + mkr.v + "</script>")'
tls_insecure: true
follow_redirects: false
timeout_secs: 15
store_as: ctl_resp
- id: check
action: script
code: |
let b = if type_of(xss_resp.body) == "string" { xss_resp.body } else { "" };
let cb = if type_of(ctl_resp.body) == "string" { ctl_resp.body } else { "" };
let ct = if type_of(xss_resp.headers) == "map" && "content-type" in xss_resp.headers { xss_resp.headers["content-type"] } else { "" };
let tag = "<script>" + mkr.v + "</script>";
let xss = xss_resp.status == 200 && b.contains(tag) && ct.to_lower().contains("html") && !cb.contains(tag);
#{ xss: xss }
store_as: res
- id: report-xss
action: match
source: res.xss
pattern: "^true$"
condition: "res.xss"
on_match:
finding:
title: "CANDID image/view.php image_id parameter cross-site scripting (CVE-2010-4978)"
description: "image/view.php printed the image_id parameter back into an HTML page without encoding it: a script tag carrying a random marker came back verbatim, while a look-alike script did not reflect it, so an attacker can run script in a visitor's browser in the context of the site."
remediation: "HTML-encode image_id (htmlspecialchars) before printing it, or cast it to an integer; upgrade or replace CANDID, which is no longer maintained."
confidence_delta: 0.45
qod: 75
evidence: "{{adir}}/image/view.php: <script>{{mkr.v}}</script> in image_id is reflected unencoded"
stop: true