Repository navigation
fix(convert): reject unsafe Fibratus field names and escape YAML line breaks - #734
Merged
Merged
Conversation
The Fibratus backend emitted field names verbatim, so a field name with spaces, operators, or parentheses rewrote the logic of the generated filter expression. Field names, including correlation group-by and value_count fields, must now be one Fibratus identifier or conversion fails.
YAML loaders break lines on \r, NEL, U+2028, and U+2029 as well as \n, so these characters in a value, description, or tag could end the condition, description, or labels block and add keys such as action to the generated rule. Text a block scalar cannot carry is now written as an escaped double-quoted scalar, label keys are quoted like values, and correlation conversion decodes double-quoted conditions.
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.
Fixes GHSA-98v4-pmv2-h8qq.
Fixes GHSA-gx4c-rpx5-2w58.
Two separate injection bugs in the Fibratus backend's output.
Field names in the filter expression. Field names were emitted verbatim, so a name such as
ps.name = evil or 1 = 1 or ps.namerewrote the logic of the generated condition. Fibratus has no way to quote an identifier inside a filter, sofield_identnow accepts only names the Fibratus lexer reads as one identifier: a letter or_, then letters, digits,_,., or$, with optional[...]index segments such asevt.arg[exe]orps.ancestor[0].name. Other names fail conversion. This also covers correlationgroup-byandvalue_countfields. Unmapped Sigma names such asImagestill convert, and the loader reports them as unknown fields. In the SigmaHQ rule set, only hyphenated web-log fields such ascs-uri-queryare rejected, and those never map to Fibratus.Line breaks in the YAML rule envelope. The envelope split block scalars on
\nonly and wrote label keys raw, butgopkg.in/yaml.v3, which Fibratus uses to load rules, also breaks lines on\r, NEL, U+2028, and U+2029. A carriage return in a detection value, field name, or description, or a newline in a tag, ended thecondition,description, orlabelsblock and could add a top-levelactionlist (killorisolate). Text that a block scalar cannot carry, including text with leading whitespace, is now written as an escaped double-quoted scalar. Label keys go through the same quoting as values. Correlation conversion decodes a double-quoted condition from a referenced rule, so stitched sequences keep working.I checked the reporter's payloads and the CR, NEL, LS, and tag variants against yaml.v3. Field-name payloads now fail conversion, and every other payload stays inside its value with no
actionkey. The new golden caseenvelope_line_breakslocks the escaped output.Breaking change:
rsigma_convert::backends::fibratus::shared::sanitize_fieldis replaced byfield_ident, which returnsResult<&str>.