Skip to content

fix(convert): reject unsafe Fibratus field names and escape YAML line breaks - #734

Merged
mostafa merged 4 commits into
mainfrom
fix/fibratus-output-injection
Nov 20, 2026
Merged

mostafa merged 4 commits into
mainfrom
fix/fibratus-output-injection

Conversation

@mostafa

@mostafa mostafa commented Nov 20, 2026

Copy link
Copy Markdown
Member

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.name rewrote the logic of the generated condition. Fibratus has no way to quote an identifier inside a filter, so field_ident now accepts only names the Fibratus lexer reads as one identifier: a letter or _, then letters, digits, _, ., or $, with optional [...] index segments such as evt.arg[exe] or ps.ancestor[0].name. Other names fail conversion. This also covers correlation group-by and value_count fields. Unmapped Sigma names such as Image still convert, and the loader reports them as unknown fields. In the SigmaHQ rule set, only hyphenated web-log fields such as cs-uri-query are rejected, and those never map to Fibratus.

Line breaks in the YAML rule envelope. The envelope split block scalars on \n only and wrote label keys raw, but gopkg.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 the condition, description, or labels block and could add a top-level action list (kill or isolate). 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 action key. The new golden case envelope_line_breaks locks the escaped output.

Breaking change: rsigma_convert::backends::fibratus::shared::sanitize_field is replaced by field_ident, which returns Result<&str>.

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.
@mostafa
mostafa merged commit 55f3bf1 into main Nov 20, 2026
25 checks passed
@mostafa
mostafa deleted the fix/fibratus-output-injection branch November 20, 2026 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant