Skip to content

Tamp Nuclei

BrewingCoder edited this page Nov 20, 2026 · 1 revision

Tamp.Nuclei

Wrapper for Nuclei (ProjectDiscovery) — template-driven vulnerability scanning and, with one flag, API fuzzing against a deployed target. SARIF export is native (-se), so there is no converter step.

using Tamp.Nuclei;

Full reference: https://github.com/tamp-build/tamp-nuclei.

Nuclei is a single static Go binary — Windows, Linux, macOS, ARM — with no JRE and no Docker requirement, which makes it the cheapest DAST-adjacent scanner in the pipeline to put on a runner. SetNucleiCommand(path) if it isn't on PATH. Both the engine and the nuclei-templates corpus are MIT.

Nuclei is two tools depending on how you invoke it

Understand this before adopting it, because the two answer different questions and only one of them is DAST.

Plain, it's a prober. The community template corpus matches known CVEs, exposed admin panels, default credentials and misconfigurations against whatever you point it at. Fast, broad, low false-positive rate — and structurally blind to novel injection in your own code, because no template describes your application.

With -dast, it's a fuzzer. Fuzzing templates actively probe discovered parameters for injection classes. Point -input-mode at an OpenAPI definition and every documented operation becomes a target.

A scan that only does the first should not be described to an auditor as dynamic application security testing. It is a known-issue probe, which is worth having and is not the same claim.

DAST mode writes. Fuzzing templates submit crafted payloads to every parameter they find, creating, modifying and deleting data through whatever endpoints answer. Disposable environments only — never a shared staging environment, and never anything holding real data.

Two verbs

Nuclei.Scan(s => …)              // scan a target
Nuclei.UpdateTemplates(s => …)   // refresh the template corpus

Exit codes differ from the other Tamp scanners

Nuclei exits 0 on a completed scan whether or not it found anything. Findings live in the export file, not the exit code; non-zero means the scan itself failed.

So rc != 0 is a scan failure, not a gate, and the gate has to read the SARIF. If you wire Nuclei up like TruffleHog's --fail, you get a target that can never go red.

Settings worth knowing

Area Setting
Targets AddTarget, SetTargetListFile, AddExcludeHost, SetInputMode
Output SetSarifExportFile, SetJsonExportFile, SetJsonLinesExportFile, SetMarkdownExportDirectory, SetOutputFile, SetSilent, SetNoColor
Template selection AddSeverity, AddExcludeSeverity, AddTag, AddExcludeTag, AddTemplate, AddTemplateUrl, AddTemplateId, AddExcludeTemplateId, AddWorkflow, AddAuthor
Protocols SetEnableDast, SetEnableHeadless, SetEnableCode
Throughput SetRateLimit (default 150/s), SetConcurrency (25), SetBulkSize (25), SetTimeoutSeconds, SetRetries
Auth AddHeader, AddSecretHeader, AddSecretFile

NucleiInputMode is List (default), Burp, Jsonl, Yaml, OpenApi, Swagger, Unknown. NucleiSeverity is Info, Low, Medium, High, Critical, Unknown.

Credentials: AddSecretFile first, AddSecretHeader second, AddHeader never

All three end up authenticating the scan, and they are not equally safe:

  • AddSecretFile(path) (-sf) is the preferred form. Nothing sensitive reaches the command line at all.
  • AddSecretHeader(name, secret) types the value so it joins the runner's redaction table — but it still builds a -H argument, so the value is in the OS process table for the lifetime of the scan. It is the fallback, not the goal. (It is an instance method rather than a fluent extension because TAMP004 only permits Secret.Reveal() inside a wrapper settings class.)
  • AddHeader("Name: value") takes the string verbatim with no typing and no redaction. A bearer token passed here will be in the process table and the logs.

See Parameter & Secret Injection and TAMP001–TAMP006.

AddExcludeSeverity(NucleiSeverity.Info) is the setting you want in CI. Informational templates are fingerprints, disclosures and tech detection — high volume, and they will swamp an evidence file.

SetEnableCode executes code locally. Only enable it for templates you actually trust.

Quick example — probe every deploy, fuzz on demand

// Prober — fast, safe, every deploy.
Target SecurityScanNuclei => _ => _
    .DependsOn(Deploy)
    .Executes(() =>
    {
        var plan = Nuclei.Scan(s => s
            .AddTarget(DeployedUrl)
            .SetSarifExportFile(SecurityArtifactsDir / "nuclei.sarif")
            .AddExcludeSeverity(NucleiSeverity.Info)
            .SetNoInteractsh()
            .SetDisableUpdateCheck()
            .SetSilent()
            .SetNoColor());

        var rc = ProcessRunner.Execute(plan, Console.Out, Console.Error);
        if (rc != 0) throw new Exception($"nuclei failed to run ({rc})");
        // rc == 0 says the scan completed, NOT that it was clean -- gate on the SARIF.
    });
// Fuzzer — destructive. Disposable environments only.
var fuzz = Nuclei.Scan(s => s
    .SetTargetListFile(SecurityArtifactsDir / "openapi.json")
    .SetInputMode(NucleiInputMode.OpenApi)
    .SetEnableDast()
    .SetSarifExportFile(SecurityArtifactsDir / "nuclei-dast.sarif")
    .AddSecretFile(SecurityArtifactsDir / "nuclei-auth.yaml"));

SetNoInteractsh() and SetDisableUpdateCheck() are both worth making habitual in CI: the first stops out-of-band interaction callbacks to ProjectDiscovery's hosted service, the second stops a scan quietly becoming a network-dependent step that fails when the update endpoint does.

Template corpus freshness

Nuclei.UpdateTemplates is a separate verb on purpose. Updating the corpus inside the scanning target makes the scan's results depend on when it ran, so two builds of the same commit can disagree. Pin the update to its own step, and in a release lane consider not updating at all so the evidence is reproducible.

Severity and tamp#166

Nuclei maps its own severities onto SARIF levels and emits them per result, so its findings arrive with explicit severity. Before Tamp 1.21.0 (tamp#166), a result whose scanner omitted level — legal under SARIF 2.1.0 §3.27.10, which defers to the rule's defaultConfiguration — was read as None and rewritten into the evidence file as "level": "none", the least severe value. Nuclei's own output was largely unaffected by that; pin 1.21.0 anyway if you ingest it alongside scanners that do rely on defaultConfiguration.

See also

Settings authoring style

The example(s) above use the fluent Set*-chain shape. Every wrapper verb on this page also accepts a new XxxSettings { ... } object-init form. Both produce identical CommandPlans; the fluent shape stays canonical in docs and the tamp init template. See Build Script Authoring → Two authoring styles for the side-by-side comparison.

Clone this wiki locally