NetRisk — 1 vulnerability check

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

← All products · Feeds on GitHub

NetRisk admin/change_submit.php Unauthenticated Password Change

CVECVE-2008-7155
Severityhigh · CVSS 7.5
Categoryauth-bypass — Auth bypass
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/netrisk/CVE-2008-7155.yaml

Tests whether the NetRisk browser game lets anonymous users reach admin/change_submit.php, its administration password-change handler. NetRisk 1.9.7 and earlier run this handler without any login, so anyone can set a new password for any account, including the administrator's. In the web root and in the /netrisk and /NetRisk directories, the feed first checks that index.php is a NetRisk page. It then calls change_submit.php once, without credentials, for a random username that matches no account, and reports the installation when the handler answers with its "username->" output instead of a login redirect or an error. Because the username does not exist, no password is changed. When the handler gives no such output, the feed falls back to the version shown on the NetRisk page and reports version 1.9.7 or earlier.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{dir}}/index.php
  3. Parses / computes the next value with a Rhai script
  4. HTTP(S) request GET {{dir}}/admin/change_submit.php?username={{rnd.user}}&new_pass={{rnd.pass}}
  5. Parses / computes the next value with a Rhai script
  6. Checks verdict for ^proof: → finding QoD 75: NetRisk change_submit.php password-change handler reachable without authentication
  7. Checks verdict for ^version: → finding QoD 70: NetRisk 1.9.7 or earlier (change_submit.php password change without authentication)

References:

Feed source — tests/vulnerabilities/netrisk/CVE-2008-7155.yaml
# NetRisk admin/change_submit.php unauthenticated password change — CVE-2008-7155
#
# NetRisk (PHP Risk-style browser game, phprisk.org) 1.9.7 and earlier ship
# admin/change_submit.php, the admin panel's password-change handler, with no
# session or admin check: GET admin/change_submit.php?username=<login>
# &new_pass=<password> sets any account's password (exploit-db 4842,
# BID 27150). The vendor never shipped a fix.
#
# Detection, per install directory ("", /netrisk, /NetRisk):
#   1. GET <dir>/index.php; the directory is a NetRisk install when the page
#      answers 200 and names "NetRisk" (version from "NetRisk <x.y.z>").
#   2. Proof (QoD 75): GET <dir>/admin/change_submit.php with a random
#      username that cannot exist ("nx" + 12 hex) and a random password. The
#      handler runs anonymously and prints its "username->" trace (the string
#      the public exploit checks for); a protected or removed handler redirects,
#      answers 401/403/404 or prints no trace. With a username that matches no
#      account, the request changes no password.
#   3. Fallback (QoD 70): no trace, but the index page reports NetRisk 1.9.7
#      or earlier (the source check's own logic).
#
# Deviation from the source NASL (better than OpenVAS): the NASL only compares
# the version taken from the index page. This feed first proves that the
# handler runs without a session, and also covers installs whose version
# string is hidden or unknown when the handler answers.
# Reply format: the NetRisk source is no longer published (phprisk.org is
# gone); the "username->" marker is the success check of exploit-db 4842.
#
# Ported from OpenVAS/Greenbone NVT 2009/gb_netrisk_sec_bypass_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.800940, GPL-2.0-only) and its detection
# gb_netrisk_detect.nasl.
uid: 26a3922e-4ab2-44a4-a996-c1d138014d45
name: "NetRisk admin/change_submit.php Unauthenticated Password Change (CVE-2008-7155)"
description: |
  Tests whether the NetRisk browser game lets anonymous users reach
  admin/change_submit.php, its administration password-change handler.
  NetRisk 1.9.7 and earlier run this handler without any login, so anyone can
  set a new password for any account, including the administrator's. In the
  web root and in the /netrisk and /NetRisk directories, the feed first checks
  that index.php is a NetRisk page. It then calls change_submit.php once,
  without credentials, for a random username that matches no account, and
  reports the installation when the handler answers with its "username->"
  output instead of a login redirect or an error. Because the username does
  not exist, no password is changed. When the handler gives no such output,
  the feed falls back to the version shown on the NetRisk page and reports
  version 1.9.7 or earlier.
cves: [CVE-2008-7155]
cvss: 7.5
severity: high
category: auth-bypass
confidence_base: 0.30
tags: [netrisk, php, auth-bypass, missing-authentication, password-change, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2008-7155"
  - "https://www.exploit-db.com/exploits/4842"
  - "http://www.securityfocus.com/bid/27150"
  - "https://exchange.xforce.ibmcloud.com/vulnerabilities/39465"
  # OpenVAS/Greenbone NASL 2009/gb_netrisk_sec_bypass_vuln.nasl (GPL-2.0-only)

steps:
  # Per-run random account name (cannot match a real user) and password.
  - id: rnd
    action: script
    store_as: rnd
    code: '#{ user: "nx" + rand_hex(6), pass: rand_hex(8) }'

  # Pre-initialise every stored result each pass: a failed request leaves it unset.
  - id: init-index
    action: set_var
    var_name: idx
    var_value: {status: 0, body: ""}
    loop:
      over: ["", "/netrisk", "/NetRisk"]
      var: dir

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

  - id: get-index
    action: http_request
    method: GET
    path: "{{dir}}/index.php"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 10
    store_as: idx

  - id: fingerprint
    action: script
    store_as: nr
    code: |
      let b = if type_of(idx.body) == "string" { idx.body } else { "" };
      let out = #{ found: false, version: "", old: false };
      if idx.status == 200 && b.contains("NetRisk") {
        out.found = true;
        let m = eregmatch("NetRisk ([0-9]{1,4}(\\.[0-9]{1,4})+)\\b", b);
        if m.len() >= 2 {
          out.version = m[1];
          let p = split(m[1], ".");
          let a = int(p[0]);
          let c = if p.len() > 1 { int(p[1]) } else { 0 };
          let d = if p.len() > 2 { int(p[2]) } else { 0 };
          out.old = a < 1 || (a == 1 && c < 9) || (a == 1 && c == 9 && d <= 7);
        }
      }
      out

  - id: call-change-submit
    action: http_request
    condition: "nr.found == true"
    method: GET
    path: "{{dir}}/admin/change_submit.php?username={{rnd.user}}&new_pass={{rnd.pass}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: chg

  - id: judge
    action: script
    store_as: verdict
    code: |
      let b = if type_of(chg.body) == "string" { chg.body } else { "" };
      if nr.found && chg.status == 200 && b.contains("username->") {
        "proof: " + dir + "/admin/change_submit.php ran the password-change handler for an anonymous request (reply carries its \"username->\" output; random non-existent account " + rnd.user + ", no password changed)"
      } else if nr.found && nr.old {
        "version: " + dir + "/index.php reports NetRisk " + nr.version + " (1.9.7 or earlier); change_submit.php gave no handler output"
      } else {
        ""
      }

  - id: report-proof
    action: match
    source: verdict
    pattern: "^proof: "
    on_match:
      finding:
        title: "NetRisk change_submit.php password-change handler reachable without authentication"
        confidence_delta: 0.50
        qod: 75
        evidence: "{{verdict}}"
        remediation: "NetRisk has no fixed release. Deny web access to the admin/ directory (for example with HTTP authentication in front of it) or remove NetRisk."
      stop: true

  - id: report-version
    action: match
    source: verdict
    pattern: "^version: "
    on_match:
      finding:
        title: "NetRisk 1.9.7 or earlier (change_submit.php password change without authentication)"
        confidence_delta: 0.40
        qod: 70
        evidence: "{{verdict}}"
        remediation: "NetRisk has no fixed release. Deny web access to the admin/ directory (for example with HTTP authentication in front of it) or remove NetRisk."
      stop: true

View these feeds on GitHub