Write YAML vulnerability checks (feeds)

A feed is a YAML file describing a vulnerability or misconfiguration and the sequence of steps that prove it. Feeds live under tests/vulnerabilities/<product>/<id>.yaml.

Structure

uid: 7f3d1b9a-4c62-4e8d-9a07-2b5e6c1f84d0   # stable UUID v4 — never change
name: "Elasticsearch exposed without authentication"
cves: []                    # 0, 1, or many CVE IDs
category: exposure          # closed list: exposure | hardening | default-credentials |
                            # auth-bypass | rce | sqli | file-read | xss | ssrf
                            # (general/ feeds: the first three only)
severity: critical          # info | low | medium | high | critical
confidence_base: 0.50       # raised by confidence_delta on match
tags: [elasticsearch, unauthenticated, exposure]
services: [http, https]     # nmap service names — [] = run on all ports
# ports: [8291]             # optional: also run on these TCP ports, whatever service name
#                           # the scanner gave them (e.g. Winbox, reported as `unknown`)
author: noctis
version: "1.0.0"

steps:
  - id: probe
    action: http_request
    method: GET
    path: "/"
    port: "{{port}}"
    store_as: es

  - id: check
    action: match
    source: es.body
    pattern: "You Know, for Search"
    condition: "es.status == 200"
    on_match:
      finding:
        title: "Elasticsearch exposed without authentication"
        confidence_delta: 0.35
        qod: 75
        evidence: "Unauthenticated banner: {{es.body}}"

cves cardinality — a feed is a vulnerability test, not a “CVE test”:

cves: []                               # misconfiguration / exposure check
cves: [CVE-2021-44228]                 # the common case
cves: [CVE-2023-46805, CVE-2024-21887] # a chain tracked by several CVE IDs

Categories

Every feed sets a category from this closed list (enforced by scripts/check_feeds.py and the JSON schema), and a non-empty description:, which becomes the text of the feed’s page in the feed catalog. The description, the feed name and each finding’s title / description / remediation are published as-is: describe the test itself (what it sends, what confirms the finding), never where it was ported from. scripts/check_feeds.py rejects NASL, OpenVAS, Greenbone, OID 1.3.6.1.4.1.25623… and “ported from” in them; provenance belongs in the feed’s # header comment and references:. Scans can skip a whole group with filters.exclude_categories.

category Use for
exposure A service or data reachable without authentication, or a feature open to abuse
hardening Weak protocol / security posture that grants no access on its own (TLS, headers, legacy protocols)
default-credentials The feed logs in to an account with default or hardcoded credentials — intrusive, can lock accounts
auth-bypass Authentication or authorization bypass
rce Code / command execution, incl. command injection, upload-to-RCE, arbitrary file write
sqli SQL injection
file-read Path traversal, LFI, file download / disclosure
xss Cross-site scripting
ssrf Server-side request forgery

Feeds in general/ use only exposure, hardening or default-credentials.

Step actions

Action Purpose
http_request HTTP/HTTPS request; result: resp.status, resp.body, resp.headers
tcp_connect Raw TCP connect + banner grab; result: resp.banner
tcp_dialogue Multi-line TCP exchange (text) or a binary send_hex frame; result: resp.transcript, resp.response_hex
tcp_open / tcp_send / tcp_close Persistent TCP/TLS socket kept across steps (handle:) — for challenge–response protocols where a frame is computed from an earlier reply; reserved_source_port: true connects from a port in 512–1023 (rsh/rlogin; needs root or CAP_NET_BIND_SERVICE, else an ephemeral port, see resp.local_port); tcp_send result: resp.responded, resp.response_hex
tcp_starttls Upgrades an open tcp_open cleartext socket to TLS in place (STARTTLS / mid-stream TLS); later tcp_send steps on the handle go over TLS; result: resp.upgraded, resp.protocol_version, resp.cipher_suite, resp.cert_subject, resp.error
tcp_syn TCP SYN probe (port state)
udp_probe UDP datagram probe; result: resp.response, resp.response_hex
tls_check TLS version, cipher, certificate inspection
ssh_check SSH banner + auth methods
ssh_exec Authenticated SSH command
snmp_get SNMP v2c GET
match Regex match on a stored value (supports negate, case_insensitive, condition; a negate: true match must carry a condition: proving its source was stored, else a failed request reads as “pattern absent”)
script Arbitrary Rhai expression
wait_oob Wait for an out-of-band callback
set_var Assign a context variable
sleep Pause between steps (duration_ms)

Expression helpers available in match/script include string/regex/byte functions, crypto (md5, sha256, hmac_sha256, hmac_sha1_hex, md5_hex, sha1_hex, rc4_hex, rsa_public_le_hex over hex-encoded raw bytes, base64_*), binary pack/unpack, and rand_*.

In condition: and script code, read a stored result with dot notation — resp.status == 200, resp.headers["content-type"]. There is no flattened resp_status / resp_body: such a name is undefined — a condition: evaluates to false and the step silently never runs, a script aborts the test. scripts/check_feeds.py rejects it in condition:, code: and source:.

A condition: is never {{…}}-interpolated: every variable is already in scope, so write body.contains(token), not body.contains("{{token}}") (a spliced-in value could rewrite the expression). scripts/check_feeds.py rejects a template in a condition:.

Automatic variables

Variable Value
{{target_host}} Target IP / hostname
{{port}} Port of the matched service (injected — do not redefine)
{{scheme}} http or https, derived from the matched service
{{oob_token}} UUID unique to this run
{{oob_url}} Full OOB callback URL
{{oob_host}} / {{oob_port}} OOB server host / port
{{oob_enabled}} true when --oob is configured
{{cred_enabled}} true when the scan request carries credentials, false otherwise
{{cred_username}} / {{cred_password}} / {{cred_token}} The request’s credentials fields — each set only when supplied
service_ports Map of every service in the scan request to its port, e.g. #{telnet: 23, snmp: 161} (first port per name; always set, empty without services). Read it in a script: if "snmp" in service_ports { service_ports["snmp"] } else { 161 } — for a feed that runs on one service but must reach another one of the same host

Authenticated feeds

A feed that must log in to the target reads the scan’s credentials from {{cred_username}} / {{cred_password}} / {{cred_token}}. Declare requires_credentials: true so the feed is skipped cleanly (no task, no finding, a debug log) when the request carries no credentials:

requires_credentials: true
steps:
  - id: login
    action: http_request
    method: POST
    path: "/admin/login"
    port: "{{port}}"
    body: "username={{cred_username}}&password={{cred_password}}"
    store_as: login

In a feed that also has unauthenticated steps, leave requires_credentials off and guard the authenticated ones with condition: "cred_enabled" instead (cred_enabled is always defined; the cred_* value vars exist only when supplied — referencing {{cred_password}} in a request that only sent a token aborts the test with an undefined-variable error, so guard such steps). Password and token values are replaced by <redacted> in every finding field and log line — as given, lowercase hex, percent-encoded, and as the Basic-auth base64 of username:password. Any other encoding (hashes, JSON escaping, a custom base64_encode of something else) is not recognised, so never put credentials or values derived from them in evidence. Only the values a {{…}} template substitutes are redacted, never the words the feed itself wrote (a password admin leaves /admin/admin.php in a title alone), and a password or token shorter than 8 bytes is masked only as a whole token — not inside a longer word such as administrator.

Confidence / QoD

QoD Meaning
50 Banner or version match
70 Specific header / response pattern
75 Functional proof (LFI /etc/passwd, unauthenticated data)
97 OOB callback received, or confirmed RCE
100 Full exploit with verified output

tcp_connect vs http_request

Use tcp_connect for any payload encoded in the path — reqwest normalises URLs before sending (%2e → ., then resolves ../), which breaks path-traversal exploits.

- action: tcp_connect
  send: "GET /cgi-bin/.%2e/.%2e/etc/passwd HTTP/1.0\r\nHost: {{target_host}}\r\n\r\n"
  store_as: resp
- action: match
  source: resp.banner        # .banner, not .data
  pattern: "root:.*:0:0"

Parsing a binary reply

For a binary protocol, send one raw frame with tcp_dialogue + send_hex and parse the reply’s response_hex in a script step: byte offset N is hex offset 2N, substr takes an inclusive end, and u16le/u32be/… decode a fixed-width integer. The script can return a map, which later match / condition: steps read with dot notation. The magic bytes stay in the feed — no engine change per protocol. From general/smb-signing-not-required.yaml (SMB2 NEGOTIATE → SecurityMode at byte 70, DialectRevision at byte 72; abridged — the shipped feed also names the dialect and flags legacy-only 2.x servers):

- id: smb2-negotiate
  action: tcp_dialogue
  port: "{{port}}"
  read_banner: false
  send_hex: "0000009efe534d42…"          # NBSS + SMB2 header + NEGOTIATE (5 dialects)
  store_as: smb

- id: parse-negotiate
  action: script
  condition: "smb.connected == true"
  store_as: neg
  code: |
    let hex = if type_of(smb.response_hex) == "string" { smb.response_hex } else { "" };
    let mode = u16le(substr(hex, 140, 143));   // byte 70
    let rev  = u16le(substr(hex, 144, 147));   // byte 72
    // Prove it is a NEGOTIATE *response*, not an echo of the request:
    let ok = strlen(hex) >= 148
      && substr(hex, 8, 15) == "fe534d42"           // SMB2 signature
      && u32le(substr(hex, 24, 31)) == 0            // Status OK
      && (u32le(substr(hex, 40, 47)) & 1) == 1      // Flags: SERVER_TO_REDIR
      && u16le(substr(hex, 136, 139)) == 65         // response StructureSize
      && (rev == 0x0202 || rev == 0x0210 || rev == 0x0300 || rev == 0x0302 || rev == 0x0311);
    #{ smb2: ok, signing_required: (mode & 2) == 2, dialect_hex: p16be(rev) }

- id: check-signing
  action: match
  source: neg.signing_required
  pattern: "^false$"
  condition: "neg.smb2 == true"
  on_match:
    finding:
      title: "SMB signing not required"
      qod: 75
      evidence: "dialect 0x{{neg.dialect_hex}}, signing not required"

When a later frame depends on a value from an earlier reply (challenge–response), use tcp_open / tcp_send / tcp_close instead and build the next send_hex in the script.

STARTTLS — when a protocol switches to TLS mid-stream (SMTP/IMAP/POP3/FTP STARTTLS / AUTH TLS, LDAP StartTLS, PostgreSQL SSLRequest, a vendor init frame…), do the cleartext part on a tcp_open socket, then tcp_starttls on the same handle:, then keep using tcp_send — it now writes and reads TLS records:

- id: open
  action: tcp_open
  port: "{{port}}"
  read_banner: true          # 220 greeting
  timeout_secs: 5
- id: ehlo
  action: tcp_send
  send: "EHLO noctis\r\n"
  store_as: ehlo
- id: ask
  action: tcp_send
  condition: "ehlo.responded && ehlo.response.contains(\"STARTTLS\")"
  send: "STARTTLS\r\n"
  store_as: ask
- id: upgrade
  action: tcp_starttls
  condition: "ask.responded && ask.response.starts_with(\"220\")"
  store_as: tls              # tls.upgraded, tls.protocol_version, tls.cert_subject…
- id: over_tls
  action: tcp_send
  condition: "tls.upgraded"
  send: "EHLO noctis\r\n"
  store_as: secure

The handshake accepts any certificate (as tls: true does) and is bounded by the step’s timeout_secs. It runs on_failure (with resp.error set) when the handle is unknown, already TLS (the socket is then kept as it was) or the handshake fails — a failed handshake drops the handle. Gate later steps on tls.upgraded.

Reply timing (tcp_dialogue, tcp_send, tcp_open with read_banner: true): each read waits up to the step’s timeout_secs (default 10) for the first reply byte, then stops after a 500 ms idle gap, EOF or 64 KiB. A slow server is therefore read without a “wait then re-read” step, but a read that gets no reply costs the full timeout_secs (a peer that closes ends it at once; tcp_open uses timeout_secs for the connect and again for the greeting). Keep it short on drain reads and on greeting reads of feeds that run on unknown ports. A timing proof that needs a read to come back before a delayed reply (sleep injection) sets a short timeout_secs (e.g. 1) on that read — see tests/vulnerabilities/spamass-milter/CVE-2010-1132.yaml.

Validate a feed

npx ajv-cli validate -s schemas/feed.schema.json \
  -d "tests/vulnerabilities/*/*.yaml" --spec=draft7 --allow-union-types

The full authoring reference — mock template, inventory structure, pitfalls, and reference feeds to copy from — lives in CLAUDE.md. See also Contributing.

Edit this page on GitHub