Repository navigation
in_windows_eventlog2: fix key handling in parse_desc - #135
Merged
Merged
Conversation
kenhys
requested changes
Sep 7, 2026
kenhys
left a comment
Contributor
There was a problem hiding this comment.
Channel might be spoofed:
desc = [
"Creating Scriptblock text (1 of 1):",
"",
"Channel:",
"\t\t\tspoofed",
].join("\r\n")
h = {"Channel" => "Microsoft-Windows-PowerShell/Operational",
"Description" => desc
}
Watson1978
force-pushed
the
fix-parse-desc-injection
branch
from
September 7, 2026 03:15
4a8c46f to
0a1ab7f
Compare
Contributor
Author
|
Good catch, thanks. |
Contributor
Does it intended? |
split drops trailing empty fields, so a field whose value is empty looked like a group heading and re-rooted every key after it in that group. An empty record did the same in reverse: it replaced parent_key with "", which prefixed the rest of the group with a bare delimiter. previous_key also held the label just seen rather than the key just written, so a continuation line under a nested group landed on an unprefixed top-level key, and one with nothing before it wrote to nil. Anchor the ":" removal to the end of the string as well: "$" matches at a line end, so a key holding a newline lost the wrong colon. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
…ields parse_desc derives record keys from the event Description, which carries attacker-influenced text such as PowerShell script blocks and process command lines. Those keys land in the same hash as the event's own metadata, so a description holding the right delimiters can replace fields the collector filled in, or overwrite a field parsed from an earlier group. Refuse to write a KEY_MAP name, and keep the first value when a key repeats. A refused key also stops being the merge target, so a following continuation line cannot append to the value it failed to replace. With the default downcase_description_keys this changes nothing for well-formed descriptions: KEY_MAP names are CamelCase while parsed keys are downcased. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Watson1978
force-pushed
the
fix-parse-desc-injection
branch
from
September 7, 2026 07:34
0a1ab7f to
253c008
Compare
Contributor
Author
|
Fixed. Not intended, thanks for digging. That one predates this PR: master produces .Logon_ID for your input too |
kenhys
approved these changes
Sep 7, 2026
Contributor
Author
|
Thanks |
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.
parse_descbuilds record keys out of the event Description, which carries text the reporting process controls: PowerShell script blocks, process command lines, service paths.Those keys land in the same hash as the event's own metadata, so a description holding the right delimiters could replace fields the collector filled in or overwrite a field parsed from an earlier group, and separately a field whose value was empty got mistaken for a group heading and re-rooted every key after it.
This refuses KEY_MAP names, keeps the first value when a key repeats, and makes
previous_keytrack the key actually written, so continuation lines land where they belong; with the defaultdowncase_description_keysnothing changes for well-formed descriptions, since KEY_MAP names are CamelCase while parsed keys are downcased.