LiveZilla — 1 vulnerability check

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

← All products · Feeds on GitHub

LiveZilla livezilla Cookie PHP Object Injection

CVECVE-2013-7034
Severityhigh · CVSS 7.5
Categoryrce — Remote code execution
Serviceshttp, https
Detectionset_var, http_request, match, script · highest QoD 75
Feedtests/vulnerabilities/livezilla/CVE-2013-7034.yaml

Tests LiveZilla up to 5.1.2.0 for the PHP object injection in its "livezilla" cookie, which the application base64-decodes and passes to unserialize() without authentication. The feed requests chat.php, under the web root and the usual /livezilla, /LiveZilla, /support, /chat, /livechat and /lz install paths, with the cookie set to a serialized object of a class the application does not define, then repeats the request with a valid, empty cookie array as a control. When the first reply carries the PHP error "Cannot use object of type __PHP_Incomplete_Class as array" raised in LiveZilla's _lib/functions.global.inc.php and the control does not, the server built the object from the cookie. On servers that hide PHP errors, the feed reports the flaw with a lower confidence when the object cookie makes chat.php answer 500 twice while the control returns the LiveZilla chat page. The request stops while reading the cookie, before the chat page is built, and nothing is written on the target. Installs whose cookie lifetime is set to 0 never read the cookie and are not reported.

How noctis detects it

  1. HTTP(S) request GET {{dir}}/chat.php
  2. HTTP(S) request GET {{dir}}/chat.php
  3. Checks probe_r.body for Cannot use object of type __PHP_Incomplete_Class as array in (?:<b>)?…
  4. Checks ctrl_r.body for __PHP_Incomplete_Class
  5. Checks ctrl_r.body for (?i)content="LiveZilla GmbH
  6. Parses / computes the next value with a Rhai script
  7. Parses / computes the next value with a Rhai script
  8. HTTP(S) request GET {{dir}}/chat.php
  9. Checks verdict for ^error$ → finding QoD 75: LiveZilla livezilla Cookie PHP Object Injection (CVE-2013-7034)
  10. Checks verdict for ^status$ → finding QoD 70: LiveZilla livezilla Cookie PHP Object Injection (CVE-2013-7034)

References:

Feed source — tests/vulnerabilities/livezilla/CVE-2013-7034.yaml
# LiveZilla livezilla cookie unserialize() PHP object injection — CVE-2013-7034
#
# LiveZilla up to 5.1.2.0 keeps its visitor cookie values in one cookie,
# "livezilla", holding base64(serialize(array)). getCookieValue() and
# setCookieValue() in _lib/functions.global.inc.php decode it with
#     $c_array = @unserialize(base64_decode($_COOKIE["livezilla"]));
#     if(isset($c_array[$_key])) ...
# so any serialized object in the cookie is instantiated (PHP object
# injection). 5.1.2.1 fixed it; later releases keep one plain cookie per key.
# An object of a class the application does not define comes back as
# __PHP_Incomplete_Class, and the array access right after the unserialize()
# then stops PHP with "Cannot use object of type __PHP_Incomplete_Class as
# array" in _lib/functions.global.inc.php. chat.php reads the cookie on every
# request (define("SESSION", getSessionId()) -> getCookieValue("userid")),
# before the chat page is built.
#
# Detection, per install dir (/, /livezilla, /LiveZilla, /support, /chat,
# /livechat, /lz):
#   1. GET <dir>/chat.php with livezilla=base64('O:11:"NoctisProbe":0:{}').
#   2. Control: same request with livezilla=base64('a:0:{}') (a valid,
#      empty cookie array).
#   3. QoD 75: the probe reply carries the PHP error above for
#      _lib/functions.global.inc.php and the control reply does not.
#   4. QoD 70, for servers with display_errors off: the probe answers 500
#      twice while the control answers 200 with the LiveZilla chat page
#      (meta "LiveZilla GmbH"). Only the object in the cookie differs.
# Nothing is written on the target: the request stops at the cookie read,
# before the chat page is built. With the cookie lifetime option (gl_colt) set
# to 0 the cookie is never read and no finding is possible.
#
# Improvements over the source NASL:
#   - GET chat.php instead of POST server.php p_request=extern&p_action=mail:
#     the mail action is the offline-message (ticket) form, which can file an
#     empty ticket on a non-vulnerable server.
#   - Control request with a valid cookie array: only the object makes the
#     page fail.
#   - Windows paths (_lib\functions.global.inc.php) are accepted, and PHP 7+
#     "Uncaught Error" messages too.
#   - A second branch (500 vs 200 control) finds servers that hide PHP errors.
#   - The feed walks the usual install paths itself.
#
# Ported from OpenVAS/Greenbone NVT 2014/gb_livezilla_php_obj_inj_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.802075, GPL-2.0-only). Cookie functions checked
# in LiveZilla 5.0.1.0 sources; the fix release named in the Bugtraq advisory.
uid: 347b4472-6af0-4e7e-8f55-143a172272ac
name: "LiveZilla livezilla Cookie PHP Object Injection (CVE-2013-7034)"
description: |
  Tests LiveZilla up to 5.1.2.0 for the PHP object injection in its
  "livezilla" cookie, which the application base64-decodes and passes to
  unserialize() without authentication. The feed requests chat.php, under
  the web root and the usual /livezilla, /LiveZilla, /support, /chat,
  /livechat and /lz install paths, with the cookie set to a serialized
  object of a class the application does not define, then repeats the
  request with a valid, empty cookie array as a control. When the first
  reply carries the PHP error "Cannot use object of type
  __PHP_Incomplete_Class as array" raised in LiveZilla's
  _lib/functions.global.inc.php and the control does not, the server built
  the object from the cookie. On servers that hide PHP errors, the feed
  reports the flaw with a lower confidence when the object cookie makes
  chat.php answer 500 twice while the control returns the LiveZilla chat
  page. The request stops while reading the cookie, before the chat page
  is built, and nothing is written on the target. Installs whose cookie
  lifetime is set to 0 never read the cookie and are not reported.
cves: [CVE-2013-7034]
cvss: 7.5
severity: high
category: rce
confidence_base: 0.25
tags: [livezilla, php, php-object-injection, unserialize, deserialization, cookie, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2013-7034"
  - "https://seclists.org/bugtraq/2013/Dec/77"

steps:
  - id: init-lz-found
    action: set_var
    var_name: lz_found
    var_value: false

  # ── Loop group: every following step runs once per install dir until a
  # finding stops it. Each pass resets what it reads.
  - id: init-probe-r
    action: set_var
    var_name: probe_r
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["", "/livezilla", "/LiveZilla", "/support", "/chat", "/livechat", "/lz"]

  - id: init-ctrl-r
    action: set_var
    var_name: ctrl_r
    var_value: {status: 0, body: ""}

  - id: init-probe2-r
    action: set_var
    var_name: probe2_r
    var_value: {status: 0, body: ""}

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

  - id: init-err-path
    action: set_var
    var_name: err_path
    var_value: ""

  # livezilla = base64('O:11:"NoctisProbe":0:{}')
  - id: probe
    action: http_request
    method: GET
    path: "{{dir}}/chat.php"
    port: "{{port}}"
    headers:
      Cookie: "livezilla=TzoxMToiTm9jdGlzUHJvYmUiOjA6e30="
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "lz_found == false"
    store_as: probe_r

  # livezilla = base64('a:0:{}'): a valid, empty cookie array.
  - id: control
    action: http_request
    method: GET
    path: "{{dir}}/chat.php"
    port: "{{port}}"
    headers:
      Cookie: "livezilla=YTowOnt9"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "lz_found == false && probe_r.status != 0"
    store_as: ctrl_r

  # No on_match on the body matches: only short captures reach the finding.
  - id: probe-error
    action: match
    source: probe_r.body
    pattern: "Cannot use object of type __PHP_Incomplete_Class as array in (?:<b>)?([^<\\r\\n]{0,300}?_lib[\\\\/]functions\\.global\\.inc\\.php)"
    store_as: err_m

  - id: control-error
    action: match
    source: ctrl_r.body
    pattern: "__PHP_Incomplete_Class"
    store_as: ctrl_err_m

  - id: control-page
    action: match
    source: ctrl_r.body
    pattern: "(?i)content=\"LiveZilla GmbH"
    store_as: page_m

  - id: verdict
    action: script
    code: |
      if ctrl_r.status == 0 || ctrl_err_m.matched {
        ""
      } else if err_m.matched && err_m.captures.len() > 0 {
        "error"
      } else if probe_r.status == 500 && ctrl_r.status == 200 && page_m.matched {
        "status"
      } else {
        ""
      }
    condition: "lz_found == false"
    store_as: verdict

  - id: error-path
    action: script
    code: "err_m.captures[0]"
    condition: 'verdict == "error"'
    store_as: err_path

  # display_errors off: repeat the object request, it must fail again.
  - id: probe-again
    action: http_request
    method: GET
    path: "{{dir}}/chat.php"
    port: "{{port}}"
    headers:
      Cookie: "livezilla=TzoxMToiTm9jdGlzUHJvYmUiOjA6e30="
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'verdict == "status"'
    store_as: probe2_r

  - id: report-error
    action: match
    source: verdict
    pattern: "^error$"
    on_match:
      set_vars:
        lz_found: true
      finding:
        title: "LiveZilla livezilla Cookie PHP Object Injection (CVE-2013-7034)"
        description: "chat.php passed the livezilla cookie to unserialize(): a cookie holding a serialized object made PHP stop with \"Cannot use object of type __PHP_Incomplete_Class as array\" in LiveZilla's _lib/functions.global.inc.php, while a valid cookie array did not. An unauthenticated attacker can make the application instantiate objects of any class it loads."
        remediation: "Upgrade LiveZilla to 5.1.2.1 or later."
        confidence_delta: 0.60
        qod: 75
        evidence: "GET {{dir}}/chat.php with livezilla=base64('O:11:\"NoctisProbe\":0:{}') raised the PHP error \"Cannot use object of type __PHP_Incomplete_Class as array\"; the livezilla=base64('a:0:{}') control did not. Error raised in: {{err_path}}"
      stop: true

  - id: report-status
    action: match
    source: verdict
    pattern: "^status$"
    condition: "probe2_r.status == 500"
    on_match:
      set_vars:
        lz_found: true
      finding:
        title: "LiveZilla livezilla Cookie PHP Object Injection (CVE-2013-7034)"
        description: "chat.php failed with HTTP 500 twice when the livezilla cookie held a serialized object, while the same request with a valid cookie array returned the LiveZilla chat page: the cookie is passed to unserialize() and the object it builds breaks the page. An unauthenticated attacker can make the application instantiate objects of any class it loads."
        remediation: "Upgrade LiveZilla to 5.1.2.1 or later."
        confidence_delta: 0.45
        qod: 70
        evidence: "GET {{dir}}/chat.php: livezilla=base64('O:11:\"NoctisProbe\":0:{}') answered HTTP 500 twice, the livezilla=base64('a:0:{}') control answered HTTP 200 with the LiveZilla chat page"
      stop: true

View these feeds on GitHub