189 Commits

Author SHA1 Message Date
Mzack9999 fe70a10664 fix memogen context skip and scope workflow to upstream repo 2026-05-20 21:16:47 +02:00
Dwi Siswanto f893b6c0cb refactor: native tests (#7307)
Signed-off-by: Dwi Siswanto <git@dw1.io>
2026-04-15 05:27:07 +07: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
Mzack9999 48e05ca32e Merge pull request #7277 from HarshadaGawas05/feat/honeypot-detection
feat: add honeypot detection to reduce scan noise (#6403)
2026-03-20 17:09:58 +01:00
saurabh 5e8ef276a0 add inline targets and secrets to template profiless (#5567) (#6858)
* feat: template profile inline targets and secrets (#5567)

* fix inline secrets temp file edge cases

* fixing lint

---------

Co-authored-by: Mzack9999 <mzack9999@protonmail.com>
2026-03-20 13:57:18 +01:00
Harshada Gawas 658df54f48 feat: add honeypot detection to reduce scan noise (#6403) 2026-03-20 14:05:21 +05:30
Mzack9999 f480e863c1 Merge pull request #7254 from Gengyscan/feat/pdf-export
feat(reporting): add PDF export option for scan results
2026-03-20 00:09:49 +01:00
Mzack9999 c56fe37743 ci: integrate typos spell checker into CI workflow (#6532)
ci: integrate typos spell checker into CI workflow
2026-03-19 19:17:38 +01:00
Gengyscan baddf6aeb7 fix: address CodeRabbit review findings
- Update -omit-raw help text to include PDF in scope
- Move require.NoError out of goroutine in concurrency test (FailNow semantics)
- Truncate raw request/response at buffer time in Export() to prevent memory accumulation
2026-03-17 17:50:28 +01:00
Gengyscan 42b7a11f2c feat(reporting): add PDF export option for scan results 2026-03-17 14:58:40 +01:00
Dwi Siswanto d221732016 fix(expressions): only eval template-authored expressions (#7221)
* fix(expressions): only eval template-authored expressions

`expressions.Evaluate()` currently replaces
placeholders first and then scans the substituted
output for expressions which allows
response-derived values, including extractor
output, to be reinterpreted as DSL/helper syntax
on a second pass, which then becomes more serious
when env-backed variables are enabled.

So making this by collecting expressions from the
original template text before placeholder
substitution and then evaluating only those
original expressions after normal replacement to
keep trusted template-authored helpers working,
including placeholders nested inside helper
arguments while treating substituted response data
as literal text.

Fixes #7210

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

* test: add resp data literal reuse test

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

---------

Signed-off-by: Dwi Siswanto <git@dw1.io>
2026-03-16 18:25:36 +07:00
leo 63e5492ce3 ci: integrate typos spell checker into CI workflow
Add the crate-ci/typos GitHub Action to automatically catch spelling
errors in future PRs. This includes:

- New `.github/workflows/typos.yaml` workflow that runs on pushes to
  dev, pull requests, and manual dispatch
- `_typos.toml` configuration to suppress false positives from
  non-English READMEs, test fixtures, certificate data, CLI flag
  short names, and intentional identifiers
- Fix genuine typos found by the tool:
  - `PostReuestsHandlerRequest` -> `PostRequestsHandlerRequest`
  - `fiter` -> `filter`
  - `thant` -> `that`
  - `seperate` -> `separate`
  - `ExludedDastTmplStats` -> `ExcludedDastTmplStats`
  - `splitted` -> `split` (local variables)
  - `formated` -> `formatted` (local variables)
  - Rename `worflow_loader.go` -> `workflow_loader.go`

Fixes #6532
2026-03-08 22:11:26 -04:00
Dwi Siswanto c159e62681 refactor(types)!: make resume state as cache data
Resume files are runtime artifacts and SHOULD NOT
be presented as persistent config.

Update reset messaging to separate config vs cache
and explicitly include resume state under cache
cleanup. Also delete the cache dir during `-reset`
to keep behavior aligned with the new semantics.

Close #6792

Signed-off-by: Dwi Siswanto <git@dw1.io>
2026-03-05 12:49:11 +07:00
Richard Brown 51205f8470 fix(clustering): updated cluster failure handling (#6843)
* fix(clustering): updated cluster failure handling and mock output

* fix(interactsh): updated callbacks for interactsh

* fix(callbacks): reverted callbacks an just fixed clustered output
2026-03-05 01:55:38 +05:30
bimakw 75525ed431 fix(loader): replace panic with error handling in template loader
Replace panic with proper error return when dialers are missing,
allowing callers to handle the situation gracefully.

Changes:
- Modify LoadTemplatesWithTags to return ([]*templates.Template, error)
- Modify LoadTemplates to return ([]*templates.Template, error)
- Modify Load to return error
- Replace panic("dialers with executionId...") with fmt.Errorf
- Replace panic("could not create wait group") with fmt.Errorf
- Update all callers to handle the new error return

Callers updated:
- internal/runner/lazy.go
- internal/runner/runner.go
- internal/server/nuclei_sdk.go
- lib/multi.go
- lib/sdk.go
- cmd/integration-test/library.go
- pkg/protocols/common/automaticscan/util.go
- pkg/catalog/loader/loader_bench_test.go

Fixes #6674
2026-02-06 17:10:21 +07:00
Doğan Can Bakır 5374bbce0c fix resume file path condition 2026-01-21 16:20:52 +03:00
Dwi Siswanto ee8287a7b7 fix(http): interactsh matching with payloads (#6778)
* fix(http): interactsh matching with `payloads`

in parallel execution.

Templates using `payloads` with Interactsh
matchers failed to detect OAST interactions
because the parallel HTTP execution path (used
when `payloads` are present) did not register
Interactsh request events, unlike the seq path.

This caused incoming interactions to lack
associated request context, preventing matchers
from running and resulting in missed detections.

Fix #5485 by wiring
`(*interactsh.Client).RequestEvent` registration
into the parallel worker goroutine, make sure both
execution paths handle Interactsh correlation
equally.

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

* test: add interactsh with `payloads` integration

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

* test: disable interactsh-with-payloads

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

---------

Signed-off-by: Dwi Siswanto <git@dw1.io>
2026-01-21 12:47:47 +07:00
Mzack9999 64b4c59545 Merge branch 'dev' into dwisiswant0/feat/headless/cdp-endpoint-option 2026-01-09 17:35:33 +04:00
Dwi Siswanto 46c183ef22 test: add race with delay integration test
Signed-off-by: Dwi Siswanto <git@dw1.io>
2026-01-03 21:59:43 +07:00
Mzack9999 dbeebdaa1d adding telnet login + crypto (#6419)
* adding telnet login + crypto

* smbauth lib porting + ntlm parsing over telnet

* gen lib

* adding telnet test

* adding breakout after max iterations

* fix(utils): broken pkt creation & impl `Create{LN,NT}Response`

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

* chore(utils): satisfy lints

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-01-02 06:28:46 +07:00
Mzack9999 891dffb4a1 feat(js): adds RSYNC module (#6410)
* adding min auth support

* adding unauth list modules + auth list files in module

* example

* adding rsync test

* bump go.mod

---------

Co-authored-by: Dwi Siswanto <git@dw1.io>
2026-01-01 02:02:48 +07:00
Dwi Siswanto 12176d67a9 test(javascript): add mysql-connect integration test
Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-12-26 01:08:00 +07:00
Mzack9999 5d79201299 fix(js): incorrect postgres exec call signature (#6731)
Make sure postgres Exec/ExecContext are invoked with the correct
argument order, preventing context from being passed as the query.

* fixing pg syntax

* adding test
2025-12-24 03:20:50 +07:00
Mzack9999 329a891069 test: add pwsh integration test (#6724)
* adding pwsh tests

* chore(cmd): rm template

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

---------

Signed-off-by: Dwi Siswanto <git@dw1.io>
Co-authored-by: Dwi Siswanto <git@dw1.io>
2025-12-22 01:41:40 +07:00
Ice3man d48c2c38fa feat(trackers): add site-url to optionally provide jira server URL for oauth (#6716)
* feat: add site-url to optionally provide jira server URL for oauth

* chore(cmd): add `site-url` config option

Adds optional `site-url` field to JIRA issue
tracker configuration for specifying browsable URL
when it differs from the API endpoint. This is
particularly useful for OAuth-based JIRA Cloud
integrations where `issue.Self` contains
"api.atlassian.com" instead of the user-facing
domain.

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

---------

Signed-off-by: Dwi Siswanto <git@dw1.io>
Co-authored-by: Dwi Siswanto <git@dw1.io>
2025-12-18 23:47:45 +07:00
Mzack9999 2d4459d050 Merge pull request #6712 from projectdiscovery/dwisiswant0/fix/trackers/add-gitlab-paginated-dup-issue-search
fix(trackers): add gitlab paginated dup issue search
2025-12-18 13:55:59 +04:00
Dwi Siswanto 39a07ca15e fix(trackers): add gitlab paginated dup issue search
with configurable limits

This patch fixes duplicate issue detection for
GitLab trackers by implementing paginated search
with configurable page size and max pages. Adds
`duplicate-issue-page-size` and
`duplicate-issue-max-pages` options to the config.

Fixes #6711.

Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-12-18 00:29:38 +07:00
Leon Jacobs a7df69749e fix(trackers): paginate gitea to find all issues when searching for duplicates (#6707)
* (fix) paginate to find all issues when searching for duplicates

* (feat) add configurable limits for perpage and total pages
2025-12-18 00:26:19 +07:00
Dwi Siswanto 746a05dac5 fix(javascript): restore exec for templates w/o Port arg (#6709)
Restore backwards compat for JavaScript protocol
templates that omit the `Port` argument.
Regression was introduced in f4f2e9f2, which
removed the fallback for empty `Port` in
`(*Request).ExecuteWithResults`, causing templates
without `Port` to be silently skipped.

Now, if no `Port` is specified, the engine
executes the JavaScript block using the target
URL's port.

Fixes #6708.

Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-12-17 22:07:14 +07:00
Mzack9999 b49beef554 improving update template + empty folder edge case (#6573)
* improving update template + empty folder edge case

* lint

* index cleanup

* cleaning path

* win fix

* fix

* chore(cmd): rm templates

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

---------

Signed-off-by: Dwi Siswanto <git@dw1.io>
Co-authored-by: Dwi Siswanto <git@dw1.io>
2025-12-14 23:35:22 +07:00
Dwi Siswanto b63a23bd5c fix(http): pass dynamicValues to EvaluateWithInteractsh (#6685)
* fix(http): pass `dynamicValues` to `EvaluateWithInteractsh`

When `LazyEval` is true (triggered by `variables`
containing `BaseURL`, `Hostname`,
`interactsh-url`, etc.), variable expressions are not
eval'ed during YAML parsing & remain as raw exprs
like "{{rand_base(5)}}".

At request build time, `EvaluateWithInteractsh()`
checks if a variable already has a value in the
passed map before re-evaluating its expression.
But, `dynamicValues` (which contains the template
context with previously eval'ed values) was not
being passed, causing exprs like `rand_*` to be
re-evaluated on each request, producing different
values.

Fixes #6684 by including `dynamicValues` in the
map passed to `EvaluateWithInteractsh()`, so
variables evaluated in earlier requests retain
their values in subsequent requests.

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

* chore(http): rm early eval in `(*Request).ExecuteWithResults()`

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

* test: adds variables-threads-previous integration test

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

* test: adds constants-with-threads integration test

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

* test: adds race-with-variables integration test

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

---------

Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-12-12 14:37:59 +07:00
Dwi Siswanto 9102f333a9 feat(loader): implement persistent metadata cache (#6630)
* feat(loader): implement persistent metadata cache

for template filtering optimization.

Introduce a new template metadata indexing system
with persistent caching to dramatically improve
template loading perf when filters are applied.
The implementation adds a new index pkg that
caches lightweight template metadata (ID, tags,
authors, severity, .etc) and enables filtering
templates before expensive YAML parsing occurs.

The index uses an in-memory LRU cache backed by
`otter` pkg for efficient memory management with
adaptive sizing based on entry weight, defaulting
to approx. 40MB for 50K templates.
Metadata is persisted to disk using gob encoding
at "~/.cache/nuclei/index.gob" with atomic writes
to prevent corruption. The cache automatically
invalidates stale entries using `ModTime` to
detect file modifications, ensuring metadata
freshness w/o manual intervention.

Filtering has been refactored from the previous
`TagFilter` and `PathFilter` approach into a
unified `index.Filter` type that handles all basic
filtering ops including severity, authors, tags,
template IDs with wildcard support, protocol
types, and path-based inclusion and exclusion. The
filter implements OR logic within each field type
and AND logic across different field types, with
exclusion filters taking precedence over inclusion
filters and forced inclusion via
`IncludeTemplates` and `IncludeTags` overriding
exclusions.

The `loader` integration creates an index filter
from store configuration via `buildIndexFilter`
and manages the cache lifecycle through
`loadTemplatesIndex` and `saveTemplatesIndex`
methods. When `LoadTemplatesOnlyMetadata` or
`LoadTemplatesWithTags` is called, the system
first checks the metadata cache for each template
path. If cached metadata exists and passes
validation, the filter is applied directly against
the metadata without parsing. Only templates
matching the filter criteria proceed to full YAML
parsing, resulting in significant performance
gains.

Advanced filtering via "-tc" flag
(`IncludeConditions`) still requires template
parsing as these are expression-based filters that
cannot be evaluated from metadata alone. The
`TagFilter` has been simplified to handle only
`IncludeConditions` while all other filtering ops
are delegated to the index-based filtering system.

Cache management is fully automatic with no user
configuration required. The cache gracefully
handles errors by logging warnings & falling back
to normal op w/o caching. Cache files use schema
versioning to invalidate incompatible cache
formats across nuclei updates (well, specifically
`Index` and `Metadata` changes).

This optimization particularly benefits repeated
scans with the same filters, CI/CD pipelines
running nuclei regularly, development and testing
workflows with frequent template loading, and any
scenario with large template collections where
filtering would exclude most templates.

* test(loader): adds `BenchmarkLoadTemplates{,OnlyMetadata}` benchs

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

* ci: cache nuclei-templates index

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

* chore(index): satisfy lints

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

* fix(index): correct metadata filter logic

for proper template matching.

The `filter.matchesIncludes()` was using OR logic
across different filter types, causing incorrect
template matching. Additionally, ID matching was
case-sensitive, failing to match patterns like
'CVE-2021-*'.

The filter now correctly implements: (author1 OR
author2) AND (tag1 OR tag2) AND (severity1 OR
severity2) - using OR within each filter type and
AND across different types.

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

* test(index): resolve test timing issue

in CI environments.

Some test was failing in CI due to filesystem
timestamp resolution limitations. On filesystems
with 1s ModTime granularity (common in CI),
modifying a file immediately after capturing its
timestamp resulted in identical ModTime values,
causing IsValid() to incorrectly return true.

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

* ci: cache nuclei with composite action

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

* fix(index): file locking issue on Windows

during cache save/load.

Explicitly close file handles before performing
rename/remove ops in `Save` and `Load` methods.

* In `Save`, close temp file before rename.
* In `Load`, close file before remove during error
  handling/version mismatch.

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

* test(index): flaky index tests on Windows

Fix path separator mismatch in `TestCacheSize`
and `TestCachePersistenceWithLargeDataset` by
using `filepath.Join` consistently instead of
hardcoded forward slashes.

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

* test(cmd): init logger to prevent nil pointer deref

The integration tests were panicking with a nil
pointer dereference in `pkg/catalog/loader`
because the logger was not init'ed.

When `store.saveMetadataIndexOnce` attempted to
log the result of the metadata cache op, it
dereferenced the nil logger, causing a crash.

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

* fix(loader): resolve include/exclude paths

for metadata cache filter.

The `indexFilter` was previously init'ed using raw
relative paths from the config for
`IncludeTemplates` and `ExcludeTemplates`.
But the persistent metadata cache stores templates
using their absolute paths. This mismatch caused
the `matchesPath` check to fail, leading to
templates being incorrectly excluded even when
explicitly included via flags
(e.g., "-include-templates
loader/excluded-template.yaml").

This commit updates `buildIndexFilter` to resolve
these paths to their absolute versions using
`store.config.Catalog.GetTemplatesPath` before
creating the filter, ensuring consistent path
matching against the metadata cache.

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

* feat(index): adds `NewMetadataFromTemplate` func

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

* refactor(index): return metadata when `(*Index).cache` is nil

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

* refactor(loader): restore pre‑index behavior semantics

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

---------

Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-12-04 21:35:51 +07:00
Dogan Can Bakir c32cff8521 Merge pull request #6493 from projectdiscovery/dwisiswant0/fix/restore-parallel-processing-in-workflow-file-proto
fix: restore parallel processing in file proto
2025-11-23 23:34:35 +09:00
Mzack9999 3ea8dc29c3 refactor test 2025-11-19 13:28:32 +04:00
Mzack9999 4e8843a7cd Merge branch 'dev' into multiport-js 2025-11-18 22:24:21 +04:00
Mzack9999 232de93297 removing unused check 2025-11-18 22:21:13 +04:00
Mzack9999 c746a8fdae lint 2025-11-18 22:20:17 +04:00
Mzack9999 9b37f1b441 adding test case 2025-11-18 21:43:28 +04:00
Mzack9999 e70044af4c Merge pull request #6603 from projectdiscovery/dwisiswant0/test/cmd/enable-BenchmarkRunEnumeration-Default-bench
test(cmd): enable `BenchmarkRunEnumeration/Default` bench
2025-11-18 17:57:37 +04:00
Mzack9999 a42dd7a6d9 updating docs 2025-11-18 17:06:04 +04:00
circleous 7877341a13 feat: write resume file specified by flag 2025-11-17 12:53:47 +07:00
Dwi Siswanto 3a4e436eed chore(cmd): satisfy lints
Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-11-12 08:55:40 +07:00
Dwi Siswanto 0f5d0d7976 test(cmd): collect CPU & heap profiles
Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-11-12 08:47:57 +07:00
Dwi Siswanto 954c825fab test(cmd): enable BenchmarkRunEnumeration/Default bench
Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-11-12 08:44:26 +07:00
Mzack9999 aecef0ab75 Merge branch 'dev' into feat-gozero-virtual 2025-11-08 06:01:01 +04:00
Mzack9999 13cca2b2c8 adding env tests on linux 2025-11-07 20:11:30 +04:00
Doğan Can Bakır 90d51f733a add env variable for nuclei tempaltes dir 2025-11-05 18:15:57 +03:00
Dwi Siswanto ed1c5752f3 refactor(integration-test): enhance debug mode detects
* replace hardcoded `DEBUG` env var check with
  extensible helper func.
* add support for GitHub Actions Runner env var.
* accept multiple truthy value variants.

Signed-off-by: Dwi Siswanto <git@dw1.io>
2025-11-02 21:24:28 +07:00
Mzack9999 c4a63ec1de adding virtual python 2025-10-27 23:29:27 +04:00
Mzack9999 b4551b901f executing virtual only on linux 2025-10-25 18:51:17 +04:00