fix(http): isolate project cache entries by URL scheme (http vs https)#7137
Open
usernametooshort wants to merge 4 commits intoprojectdiscovery:devfrom
Open
fix(http): isolate project cache entries by URL scheme (http vs https)#7137usernametooshort wants to merge 4 commits intoprojectdiscovery:devfrom
usernametooshort wants to merge 4 commits intoprojectdiscovery:devfrom
Conversation
The second goroutine in runWorkflowStep was not cloning ctx.Input before passing it to runWorkflowStep, unlike the first goroutine which properly calls ctx.Input.Clone(). The comment on both paths says 'clone the Input so that other parallel executions won't overwrite the shared variables' but only the first path was actually doing it. This causes a race condition where parallel subtemplate executions can corrupt each other's input data when modifying shared variables.
…ure them
When a template variable like {{contact_id}} is not provided by the user
and gets passed through an encoding function (e.g. base64(rawhash) where
rawhash contains {{contact_id}}), the ContainsUnresolvedVariables check
on the final dumped request fails to detect it — the base64-encoded form
e3tjb250YWN0X2lkfX0= contains no {{...}} markers.
Fix: after EvaluateWithInteractsh builds the variablesMap, check each
variable value for unresolved {{...}} markers before allVars is assembled
and passed to expression evaluation. This catches self-referential
variables (e.g. contact_id: "{{contact_id}}") that were never provided
by the user via -var.
Fixes projectdiscovery#7032
…te install When nuclei-templates are not installed and the GitHub API returns a rate limit error (403), the SDK panics because NewNucleiEngineCtx propagates the error up to the caller. Fix: detect rate limit errors in FreshInstallIfNotExists and UpdateIfOutdated, and log a warning instead of returning a fatal error. This allows the engine to start even without templates (users can retry later or set GITHUB_TOKEN for higher rate limits). Fixes projectdiscovery#7118
The project file (-project) uses a hash of the dumped HTTP request as the cache key. Since http.Request.Dump() produces only the raw HTTP/1.1 request line (e.g. 'GET / HTTP/1.1') without the scheme, requests to http://example.com and https://example.com produce identical cache keys. This causes HTTPS responses to be served for HTTP requests (and vice versa) when using the project cache, leading to false positives. Fix: prefix the dumped request with the full URL (including scheme) before hashing, so http:// and https:// produce distinct cache entries. Fixes projectdiscovery#6866
Neo - PR Security ReviewNo security issues found Highlights
Hardening Notes
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #6866 — the project cache (
-project) serves HTTPS responses for HTTP requests because cache keys do not include the URL scheme.Root Cause
dump()callsreq.request.Clone().Dump()which produces raw HTTP/1.1 request bytes:The scheme (
http://vshttps://) is NOT included. SoProjectFile.Get()hashes the dump and gets the same key for bothhttp://example.comandhttps://example.com.Fix
Prefix the dumped bytes with the full URL (including scheme) before returning from
dump(). This makes the hash include the scheme, producing distinct cache entries.Behaviour
http://example.comwith-projectreturns cachedhttps://example.comresponse — false positive