Kimai — 1 vulnerability check

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

← All products · Feeds on GitHub

Kimai db_restore.php Unauthenticated Backup Utility Access

CVECVE-2013-10033
Severitycritical · CVSS 9.3
Categoryauth-bypass — Auth bypass
Serviceshttp, https
Detectionset_var, http_request, script, match · highest QoD 75
Feedtests/vulnerabilities/kimai/CVE-2013-10033.yaml

Tests whether the Kimai time-tracking database backup utility, db_restore.php, is open to anonymous users. Kimai 0.9.2.x and earlier serve this page without any login: anyone can create, delete and restore database snapshots, and the restore action is vulnerable to an SQL injection that can lead to code execution. Fixed releases ask for the installation's password salt before showing any backup action. In the web root and in the /kimai, /core and /kimai/core directories, the feed requests db_restore.php once, without credentials, and reports the installation when the "Kimai Backup Restore Utility" page shows its backup action buttons (restore, delete, create backup) instead of the password-salt form. The probe only reads the page: it creates, deletes or restores nothing.

How noctis detects it

  1. HTTP(S) request GET {{dir}}/db_restore.php
  2. Parses / computes the next value with a Rhai script
  3. Checks verdict for ^db_restore\.php at → finding QoD 75: Kimai db_restore.php backup utility reachable without authentication

References:

Feed source — tests/vulnerabilities/kimai/CVE-2013-10033.yaml
# Kimai db_restore.php unauthenticated backup/restore utility — CVE-2013-10033
#
# Kimai (PHP time tracker) ships db_restore.php, which creates, deletes and
# restores in-database snapshots of every Kimai table (kimai_bak_<stamp>_*).
# Up to 0.9.2.x the script has no access control at all: anyone can create,
# delete or restore snapshots, and the restore action pastes dates[] into SQL
# (CVE-2013-10033 as published: unauthenticated SQL injection through dates[],
# INTO OUTFILE to a PHP file in temporary/ when the database runs on the same
# host). Upstream commit 44d04a6 (2013-03-05, "Protected db_restore.php from
# unauthorized access", first released in 0.9.3) makes the page ask for the
# installation's password salt first; until the db_restore_authCode cookie is
# set it only shows an "Authentication required" form with a salt field.
#
# Detection (read-only, one GET per candidate dir: "", /kimai, /core,
# /kimai/core — the last two for installs served from a source checkout):
#   GET <dir>/db_restore.php and report when the "Kimai Backup Restore
#   Utility" page carries the backup action buttons (the language-independent
#   "<!-- delete -->" / "<!-- backup -->" markers that follow them in every
#   release since 2009 — or, when a front end strips HTML comments, the
#   <p class="submit"> block that holds them) and no salt field. Those buttons are only rendered on
#   the authenticated branch of the fixed script, so their presence in an
#   anonymous reply proves the backup/restore actions — and the SQL injection
#   behind restore — are reachable without authentication. QoD 75.
#
# Deviation from the source NASL (better than OpenVAS): the NASL proves the
# bypass by POSTing "create backup" (which copies every Kimai table inside the
# production database) and then "delete". This feed writes nothing: the
# anonymous page alone separates the vulnerable script from the fixed one. It
# also skips the NASL's index.php "Kimai Login" gate (the db_restore page has
# its own product title) and adds the source-checkout directories.
# Proving the dates[] injection itself is not attempted: the only sink is the
# restore action, which drops and recreates tables.
#
# CVSS: NVD publishes only a CVSS 4.0 score (VulnCheck, 9.3 critical).
#
# Ported from OpenVAS/Greenbone NVT 2014/gb_kimai_security_bypass_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.903512, GPL-2.0-only).
# Sink code: kimai/kimai1 core/db_restore.php before and after commit 44d04a6.
uid: 1f4a2ab5-249c-41b1-85d3-22eeab0f1082
name: "Kimai db_restore.php Unauthenticated Backup Utility Access (CVE-2013-10033)"
description: |
  Tests whether the Kimai time-tracking database backup utility,
  db_restore.php, is open to anonymous users. Kimai 0.9.2.x and earlier serve
  this page without any login: anyone can create, delete and restore database
  snapshots, and the restore action is vulnerable to an SQL injection that can
  lead to code execution. Fixed releases ask for the installation's password
  salt before showing any backup action. In the web root and in the /kimai,
  /core and /kimai/core directories, the feed requests db_restore.php once,
  without credentials, and reports the installation when the "Kimai Backup
  Restore Utility" page shows its backup action buttons (restore, delete,
  create backup) instead of the password-salt form. The probe only reads the
  page: it creates, deletes or restores nothing.
cves: [CVE-2013-10033]
cvss: 9.3
severity: critical
category: auth-bypass
confidence_base: 0.30
tags: [kimai, php, auth-bypass, missing-authentication, backup, sqli]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2013-10033"
  - "https://www.vulncheck.com/advisories/kimai-sqli"
  - "https://www.exploit-db.com/exploits/25606"
  - "https://github.com/kimai/kimai1/commit/44d04a6ee0888cddebbc8057ef70dad5416bc176"
  # OpenVAS/Greenbone NASL 2014/gb_kimai_security_bypass_vuln.nasl (GPL-2.0-only)

steps:
  # Pre-initialise the stored result each pass: a failed request leaves it unset.
  - id: init-page
    action: set_var
    var_name: page
    var_value: {status: 0, body: ""}
    loop:
      over: ["", "/kimai", "/core", "/kimai/core"]
      var: dir

  - id: get-db-restore
    action: http_request
    method: GET
    path: "{{dir}}/db_restore.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: page

  - id: judge
    action: script
    store_as: verdict
    code: |
      let b = if type_of(page.body) == "string" { page.body } else { "" };
      if page.status == 200
         && b.contains("Kimai Backup Restore Utility")
         && ((b.contains("<!-- delete -->") && b.contains("<!-- backup -->"))
             || b.contains("<p class=\"submit\">"))
         && !b.contains("name=\"salt\"") {
        "db_restore.php at " + dir + "/db_restore.php returned the Kimai backup utility with its restore/delete/create backup buttons to an unauthenticated request (no password-salt form)"
      } else {
        ""
      }

  - id: report
    action: match
    source: verdict
    pattern: "^db_restore\\.php at "
    on_match:
      finding:
        title: "Kimai db_restore.php backup utility reachable without authentication"
        confidence_delta: 0.50
        qod: 75
        evidence: "{{verdict}}"
        remediation: "Upgrade Kimai to 0.9.3 or later (db_restore.php then requires the installation's password salt), or remove or deny web access to db_restore.php."
      stop: true

View these feeds on GitHub