YAML vulnerability scanning with noctis

In noctis a vulnerability check is a YAML file called a feed. The engine is generic: it knows how to send an HTTP request, open a socket, match a pattern. Everything specific to a vulnerability lives in the feed. This page shows what a feed contains and how to write one; the feed reference has every field.

Anatomy of a feed

uid: 35493c59-e757-4936-a7b0-00f1f650fd19   # your own UUID v4, stable
name: "Elasticsearch exposed without authentication"
cves: []                    # 0, 1 or several CVE IDs
category: exposure          # closed list, used by scan filters
severity: critical
confidence_base: 0.50
services: [http, https]     # which discovered services this feed runs on

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}}"

Three parts:

  1. Metadata. What the check detects: CVE IDs, severity, a category such as rce, file-read or exposure.
  2. Targeting. services: names the nmap services the feed applies to. A scan request lists the services found on the host, and the feed runs once per matching port. The matched port arrives as {{port}}.
  3. Steps. Run in order. A probe step stores its result under store_as; later steps read it with dot notation (es.status, es.body).

Step actions

Kind Actions
HTTP http_request
TCP tcp_connect (verbatim bytes), tcp_dialogue (line protocols or one binary frame), tcp_open / tcp_send / tcp_close (a socket kept across steps), tcp_starttls, tcp_syn
Other protocols udp_probe, tls_check, ssh_check, ssh_exec, snmp_get
Logic match (regex on a stored value), script (Rhai expression), set_var, sleep
Blind detection wait_oob (waits for the target to call the scanner back)

Scripts have helpers for the work binary protocols need: regex and string functions, hashes and HMAC, base64, and pack/unpack of integers. A feed can compute a challenge response from an earlier reply and send it on the same socket.

Evidence on every finding

A finding is declared on the step that proves it, under on_match. It sets:

  • qod, the Quality of Detection: 50 for a banner, 75 for a functional proof, 97 for an out-of-band callback or confirmed code execution;
  • confidence_delta, added to the feed’s confidence_base;
  • evidence, a text template filled from the stored results.

Because the score sits on the step, one feed can report the same vulnerability at several levels: a version marker at QoD 70, then the real proof at QoD 97 when it succeeds.

Bytes sent as written

HTTP client libraries normalise URLs: %2e becomes ., and ../ is resolved before the request leaves. That silently removes a path-traversal payload. tcp_connect sends the request exactly as the feed spells it:

- action: tcp_connect
  port: "{{port}}"
  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
  pattern: "root:.*:0:0"

When the matched service is https, the same step is wrapped in TLS automatically.

Write and run a custom check

  1. Create a YAML file with a fresh UUID v4 as uid.
  2. Validate it against the JSON Schema shipped in the repository:
    npx ajv-cli validate -s schemas/feed.schema.json -d my-check.yaml \
      --spec=draft7 --allow-union-types
    
  3. Mount it next to the bundled feeds and name it in the scan request’s tests:
    docker run --rm -p 8080:8080 \
      -v "$PWD/custom:/feeds/custom:ro" ghcr.io/fdarkshadow/noctis:latest
    
    { "host": "10.0.0.1",
      "services": [{"port": 9200, "service": "http", "protocol": "tcp"}],
      "tests": ["custom/my-check.yaml"] }
    

The schema also gives autocompletion in editors that support YAML schemas. To contribute a feed upstream, it needs a vulnerable and a patched mock so CI can assert a true positive and a true negative; see Contributing.

Read real feeds

The feed catalog prints the YAML source of every check with a step-by-step summary. Good starting points: Log4Shell for out-of-band detection and Apache httpd for raw-TCP traversals. For how this compares to Nuclei templates, see noctis as a Nuclei alternative.

Edit this page on GitHub