fix: add the missing capture group to four regex extractors - #16663
Merged
theamanrawat merged 4 commits intoAug 10, 2026
Merged
theamanrawat merged 4 commits into
theamanrawat merged 4 commits into
Conversation
Each of these declares group: 1 on a pattern with no capture group. The extractor skips every submatch (len(match) < group+1) and silently produces nothing, so the value the template promises is never reported. oracle-containers-panel version string never extracted springboot-x-application-context header value never extracted smtp-credentials-exposure JSON form of both credentials missed smtp-credentials-exposure is the clearest: two patterns share one group: 1, and only the XML form captures. Against a body containing both forms it extracts only the XML match, so the JSON credential the template is named for goes unreported. Verified each replacement against a realistic corpus: oracle 'Oracle Containers for J2EE 10g \((.*)\)' -> 10.1.3.5.0 springboot '(?m)^X-Application-Context:\s*(\S.+)$' -> application:prod:8080 smtp 'smtp_username":"(.*?)"' -> admin smtp 'smtp_password":"(.*?)"' -> s3cr3t Two deliberate choices: the springboot pattern needs (?m) because the header part is a multi-line block and ^ would otherwise only match at the start of it; the smtp patterns use a lazy quantifier so a body with several keys doesn't swallow everything between the first and last quote. Only the extractor patterns changed; matchers are untouched.
Contributor
Author
|
Heads-up: the For what it's worth, I ran the equivalent locally against a nuclei build: and confirmed the yaml still parses across the full tree. Happy to wait — just flagging it so the empty check list isn't read as a red build. |
theamanrawat
approved these changes
Aug 10, 2026
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.
What's wrong
Four regex extractors declare
group: 1on a pattern that has no capture group.ExtractRegexskips every submatch (len(match) < group+1), so the value each template promises is never reported — silently, with no error.smtp-credentials-exposureis the clearest. Two patterns share onegroup: 1, and only the XML form captures:Against a body containing both forms it extracts only
bobfrom the XML. The JSON credential — what the template is named for — goes unreported.How these were found
Scanned all of
nuclei-templates: 13,451 yaml files, 2,100 regex extractors withgroup > 0. These four are the only ones affected, and after this change the scan reports 0.Verification
Each replacement was checked against a realistic corpus before proposing it:
Oracle Containers for J2EE 10g \((.*)\)10.1.3.5.0(?m)^X-Application-Context:\s*(\S.+)$application:prod:8080smtp_username":"(.*?)"adminsmtp_password":"(.*?)"s3cr3tAll four currently extract nothing.
Two deliberate choices, both tested:
(?m)on the springboot pattern. Theheaderpart is a multi-line block, so without it^only matches at the very start and the extractor still returns nothing — I confirmed that case:no (?m) -> []..*?on the smtp patterns. With a greedy.*, a body containing several keys captures everything between the first and last quote:End-to-end with nuclei: I built nuclei with the validation from projectdiscovery/nuclei#7612 + #7603, which turns this class into a hard error. The originals are rejected with an exact reason, and these fixed versions validate clean:
Only the extractor patterns changed — matchers are untouched, including the
wordmatcher in the springboot template that shares the same string.Note
These are worth fixing regardless of whether that nuclei-side validation lands; they're wrong today and have been since they were written. If the maintainers prefer, the
group: 1could be dropped instead of adding the capture — but then the extractor would return the whole match rather than just the value, which reads like a different intent from what the author wrote.