Calendar Express — 1 vulnerability check

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

← All products · Feeds on GitHub

Calendar Express search.php reflected cross-site scripting

Severitymedium
Categoryxss — XSS
Serviceshttp, https
Detectionset_var, script, http_request, match · highest QoD 75
Feedtests/vulnerabilities/calendar-express/calendar-express-search-xss.yaml

PHP Lite Calendar Express, a PHP calendar script, prints the allwords search parameter of search.php back into the results page without encoding it, so script sent in a link runs in the visitor's browser.

The check requests search.php on the usual install paths (/calendarexpress, the web root, /calendar, /calendarexpress2) with a script tag holding a random marker as allwords. It reports the flaw when the reply is a 200 page that carries the product footer "Calendar Express N [Powered by Phplite.com]" and contains the script tag unescaped, marker included.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{dir}}/search.php?allwords=%3Cbr%3E%3Cscript%3E{{mark}}%3C/script%3E&cid=0&title=1&d…
  3. Parses / computes the next value with a Rhai script
  4. Checks hit for echoes the allwords → finding QoD 75: Calendar Express search.php reflected cross-site scripting

References:

Feed source — tests/vulnerabilities/calendar-express/calendar-express-search-xss.yaml
# PHP Lite Calendar Express — search.php reflected cross-site scripting.
#
# CVE mapping: the backlog issue (#1635) carries CVE-2007-3627, but that record
# describes SQL injection through the cid parameter of login.php, auth.php and
# subscribe.php (Calendar Express 2.2). The reflected XSS this feed proves in
# search.php (BID 14505) has no CVE of its own in the NVD, so `cves` is empty.
# The product's source is no longer distributed, so the SQL injection cannot be
# checked against real code and has no feed here.
#
# Ported from OpenVAS/Greenbone NVT `pre2008/calendar_express_flaws.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.19749, GPL-2.0-only): GET
# <dir>/search.php?allwords=<br><script>foo</script>&cid=0&title=1&desc=1 on
# /calendarexpress and the CGI dirs; vulnerable when the reply is a 200, echoes
# the script tag unescaped and carries "Calendar Express N [Powered by Phplite.com]".
#
# Better than the NVT:
#   - the script tag carries a random marker instead of the fixed "foo", so a
#     page that happens to print "<script>foo</script>" cannot match;
#   - the marker is required in the exact form sent (unescaped), and the page
#     must carry the product footer, so a generic reflector is not reported;
#   - also tries the web root, /calendar and /calendarexpress2 (the NVT's CGI
#     dirs are /cgi-bin and /scripts only).
uid: 46d802e9-1f29-4df0-a0ff-e36f2cb868de
name: "Calendar Express search.php reflected cross-site scripting"
description: |
  PHP Lite Calendar Express, a PHP calendar script, prints the allwords
  search parameter of search.php back into the results page without
  encoding it, so script sent in a link runs in the visitor's browser.

  The check requests search.php on the usual install paths (/calendarexpress,
  the web root, /calendar, /calendarexpress2) with a script tag holding a
  random marker as allwords. It reports the flaw when the reply is a 200 page
  that carries the product footer "Calendar Express N [Powered by
  Phplite.com]" and contains the script tag unescaped, marker included.
category: xss
cves: []
severity: medium
confidence_base: 0.30
tags: [calendar-express, phplite, xss, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "http://www.securityfocus.com/bid/14505"
  - "https://nvd.nist.gov/vuln/detail/CVE-2007-3627"

steps:
  - id: init-hit
    action: set_var
    var_name: hit
    var_value: ""

  - id: init-page
    action: set_var
    var_name: page
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["/calendarexpress", "", "/calendar", "/calendarexpress2"]

  - id: marker
    action: script
    code: "\"nx\" + rand_hex(8)"
    store_as: mark

  - id: fetch
    action: http_request
    method: GET
    path: "{{dir}}/search.php?allwords=%3Cbr%3E%3Cscript%3E{{mark}}%3C/script%3E&cid=0&title=1&desc=1"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 8
    condition: 'hit == ""'
    store_as: page

  - id: check
    action: script
    condition: 'hit == ""'
    code: |
      let b = if type_of(page.body) == "string" { page.body } else { "" };
      if page.status == 200
         && stridx(b, "<script>" + mark + "</script>") >= 0
         && ereg("Calendar Express [0-9][0-9.]* \\[Powered by Phplite\\.com\\]", b) {
        dir + "/search.php echoes the allwords script tag unescaped"
      } else { "" }
    store_as: hit

  - id: report
    action: match
    source: hit
    pattern: "echoes the allwords"
    on_match:
      finding:
        title: "Calendar Express search.php reflected cross-site scripting"
        description: "search.php of PHP Lite Calendar Express writes the allwords parameter into the results page without encoding it. A script tag sent in a link comes back as markup, so script runs in the browser of anyone who follows the link."
        remediation: "Encode the search terms (htmlspecialchars) before printing them, or replace this unmaintained calendar script."
        confidence_delta: 0.45
        qod: 75
        evidence: "{{hit}}"
      stop: true

View these feeds on GitHub