Skip to content

Conversation

@dwisiswant0
Copy link
Member

@dwisiswant0 dwisiswant0 commented Jan 20, 2026

Proposed changes

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.

Proof

server.py:

#!/usr/bin/env python3
import http.server
import socketserver
import urllib.request
import urllib.error
import threading
import sys

class Handler(http.server.BaseHTTPRequestHandler):
    def do_GET(self):
        target = self.headers.get("url")
        if target:
            threading.Thread(target=self._fire_and_forget, args=(target,), daemon=True).start()
        self.send_response(200)
        self.send_header("Content-Type", "text/plain")
        self.end_headers()
        body = "ok\n"
        if target:
            body = f"triggered: {target}\n"
        self.wfile.write(body.encode("utf-8"))

    def _fire_and_forget(self, url):
        try:
            with urllib.request.urlopen(url, timeout=5) as resp:
                resp.read(1)
        except (urllib.error.URLError, urllib.error.HTTPError, ValueError):
            pass


def main():
    host = "0.0.0.0"
    port = 8000
    if len(sys.argv) > 1:
        try:
            port = int(sys.argv[1])
        except ValueError:
            sys.stderr.write("Invalid port, using 8000\n")
    with socketserver.TCPServer((host, port), Handler) as httpd:
        print(f"Listening on http://{host}:{port}")
        httpd.serve_forever()

if __name__ == "__main__":
    main()
$ ./bin/nuclei -t integration_tests/protocols/http/interactsh-with-payloads.yaml -u http://127.0.0.1:8000 -interactions-poll-duration 1 -silent
[interactsh-with-payloads] [http] [info] http://127.0.0.1:8000/?p=c [p="c"]
[interactsh-with-payloads] [http] [info] http://127.0.0.1:8000/?p=a [p="a"]
[interactsh-with-payloads] [http] [info] http://127.0.0.1:8000/?p=b [p="b"]

Checklist

  • Pull request is created against the dev branch
  • All checks passed (lint, unit/integration/regression tests etc.) with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Summary by CodeRabbit

  • Tests

    • Added an integration test covering interactsh payload scenarios.
  • Bug Fixes

    • Preserve payload values for interact-only interactions to avoid data loss.
    • Improve result-write gating to allow safe retries and reduce missed detections.
  • Improvements

    • Deduplicate processed interactions to prevent duplicate work.
    • Coordinate interactsh events in parallel HTTP requests and propagate interim payload metadata for accurate callbacks.

✏️ Tip: You can customize this high-level summary in your review settings.

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 <[email protected]>
@auto-assign auto-assign bot requested a review from Mzack9999 January 20, 2026 06:35
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 20, 2026

Walkthrough

Adds a new integration test for interactsh with payloads, per-request interactsh handling in parallel HTTP execution, deduplicates processed interactions with a cache, preserves payloads for interactsh-only matches, and changes matched-write gating to a CAS-based check.

Changes

Cohort / File(s) Summary
Integration tests
cmd/integration-test/http.go, cmd/integration-test/interactsh.go
Added httpInteractshWithPayloadsRequest and registered protocols/http/interactsh-with-payloads.yaml test case to exercise interactsh behavior when HTTP payloads are used.
Interactsh result handling
pkg/protocols/common/interactsh/interactsh.go
Added processedInteractions cache and shouldProcessInteraction deduplication; early-return for duplicates; preserve payloads from InternalEvent["payloads"] when PayloadValues is empty; replace simple lock with CAS gating for writing matched results; add cache cleanup on Close.
Parallel HTTP request flow
pkg/protocols/http/request.go
Track and propagate per-task hasInteractMarkers and generatedRequest.meta (as interim payloads); emit Interactsh RequestEvent when interact markers/matchers exist; wrap callbacks and adjust event emission to synchronize interactsh requests with parallel workers.

Sequence Diagram(s)

sequenceDiagram
    participant Generator as RequestGenerator
    participant Worker
    participant HTTP as HTTP Dispatcher
    participant Interactsh
    participant Matcher as Template/Matcher
    participant Results as ResultProcessor

    Generator->>Worker: produce requests (meta/payloads, hasInteractMarkers)
    Worker->>HTTP: dispatch request
    HTTP->>Worker: worker handles response
    alt hasInteractMarkers
        Worker->>Interactsh: emit RequestEvent (urls, metadata, payloads)
    end
    Worker->>Matcher: run template / matchers
    Matcher-->>Results: produce interim event (includes interimEvent["payloads"])
    Results->>Interactsh: process interactions
    Interactsh-->>Results: deliver InternalEvent + OperatorsResults
    Results->>Results: if OperatorsResults.PayloadValues empty -> copy from InternalEvent["payloads"]
    Results->>Results: CAS InteractshMatched false->true => write final result (or reset on failure)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐇 I sniffed the payloads on the breeze,
Emitted pings and hopped with ease,
Saved each payload, neat and sound,
Skipped the echoes running round,
Tests pass — the little rabbit beams.

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'fix(http): interactsh matching with payloads' directly and clearly summarizes the main bug being fixed: enabling Interactsh OAST matching to work correctly when payloads are used in HTTP templates.
Linked Issues check ✅ Passed The PR implementation addresses the core objective from issue #5485: it registers Interactsh RequestEvent in the parallel HTTP execution path used when payloads are present, enabling Interactsh interactions to be properly correlated with requests regardless of payload usage.
Out of Scope Changes check ✅ Passed All code changes are within scope: HTTP payload handling improvements, Interactsh client cache/deduplication logic, and integration tests for the new functionality are all directly related to fixing Interactsh matching with payloads.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@pkg/protocols/common/interactsh/interactsh.go`:
- Around line 172-174: The deduplication key currently built in
shouldProcessInteraction uses fullID + ":" + protocol which causes distinct
events with the same ID/protocol to be dropped; update the key construction in
the shouldProcessInteraction method to append a timestamp discriminator from
interaction.Timestamp (e.g., Unix seconds or milliseconds or formatted string)
so the cache key becomes fullID + ":" + protocol + ":" + interaction.Timestamp
(or its numeric representation), preserving the existing duplicate-suppression
logic while allowing separate interactions with different timestamps to be
processed.

@dwisiswant0 dwisiswant0 marked this pull request as draft January 20, 2026 14:01
@dwisiswant0 dwisiswant0 force-pushed the dwisiswant0/fix/http/interactsh-matching-with-payloads branch 2 times, most recently from f4b78e7 to 8e3dfc9 Compare January 20, 2026 17:04
@dwisiswant0 dwisiswant0 force-pushed the dwisiswant0/fix/http/interactsh-matching-with-payloads branch from 8e3dfc9 to cf4974f Compare January 20, 2026 19:24
@dwisiswant0
Copy link
Member Author

Do we have a known issue for interactsh in CI? Some related cases seem to be disabled too (and failed for all plats/archs -- tried too), tho this passes locally for me.

Marking this ready for review.

@dwisiswant0 dwisiswant0 marked this pull request as ready for review January 20, 2026 19:30
@auto-assign auto-assign bot requested a review from dogancanbakir January 20, 2026 19:30
@dwisiswant0 dwisiswant0 merged commit ee8287a into dev Jan 21, 2026
19 checks passed
@dwisiswant0 dwisiswant0 deleted the dwisiswant0/fix/http/interactsh-matching-with-payloads branch January 21, 2026 05:47
@dwisiswant0 dwisiswant0 added this to the v3.7.0 milestone Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using payloads will cause interactsh to fail

3 participants