X-News — 1 vulnerability check

noctis ships 1 vulnerability check for X-News, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

X-News db/users.txt Account and Password Hash Disclosure

CVECVE-2002-1656
Severityhigh · CVSS 7.5
Categoryexposure — Exposure
Serviceshttp, https
Detectionset_var, http_request, match, script · highest QoD 75
Feedtests/vulnerabilities/x-news/CVE-2002-1656.yaml

Detects X-News installations that serve their account database, db/users.txt, to anyone (CVE-2002-1656). The file holds one line per account with the user name, the MD5 hash of the password, the e-mail address and the user level, and X-News accepts that MD5 hash as its login cookie, so reading the file is enough to sign in as any account, the administrator included. The feed requests x_news.php under the web root, /cgi-bin, /scripts and the usual x-news, xnews, x_news and news folders, and continues only where it returns HTTP 200 with the X-News "Powered by x-news" footer. It then requests db/users.txt in the same folder and reports when the reply is HTTP 200 and holds at least one account line with an MD5 password hash and a user level of 1 to 3. A control request for db/users.txt under an absent random folder must return no account line, so a server that answers every such request with the same content is not reported. Only the user level appears in the evidence; names, hashes and addresses are redacted. Nothing is changed on the target.

How noctis detects it

  1. HTTP(S) request GET {{dir}}/x_news.php
  2. HTTP(S) request GET {{dir}}/db/users.txt
  3. Checks users.body for (?m)^[^|\r\n]+\|[^|\r\n]+\|[0-9A-Fa-f]{32}\|[^|\r\n]*\|([1-3])[ \t]*(…
  4. Parses / computes the next value with a Rhai script
  5. HTTP(S) request GET {{dir}}/noctis-absent-{{oob_token}}/db/users.txt
  6. Checks ctrl.body for (?m)^[^|\r\n]+\|[^|\r\n]+\|[0-9A-Fa-f]{32}\|[^|\r\n]*\|[1-3]
  7. Checks proof for ^<redacted>\|<redacted>\|<md5 redacted>\|<redacted>\|[1-3]$ → finding QoD 75: X-News db/users.txt Account and Password Hash Disclosure (CVE-2002-1656)

References:

Feed source — tests/vulnerabilities/x-news/CVE-2002-1656.yaml
# X-News (xqus.com, flat-file PHP news script) db/users.txt account database
# disclosure — CVE-2002-1656 (BID 4283, CERT VU#162723, SecurityTracker 1003828)
#
# X-News <= 1.1 keeps its accounts in <install dir>/db/users.txt, one
#   user_id|username|md5(password)|mail|user_level
# line per account (user_level 1, 2 or 3), and ships no rule that stops the
# web server from serving it. The MD5 hash is also what X-News accepts as the
# authentication cookie, so reading the file is enough to log in as any
# account, the administrator included, without cracking anything.
#
# Detection (benign, read-only):
#   1. GET <dir>/x_news.php — must be HTTP 200 with the "Powered by
#      <a href='http://www.xqus.com'>x-news</a>" footer (X-News is installed);
#   2. GET <dir>/db/users.txt — must be HTTP 200 with at least one account
#      line whose third field is a 32-hex MD5 hash and whose fifth is the user
#      level 1–3 (QoD 75);
#   3. control: GET <dir>/noctis-absent-<random>/db/users.txt must NOT return
#      an account line, so a server that answers every users.txt request with
#      the same content is not reported (fail-closed: no reply → no finding).
# The account line is never copied into the finding: only its user level
# survives, every other field is replaced by <redacted>.
#
# Better than the reference check: the reference accepts any five
# |-separated fields ending in 1–3 anywhere in the reply (a CSV or log line
# matches); the feed requires a whole line with an MD5 hash in the password
# field, adds the honeypot control above, and also looks in the usual
# x-news/xnews/x_news/news folders, not only the web root and CGI dirs.
#
# CVSS: NVD has only a v2 score for CVE-2002-1656 (7.5, AV:N/AC:L/Au:N/C:P/I:P/A:P).
#
# Ported from OpenVAS/Greenbone NVT pre2008/xnews.nasl
# (OID 1.3.6.1.4.1.25623.1.0.12068, GPL-2.0-only).
uid: a2067d27-2266-4f35-bc75-2d6bd82b1195
name: "X-News db/users.txt Account and Password Hash Disclosure (CVE-2002-1656)"
description: |
  Detects X-News installations that serve their account database,
  db/users.txt, to anyone (CVE-2002-1656). The file holds one line per
  account with the user name, the MD5 hash of the password, the e-mail
  address and the user level, and X-News accepts that MD5 hash as its login
  cookie, so reading the file is enough to sign in as any account, the
  administrator included. The feed requests x_news.php under the web root,
  /cgi-bin, /scripts and the usual x-news, xnews, x_news and news folders,
  and continues only where it returns HTTP 200 with the X-News "Powered by
  x-news" footer. It then requests db/users.txt in the same folder and
  reports when the reply is HTTP 200 and holds at least one account line with
  an MD5 password hash and a user level of 1 to 3. A control request for
  db/users.txt under an absent random folder must return no account line, so
  a server that answers every such request with the same content is not
  reported. Only the user level appears in the evidence; names, hashes and
  addresses are redacted. Nothing is changed on the target.
cves: [CVE-2002-1656]
cvss: 7.5
severity: high
category: exposure
confidence_base: 0.30
tags: [x-news, xqus, php, information-disclosure, password-hash, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2002-1656"
  - "https://www.kb.cert.org/vuls/id/162723"
  - "http://www.securityfocus.com/bid/4283"
  - "http://securitytracker.com/id?1003828"
  # OpenVAS/Greenbone NASL pre2008/xnews.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-page
    action: set_var
    var_name: page
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["", "/x-news", "/xnews", "/x_news", "/news", "/cgi-bin", "/scripts"]

  - id: init-users
    action: set_var
    var_name: users
    var_value: {status: 0, body: ""}

  - id: init-proof
    action: set_var
    var_name: proof
    var_value: ""

  - id: init-ctrl
    action: set_var
    var_name: ctrl
    var_value: {status: 0, body: ""}

  - id: init-ctrl-hit
    action: set_var
    var_name: ctrl_hit
    var_value: false

  # ── 1. X-News is installed here ──────────────────────────────────────────
  - id: x-news-page
    action: http_request
    method: GET
    path: "{{dir}}/x_news.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: page

  # ── 2. The account database is served ────────────────────────────────────
  - id: read-users
    action: http_request
    method: GET
    path: "{{dir}}/db/users.txt"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "page.status == 200 && type_of(page.body) == \"string\" && ereg(\"(?i)Powered by\\\\s*<a\\\\s+href\\\\s*=\\\\s*[\\\"']?https?://(?:www\\\\.)?xqus\\\\.com/?[\\\"']?[^>]*>\\\\s*x-news\\\\s*</a>\", page.body)"
    store_as: users

  # No on_match: the raw line holds a name, a password hash and an address.
  # Only the user level is captured.
  - id: account-line
    action: match
    source: users.body
    pattern: "(?m)^[^|\\r\\n]+\\|[^|\\r\\n]+\\|[0-9A-Fa-f]{32}\\|[^|\\r\\n]*\\|([1-3])[ \\t]*(?:\\|[^\\r\\n]*)?\\r?$"
    condition: "users.status == 200 && type_of(users.body) == \"string\""
    store_as: account_m

  - id: redact
    action: script
    code: |
      if account_m.matched && account_m.captures.len() > 0 {
        "<redacted>|<redacted>|<md5 redacted>|<redacted>|" + account_m.captures[0]
      } else { "" }
    condition: "users.status == 200 && type_of(users.body) == \"string\""
    store_as: proof

  # ── 3. Control: users.txt under an absent random folder ──────────────────
  - id: control
    action: http_request
    method: GET
    path: "{{dir}}/noctis-absent-{{oob_token}}/db/users.txt"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'proof != ""'
    store_as: ctrl

  - id: control-content
    action: match
    source: ctrl.body
    pattern: "(?m)^[^|\\r\\n]+\\|[^|\\r\\n]+\\|[0-9A-Fa-f]{32}\\|[^|\\r\\n]*\\|[1-3]"
    condition: 'proof != "" && ctrl.status != 0'
    on_match:
      set_vars:
        ctrl_hit: true

  # ── Finding (control answered and returned no account line) ──────────────
  - id: report
    action: match
    source: proof
    pattern: "^<redacted>\\|<redacted>\\|<md5 redacted>\\|<redacted>\\|[1-3]$"
    condition: "ctrl.status != 0 && ctrl_hit == false"
    on_match:
      finding:
        title: "X-News db/users.txt Account and Password Hash Disclosure (CVE-2002-1656)"
        description: "An unauthenticated request for db/users.txt in the X-News folder returned the account database, with the MD5 hash of each account's password. X-News accepts that hash as its login cookie, so anyone who reads the file can sign in as any account, the administrator included."
        remediation: "Deny web access to the X-News db/ folder (for example with a 'Deny from all' rule or by moving it outside the document root), change every X-News password, or replace X-News, which is no longer maintained."
        confidence_delta: 0.55
        qod: 75
        evidence: "{{dir}}/x_news.php is X-News and {{dir}}/db/users.txt returned HTTP 200 with an account line; a control request under an absent folder returned none. Redacted line: {{proof}}"
      stop: true

View these feeds on GitHub