#7617·nuclei

Evaluate DSL helper expressions in -H header values per request

Author: aviadaviCreated Jul 27, 2026Updated Aug 25, 2026

Summary

-H values are fixed strings for the whole run, so there is no way to have a header value that changes per request. This blocks the case in #7446: keeping User-Agent randomization while attaching a stable attribution tag.

In #7446, @dwisiswant0 proposed exactly this as the better alternative to a dedicated flag:

One alternative that came to my mind is to add support for DSL function helpers directly inside the -H flag values. So instead of adding yet another one-off flag, we could let users do something clean like -H "User-Agent: {{rand_ua}}". It feels more natural and solves the exact use case you described without polluting the flag list with yet another special-purpose option.

Opening this as a focused issue for that idea, since #7446 was about the -ua-tag flag and is closed.

Proposal

Resolve {{...}} in global custom header values once per generated request:

nuclei -u https://target -H "User-Agent: {{rand_user_agent()}} myprop/value"

Per request rather than per run, so the UA keeps rotating and the tag stays attached.

One thing worth flagging

{{rand_ua}} does not exist today. nuclei registers only dsl.HelperFunctions(), while the gofakeit-backed generators from projectdiscovery/dsl#234 live in a separate dsl.FakerFunctions() that nuclei never merges. So there is currently no random-UA helper reachable from a template or from -H.

Two ways to close that:

  1. Add a single rand_user_agent() helper backed by the projectdiscovery/useragent package nuclei already depends on and already uses for UA randomization. Values match what nuclei sends today, and no new dependency is needed.
  2. Merge dsl.FakerFunctions() into HelperFunctions, which exposes several hundred generators at once.

The linked PR takes option 1 since it is smaller, but happy to switch.

Others asking for it

@t0n requested this same combination in #7446 on Jul 13.