fix: CEF-escape Action and Details to prevent log injection (PILOT-263)#17
Open
matthew-pilot wants to merge 2 commits into
Open
fix: CEF-escape Action and Details to prevent log injection (PILOT-263)#17matthew-pilot wants to merge 2 commits into
matthew-pilot wants to merge 2 commits into
Conversation
Two failing tests that demonstrate the vulnerability: - Action containing pipe characters corrupts CEF header parsing, injecting fake extension fields (cn2, src, act). - Details containing pipe and newline characters corrupt msg extension and create fake CEF lines.
…ILOT-263) User-controlled Action and Details strings were interpolated directly into CEF output without escaping. An attacker could inject | and = characters to forge extension fields or fake CEF headers consumed by SIEM parsers. Add cefEscape() helper that escapes \, =, |, \r, \n per the CEF escaping convention, and apply it to Action before both the header and extensions, and to Details before the msg extension. Closes PILOT-263
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Collaborator
Author
🦾 Matthew PR Status — #17Title: fix: CEF-escape Action and Details to prevent log injection (PILOT-263) TicketsLabels
Files Changed
Next Actions
🦾 Auto-generated status check by matthew-pr-worker |
Collaborator
Author
🦾 Matthew PR Explain — #17What this PR doesfix: CEF-escape Action and Details to prevent log injection (PILOT-263) Scope
TicketsFiles
Review Notes
🦾 Auto-generated explain by matthew-pr-worker |
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
User-controlled
ActionandDetailsstrings inaudit/audit_export.gowere interpolated directly into CEF output without escaping. An attacker could inject|and=characters to forge extension fields or corrupt CEF header parsing consumed by SIEM parsers.Fix
Add a
cefEscape()helper that escapes\\,=,|,\r,\nper the CEF escaping convention, and apply it to:Actionbefore the CEF header andcs1=extensionDetailsbefore themsg=extensionVerification
Two new regression tests (
TestFormatCEFEscapesInjectionCharactersInAction,TestFormatCEFEscapesInjectionCharactersInDetails) demonstrate the vulnerability and confirm the fix.Scope
Closes PILOT-263