fix: nullptr dereference in seclang scanner#3543
Merged
airween merged 2 commits intoowasp-modsecurity:v3/masterfrom Apr 13, 2026
Merged
fix: nullptr dereference in seclang scanner#3543airween merged 2 commits intoowasp-modsecurity:v3/masterfrom
airween merged 2 commits intoowasp-modsecurity:v3/masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a potential nullptr dereference / UB in the seclang flex scanner when directives use a tab (\t) as the separator between directive name and argument.
Changes:
- Added a
find_separator()helper to locate either space or tab separators in matched scanner text. - Replaced many
strchr(yytext, ' ') + 1call sites withfind_separator(yytext)across scanner rules. - Updated generated parser/scanner artifacts (
seclang-scanner.cc,seclang-parser.hh) to reflect the scanner source changes.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/parser/seclang-scanner.ll |
Introduces find_separator() and switches many rules to use it (but a few strchr uses remain). |
src/parser/seclang-scanner.cc |
Regenerated flex output incorporating the updated rules/helper. |
src/parser/seclang-parser.hh |
Small generated-header metadata/guard updates. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
fzipi
approved these changes
Apr 13, 2026
8c658f0
into
owasp-modsecurity:v3/master
145 of 146 checks passed
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
This PR fixes a possible null pointer dereference in seclang-scanner and unhandled exception in rule parser.
why
There are two bugs reported, received in email from @fumfel and his team. Also they provided the fixes.
references
The original report:
Other issue (unhandled exception):
other notes
The bug can only be exploited if the WAF admin puts the pattern above into the config and restarts the engine. This cannot be used remotely or at runtime.