Newscoop — 1 vulnerability check

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

← All products · Feeds on GitHub

Newscoop password_check_token.php reflected cross-site scripting

CVECVE-2012-1935
Severitymedium · CVSS 4.3
Categoryxss — XSS
Serviceshttp, https
Detectionset_var, script, http_request, match · highest QoD 75
Feedtests/vulnerabilities/newscoop/CVE-2012-1935.yaml

Newscoop, the Sourcefabric newsroom CMS, prints the token and f_email parameters of its password recovery page, admin/password_check_token.php, into hidden form fields without encoding them (versions up to 3.5.4), so a crafted link closes the attribute and runs script in the visitor's browser. The page needs no login.

The check requests the page on the usual install paths (/newscoop and the web root) with a token that closes the attribute and opens a script tag holding a random marker. It reports the flaw when the reply is a 200 password recovery page that contains that script tag unescaped. Releases from 3.5.5 on encode the value and are not reported.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{dir}}/admin/password_check_token.php?f_email=1&token=%22%3E%3Cscript%3E{{mark}}%3C/…
  3. Parses / computes the next value with a Rhai script
  4. Checks hit for echoes the token → finding QoD 75: Newscoop password_check_token.php reflected cross-site scripting

References:

Feed source — tests/vulnerabilities/newscoop/CVE-2012-1935.yaml
# Newscoop admin/password_check_token.php — reflected cross-site scripting
# (CVE-2012-1935).
#
# CVE mapping: the backlog issue (#1641) carries CVE-2012-1934, but that record
# is an SQL injection in admin/country/edit.php (f_country_code), a page behind
# the admin login. The unauthenticated flaw this feed proves is the reflected
# XSS of admin/password_check_token.php, recorded as CVE-2012-1935 (together
# with the Back parameter of admin/ad.php, which needs a login). Newscoop 3.5.4
# and older print the f_email and token parameters into hidden form fields with
# a bare echo; 3.5.5 wraps both in htmlentities(ENT_QUOTES) — verified against
# the sourcefabric/Newscoop tags v3.5.4 and v3.5.5. The SQL injection cannot be
# reached without credentials, so it has no feed here.
#
# CVSS: NVD has only a v2 score for CVE-2012-1935 (4.3); no v3.x.
#
# Ported from OpenVAS/Greenbone NVT 2012/gb_sourcefabric_newscoop_52941.nasl
# (OID 1.3.6.1.4.1.25623.1.0.103461, GPL-2.0-only): GET
# <dir>/admin/password_check_token.php?f_email=1&token="><script>alert(/xss-test/);</script>
# on /newscoop and the CGI dirs, reported when the reply is a 200 carrying the
# script tag and "Bad input parameters".
#
# Better than the NVT:
#   - the script body is a random marker instead of the fixed /xss-test/, and
#     the tag must come back exactly as sent, quote-closing included, so an
#     encoded reflection (fixed 3.5.5) or a page that merely prints the query
#     string is not reported;
#   - the reply must be the Newscoop password recovery page (login_form +
#     "Password Recovery"), not just any 200 that contains the tag;
#   - also tries the web root, which the NVT skips unless it is a CGI dir.
uid: 76ff9311-2c01-470d-b3f2-6d45a4019f75
name: "Newscoop password_check_token.php reflected cross-site scripting"
description: |
  Newscoop, the Sourcefabric newsroom CMS, prints the token and f_email
  parameters of its password recovery page, admin/password_check_token.php,
  into hidden form fields without encoding them (versions up to 3.5.4), so a
  crafted link closes the attribute and runs script in the visitor's browser.
  The page needs no login.

  The check requests the page on the usual install paths (/newscoop and the
  web root) with a token that closes the attribute and opens a script tag
  holding a random marker. It reports the flaw when the reply is a 200
  password recovery page that contains that script tag unescaped. Releases
  from 3.5.5 on encode the value and are not reported.
category: xss
cves: [CVE-2012-1935]
cvss: 4.3
severity: medium
confidence_base: 0.30
tags: [newscoop, sourcefabric, campsite, php, xss, reflected, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2012-1935"
  - "https://nvd.nist.gov/vuln/detail/CVE-2012-1934"
  - "http://www.securityfocus.com/bid/52941"
  - "https://www.htbridge.com/advisory/HTB23084"
  # OpenVAS/Greenbone NASL 2012/gb_sourcefabric_newscoop_52941.nasl (GPL-2.0-only)

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: ["/newscoop", ""]

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

  - id: fetch
    action: http_request
    method: GET
    path: "{{dir}}/admin/password_check_token.php?f_email=1&token=%22%3E%3Cscript%3E{{mark}}%3C/script%3E"
    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
         && stridx(b, "login_form") >= 0
         && stridx(b, "Password Recovery") >= 0 {
        dir + "/admin/password_check_token.php echoes the token script tag unescaped"
      } else { "" }
    store_as: hit

  - id: report
    action: match
    source: hit
    pattern: "echoes the token"
    on_match:
      finding:
        title: "Newscoop password_check_token.php reflected cross-site scripting"
        description: "admin/password_check_token.php of Newscoop 3.5.4 and older writes the token and f_email parameters into hidden form fields without encoding them. A link that closes the attribute and opens a script tag runs script in the browser of anyone who follows it, with no login needed."
        remediation: "Upgrade to Newscoop 3.5.5 or 4 RC4 or later, which encode both parameters."
        confidence_delta: 0.45
        qod: 75
        evidence: "{{hit}}"
      stop: true

View these feeds on GitHub