924 Commits

Author SHA1 Message Date
Dwi Siswanto 20cbf0bd73 refactor: use path-aware filesystem containment checks (#7420)
* feat(filepath): add IsPathWithinAnyDirectory func

Signed-off-by: Dwi Siswanto <git@dw1.io>

* refactor: use path-aware filesystem containment checks

Several filesystem trust boundaries relied on
lexical prefix checks to decide whether a path
fell under an allowed directory. That let sibling
paths be treated as if they were children of
trusted directories.

Replace those checks with canonical path
containment checks for helper payload loading,
template archive extraction, custom template
metadata, template path classification, and
headless screenshot output validation.

Signed-off-by: Dwi Siswanto <git@dw1.io>

* adding more tests

* fixing tests

* adding test

---------

Signed-off-by: Dwi Siswanto <git@dw1.io>
Co-authored-by: Mzack9999 <mzack9999@protonmail.com>
2026-06-04 21:03:51 +05:30
Doğan Can Bakır 7414bcbf89 bump version 2026-06-03 17:15:21 +03:00
Dwi Siswanto bbc010b637 fix(js): probe SMBv1 support after SMB2 negotiation (#7430)
`ConnectSMBInfoMode` only tried SMBv1 when SMB2/3
negotiation failed so dual-stack servers could
report `SupportV1` as false even when SMBv1 was
enabled.

Run a same-target SMBv1 probe after successful
SMB2/3 negotiation and merge the support flag into
the returned log w/o changing the negotiated
SMB2/3 version.

Fixes #4832

Signed-off-by: Dwi Siswanto <git@dw1.io>
2026-05-30 09:16:06 +02:00
tejgokani 79105261bd test(telnetmini): address CodeRabbit review — add 48-byte boundary test and clean up wrong-type input
- Add TestParseNTLMResponse_Minimal48Bytes to explicitly cover the exact
  lower boundary of the len<48 guard (minimal valid challenge, no target
  name or info)
- Replace the inline immediately-invoked function for the wrong-message-type
  case with a pre-built local variable for readability

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 15:05:00 +05:30
tejgokani 1aff867491 fix(telnetmini): replace len<12 guard with len<48 to prevent slice-bounds panic on truncated NTLM challenge
ParseNTLMResponse read fixed-header fields at offsets 12-14, 16-20, 40-42,
and 44-48 after only checking len>=12, causing a slice-bounds-out-of-range
panic for any NTLM section between 12 and 47 bytes. Because this input comes
from untrusted network data, a malicious or malformed telnet server could crash
the scanner (or the embedding host process when used via the SDK).

Raise the guard to len<48 so the full fixed header is present before any field
is touched. Add unit tests covering the happy path, existing error cases, and a
no-panic regression table for every truncated length in [12,47].

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 14:47:57 +05:30
Mzack9999 fa73d2e13e fix(js): abandon runtimes that outlive interrupt grace period (#7378)
Prevent pooled and non-pooled goja runtimes from
being reused or cleaned up when the `RunProgram`
goroutine fails to exit after context cancellation
and `Interrupt()`. In that state, the goroutine
may still be mutating runtime state, so touching
the runtime/returning it to the pool can cause
fatal concurrent map access panics.

Add an explicit `errRuntimeTerminationTimeout`
path that abandons the runtime, keeps the related
concurrency slot reserved, and releases that slot
only from a reaper after the orphaned goroutine
exits. Preserve `errors.Is` compatibility with the
original context cancellation cause.

Keep normal cleanup behavior unchanged, including
callback panic cleanup, and add regression tests
for stuck-interrupt handling that verify runtime
abandonment and delayed slot release.

Fixes #7376

* fix race condition

* fixing review comments

* fix(js): defer runtime cleanup

When a runtime is abandoned, we must not touch the
goja runtime after `RunProgram` has exceeded the
interrupt grace period. At the same time, cleanup
still needs to run on every normal exit before
returning the runtime to the pool, including setup
callback panics.

Signed-off-by: Dwi Siswanto <git@dw1.io>

---------

Signed-off-by: Dwi Siswanto <git@dw1.io>
Co-authored-by: Dwi Siswanto <git@dw1.io>
2026-05-23 08:35:25 +07:00
Dogan Can Bakir 9330f0186d Merge pull request #7414 from projectdiscovery/chore/deps-bump-and-govaluate-switch
chore(deps): bump pdsec modules + govaluate/aurora migration
2026-05-19 21:18:09 +03:00
Mzack9999 d68a5ea5b2 extending tests 2026-05-18 23:53:33 +02:00
Doğan Can Bakır 1ec64a3f95 chore(deps): bump pdsec modules; switch to projectdiscovery/govaluate and aurora v4
Bumps clistats, fastdialer, retryablehttp-go, dsl, networkpolicy,
ratelimit, sarif, utils, wappalyzergo, cdncheck. dsl v0.8.18 moves to
the projectdiscovery/govaluate fork, and utils v0.11.0 pulls aurora v4,
so the corresponding imports and type references are migrated.

Refs #7380.
2026-05-18 17:14:29 +03:00
Akhilesh Arora 33066e8ebc fix(http/raw): persist QueryAuthStrategy params in ApplyAuthStrategy
The QueryAuthStrategy case in raw.Request.ApplyAuthStrategy parses
r.FullURL into a local 'parsed', appends auth params to parsed.Params,
then returns without writing back to r.FullURL. Every other branch in
the same switch mutates r.Headers, and the standalone QueryAuthStrategy
.Apply / .ApplyOnRR in pkg/authprovider/authx/query_auth.go both write
back to req.URL.RawQuery. Only the raw-request branch was missing the
write-back, so raw templates matching a 'query' auth secret silently
drop the auth params.

Adds r.FullURL = parsed.String() after the loop. New unit test fails
on dev and passes with the fix.
2026-05-17 13:13:02 +02:00
Mzack9999 ce28f2028d Merge pull request #7388 from projectdiscovery/dwisiswant0/feat/js/add-wmi-tsch-scmr-and-dcom-helper-modules
feat(js): add wmi, tsch, scmr, and dcom helper modules
2026-05-14 20:52:58 +02:00
Mzack9999 5675f513ea use local samba endpoint 2026-05-14 18:42:48 +02:00
Mzack9999 0cc660ca2a Merge pull request #7397 from projectdiscovery/dwisiswant0/fix/expressions/prefer-exact-placeholders-over-exprs
fix(expressions): prefer exact placeholders over exprs
2026-05-13 21:26:14 +02:00
shubhamrasal ddcae35620 fix(reporting/gitlab): bump client-go to v1.9.1, widen IDs to int64
client-go v1.x widened ID fields from int to int64 across the API surface
(User.ID, Issue.ID, ListOptions.Page/PerPage). Adjust the tracker to the
new signatures: Integration.userID, the assignee slice, the FormatInt
arguments, and ListOptions casts.

Keep Options.DuplicateIssuePageSize / DuplicateIssueMaxPages as int —
that struct is user-facing YAML and YAML ints round-trip into int64 fine.
Cast at the call site only.

UpdateIssue and CreateIssueNote signatures also widened, but issue.IID
is already int64 in v1.x, so existing call sites compile unchanged.
2026-05-12 15:51:20 +05:30
Dwi Siswanto b4a9e0a75a fix(expressions): prefer exact placeholders over exprs
`FindExpressions` checks marker contents with
govaluate before doing normal placeholder
replacement. That breaks valid hyphenated names
like `request-id`: govaluate reads them as
subtraction lol, and the lookup fails with a
missing request parameter.

If a marker exactly matches a key in the
replacement map, treat it as a plain placeholder
and let normal replacement handle it. Authored
expressions should still be evaluated, and
malformed helper calls should still return errors.

Fixes #7395

Signed-off-by: Dwi Siswanto <git@dw1.io>
2026-05-12 04:45:58 +07:00
Dwi Siswanto 4f3e77f790 test(expressions): add TestEvaluateHyphenatedPlaceholderNames
Signed-off-by: Dwi Siswanto <git@dw1.io>
2026-05-12 04:45:41 +07:00
Dwi Siswanto 65d08b33ef feat(js): add wmi, tsch, scmr, and dcom helper modules
Add shared auth, options, result, redaction, and
adapter support for GoExec-backed JavaScript
helpers, including:

* `nuclei/wmi`
* `nuclei/tsch`
* `nuclei/scmr`
* `nuclei/dcom`

through generated bindings, and register them with
the JS compiler.

Also make JS generators to skip internal helper
packages and test files.

Signed-off-by: Dwi Siswanto <git@dw1.io>
2026-05-11 03:57:50 +07:00
Mzack9999 ed7cec560e adding protocols redirect (#7296) 2026-05-10 17:01:23 +07:00
Mzack9999 397ffaaf41 Merge pull request #7383 from projectdiscovery/dwisiswant0/fix/workflow/propagate-context-to-child-race-steps
fix(workflow): propagate context to child & race steps
2026-05-08 21:06:29 +02:00
Mzack9999 89d0e65c1d Merge pull request #7322 from projectdiscovery/dwisiswant0/fix/interactsh/serialize-InternalEvent-access
fix(interactsh): serialize `InternalEvent` access
2026-05-07 22:10:57 +02:00
Dwi Siswanto 805bcfe76f fix(workflow): propagate context to child & race steps
Workflow inputs get updated with extracted values,
but later executors don't refresh their template
contexts from that state. Child subtemplates reuse
the same input object, letting sibling state leak
across concurrent executions. HTTP race requests
also ignore dynamic values when building requests.

Fix this by syncing the current workflow input
into each executor's template context, cloning
inputs passed to subtemplates, and forwarding
dynamic values to race request generation.

Fixes #5399

Signed-off-by: Dwi Siswanto <git@dw1.io>
2026-05-08 02:59:49 +07:00
Dwi Siswanto 3e996ebc45 test(workflow): added unit tests for parent-to-child
propagation, sibling isolation, and same-step
refresh, plus an integration workflow test
covering the race path.

Signed-off-by: Dwi Siswanto <git@dw1.io>
2026-05-08 02:59:10 +07:00
Mzack9999 54f002db4a Merge pull request #7356 from projectdiscovery/feat-impacket
Adding impacket integration
2026-05-06 17:57:02 +05:30
Doğan Can Bakır 7926e22174 fix lint 2026-05-06 12:34:01 +03:00
Doğan Can Bakır 10831d6188 fix lint 2026-05-06 12:28:15 +03:00
Mzack9999 637036ecb2 fixing dns vars 2026-05-05 00:05:43 +02:00
Mzack9999 a3c07e3ef9 Merge pull request #7340 from mikhail5555/feature/improved-filter-performance
perf(catalog): split exact matches & pattern
2026-04-30 01:25:46 +08:00
Mzack9999 86cc0926c9 finalizing 2026-04-30 00:11:37 +08:00
knakul853 cd1bfe8d87 fix(reporting/jira): match status-not against transition target status name
CloseIssue iterated transitions comparing transition.Name against StatusNot.
StatusNot is semantically a status name (same field is used for the JQL
"status != ..." clause in FindExistingIssue), so the transition-name match
broke any workflow whose transitions have distinct verb-style names (common
in customized enterprise workflows). With default Atlassian workflows the
transition name happens to equal the target status name, masking the bug.

Compare against transition.To.Name instead, so the behavior is consistent
with the field's semantics and with how StatusNot is already used in JQL.
2026-04-24 21:25:35 +05:30
PDTeamX 20355232b0 version update 2026-04-16 22:16:15 +05:30
Mikhail Epifanov ad74c601c4 fix(js): interrupt goja runtime on context cancel (#7343)
* Interrupt goja runtime on context cancel

* undo import formats

* do both actions in same go-routine to prevent any possible race condition

* Convert the watchdog, into a simpeler construction which still guarantees the same promises

* move the recover to the go routine, and return named return since we now can use the channel

* remove unnecessary tests

* add extra safety in case process refuses to get interrupted

* remove unnecessary ExecFuncWithTwoReturns

* remove named return values
2026-04-16 15:17:55 +07:00
Mzack9999 6c888974e0 Merge pull request #7337 from dahezhiquan/fix/default-version-compare
fix(installer): prevent unnecessary update checks
2026-04-15 19:15:53 +03:00
Doğan Can Bakır c5c2127d28 fix flaky TestActionWaitDialog on Windows CI 2026-04-15 16:14:28 +08:00
Doğan Can Bakır 73d2afc327 merge dev and resolve testutils import conflict 2026-04-15 15:37:18 +08:00
Doğan Can Bakır d305dd6f86 add cross-platform service name fallback and port dedup 2026-04-15 15:28:04 +08:00
Dogan Can Bakir 0383fbfcb8 Merge pull request #7325 from projectdiscovery/fix/headless-tlsi-addheader
Fix headless JS loading with -tlsi and addheader/setheader
2026-04-15 09:23:25 +03:00
Dwi Siswanto f893b6c0cb refactor: native tests (#7307)
Signed-off-by: Dwi Siswanto <git@dw1.io>
2026-04-15 05:27:07 +07:00
Dogan Can Bakir 0e67be77bc fix DAST skipping URLs with part: request and mode: multiple (#7326) 2026-04-15 05:21:32 +07:00
Mikhail Epifanov ec5f6505c4 remove unnecessary or misleading comments from bench 2026-04-13 16:04:46 +02:00
Mikhail Epifanov ad91d5d933 fix comment, add [ to pattern, add thread-safe disclaimed even though modifying filter was always not-thread safe 2026-04-13 16:02:37 +02:00
Mikhail Epifanov 643a64c8f3 split exact matches and pattern matches for increased performance during lookup 2026-04-13 15:40:13 +02:00
Dwi Siswanto 6c803c74d1 fix(expressions): avoid helper eval in literal checks (#7321)
* fix(expressions): avoid helper eval in literal checks

`hasLiteralsOnly()` currently evaluates helper
expressions while deciding whether "{{...}}"
contains unresolved variables, which makes
validation paths run side-effectful helpers.

Just replace that runtime eval with a
`Vars()` len check so unresolved-variable
detection literally stays literal (am I writing it
right?), and of course side-effect free.

Also make `Evaluate()` return template-authored
expression compile/eval errors instead of
logging and then keep continuing, so malformed
helper calls still fail in the rendering path.

Fixes #7320

Signed-off-by: Dwi Siswanto <git@dw1.io>

* fix(javascript): avoid nil map panic on arg eval failure

`getArgsCopy()` logs and counts argument
evaluation failures, but continues to store Port
in `argsCopy` even when `evaluateArgs()` returns.
This causes malformed JavaScript args like
"{{base64()}}" to panic instead of returning the
original error.

Return the evaluation error immediately after
reporting it to prevent the panic and make sure
proper error propagation.

Signed-off-by: Dwi Siswanto <git@dw1.io>

---------

Signed-off-by: Dwi Siswanto <git@dw1.io>
2026-04-10 21:39:17 +05:30
dahe da17fa42e3 fix: add continue after handling default template version in GetNewTemplatesInVersions 2026-04-10 18:21:49 +08:00
Dwi Siswanto 6f2ade6a9b fix(js): respect allow-local-file-access in require (#7332)
* fix(js): respect `allow-local-file-access` in `require`

The goja `require() `function used the default
host filesystem loader which let JavaScript
templates import any local files even when
`allow-local-file-access` was disabled.

Pooled runtimes kept `require()` state around so
a module loaded during a privileged execution
could remain cached for a later restricted one.

Rebuild the require registry per execution after
setting the execution context, and route file-
backed module loads to preserve native modules
while enforcing the same sandbox rules (as
`nuclei/fs`).

Signed-off-by: Dwi Siswanto <git@dw1.io>

* fix: cross-platform sandbox path checks

Replace lexical prefix checks in the template file
sandbox with a shared path containment helper that
canonicalizes both paths before comparing them to
prevent false rejections when the configured
templates directory and the resolved file path
differ only due to symlink expansion on macOS or
path normalization on Windows.

Apply the helper in `protocolstate.NormalizePath()`
and `Options.GetValidAbsPath()` so JS `require()`-
based module loads and helper file resolution use
the same rules.

Signed-off-by: Dwi Siswanto <git@dw1.io>

---------

Signed-off-by: Dwi Siswanto <git@dw1.io>
2026-04-10 08:06:39 +07:00
Doğan Can Bakır 10cccb7f3c fix headless JS loading with -tlsi and addheader/setheader 2026-04-02 17:44:49 +05:30
Dwi Siswanto 68e49a7981 fix(interactsh): serialize InternalEvent access
`interactsh.(*Client).processInteractionForRequest`
was updating the wrapped event under lock but
releasing it before calling `Operators.Execute()`,
allowing async interactsh updates to race with
matcher expr evaluation on the same `InternalEvent`
map, causing fatal concurrent map iteration/write
crashes.

Hold the event lock while populating interactsh
fields and running operators, and use a locked
`eventHash()` helper for matched-template cache
lookups that access the same event data.

Fixes #7319

Signed-off-by: Dwi Siswanto <git@dw1.io>
2026-04-02 11:48:33 +07:00
Dogan Can Bakir c6fb1ae486 Merge pull request #7311 from projectdiscovery/dwisiswant0/test/add-fuzz-tests
test: add fuzz tests
2026-04-01 12:25:03 +03:00
Mzack9999 3537030e1f fix(js): watchdog + propagates context to all JS library network calls (#7299)
* fix(js): prevent pool slot starvation under load

Zombie goroutines from timed-out JS executions held pool slots
indefinitely: Add() blocked with context.Background(), and defer Done()
only ran when the goroutine eventually completed. Under load, both
pools (80 pooled + 20 non-pooled slots) filled with zombies, silently
dropping all subsequent matches.

Three changes fix slot lifecycle management:

1. Propagate the 20s deadline context into ExecuteProgram (compiler.go)
   so both execution paths can respect the deadline.

2. Replace Add() with AddWithContext(ctx) in both pool.go and
   non-pool.go so goroutines waiting for a slot fail fast when the
   deadline expires instead of blocking indefinitely.

3. Add a watchdog goroutine that releases the slot when the deadline
   expires, even if the zombie is still running. An atomic.Bool
   ensures exactly one Done() call between the watchdog and the
   normal defer path.

* adding context

* refactor(js): derived the ctx to remaining tractable deadline leaks (#7302)

* refactor(js): use `context.Background` as default instead

Signed-off-by: Dwi Siswanto <git@dw1.io>

* refactor(js): derived the ctx to remaining tractable deadline leaks

Signed-off-by: Dwi Siswanto <git@dw1.io>

* test(js): add `NucleiJS.Context` tests

Signed-off-by: Dwi Siswanto <git@dw1.io>

* fix(cmd): context param exclusion in memoization hash

The memoization template condition for excluding
context parameters from hash keys was incorrect.
The memoize package represents context.Context
types as "&{context Context}" (AST string
representation), not "context.Context".

Signed-off-by: Dwi Siswanto <git@dw1.io>

* chore(js): memogen'ed

Signed-off-by: Dwi Siswanto <git@dw1.io>

---------

Signed-off-by: Dwi Siswanto <git@dw1.io>

* fix(js): hangs in checkRDPEncryption

by bounding socket I/O

Add `setConnDeadlineFromContext` helper to set
deadlines on conns derived from context timeouts.
Move conn cleanup out of loop-scoped defers to
make sure immediate cleanup per probe attempt.

Signed-off-by: Dwi Siswanto <git@dw1.io>

---------

Signed-off-by: Dwi Siswanto <git@dw1.io>
Co-authored-by: Niek den Breeje <AuditeMarlow@users.noreply.github.com>
Co-authored-by: Dwi Siswanto <25837540+dwisiswant0@users.noreply.github.com>
Co-authored-by: Dwi Siswanto <git@dw1.io>
2026-04-01 14:53:13 +07:00
Dwi Siswanto 35146e0a43 test: add fuzz tests
Signed-off-by: Dwi Siswanto <git@dw1.io>
2026-03-31 15:07:08 +07:00
Doğan Can Bakır cb0a9f4621 support service names in network template port field 2026-03-26 17:49:22 +03:00