fix(payload): build full jku/x5u URL in basic payload instead of bare domain - #293
Merged
Conversation
… domain
The basic jku/x5u payload emitted the raw --jwk-attack value verbatim
(e.g. `jku: "evil.com"`), which is not a valid absolute URI and silently
ignored --jwk-protocol. A server resolving the header would never fetch
the attacker's endpoint, so the primary (and most important) URL payload
was effectively non-functional, while every bypass variant and the SSRF
probes correctly used a full `{protocol}://…` URL.
Prepend the configured scheme so the basic payload is a fetchable URL
that honours --jwk-protocol, matching the bypass and SSRF variants. A
value that already carries a scheme is passed through verbatim to avoid
producing a double scheme.
Updates the affected unit tests and adds a regression test asserting the
scheme is applied (and not duplicated for pre-schemed inputs).
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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
The basic
jku/x5upayload from thepayloadcommand emitted the raw--jwk-attackvalue verbatim — a bare domain — as the header value:A JWKS/cert resolver that fetches this URL server-side would never reach the
attacker's endpoint (no scheme → not fetchable), so the primary and most
important URL payload was effectively non-functional. Meanwhile every other
jku/x5u variant already produced correct full URLs:
{protocol}://{trust}Z{domain},…@…,…%0d%0a…ssrftarget emits complete URLs (http://169.254.169.254/…)--jwk-protocol(defaulthttps, documented ashttp/https) was silentlyignored for the basic payload.
Fix
Prepend the configured scheme so the basic payload is a valid, fetchable URL
that honours
--jwk-protocol, consistent with the bypass and SSRF variants. Avalue that already carries a scheme is passed through verbatim so a
pre-schemed input never produces a double scheme (
https://https://…).Before / After
Bypass variants are unchanged;
--target ssrfand the scan command(
generate_jku_x5u_ssrf_payload) are unaffected.Tests
test_generate_url_payload_jku_basicandtest_generate_url_payload_x5u_with_trustto expect the full URL.test_generate_url_payload_basic_respects_protocolcovering thehttps default,
--jwk-protocol=http, and the pre-schemed pass-through(no double scheme).
cargo test(558 tests),cargo fmt --check,cargo clippy --all-targetsall clean.
Scope / constraints
src/payload/mod.rstouched (within assigned scope).structure/keys/format untouched). Token lines remain structurally intact.