fluentforwardreceiver allocates arbitrary memory from attacker-controlled msgpack length prefixes - #49293
Open
aniket866 wants to merge 5 commits into
Open
fluentforwardreceiver allocates arbitrary memory from attacker-controlled msgpack length prefixes#49293aniket866 wants to merge 5 commits into
aniket866 wants to merge 5 commits into
Conversation
Signed-off-by: aniket866 <iamaniketkumarmaner@gmail.com>
Contributor
|
Welcome, contributor! Thank you for your contribution to opentelemetry-collector-contrib. Important reminders:
|
aniket866
marked this pull request as ready for review
June 25, 2026 09:36
Signed-off-by: aniket866 <iamaniketkumarmaner@gmail.com>
Contributor
Author
|
hi @singhvibhanshu this is also ready to be reviewed , Please do whenever you get time |
Pull request dashboard statusStatus last refreshed: 2026-07-27 15:22:38 UTC.
This automated status or its linked feedback items may be incorrect. If something looks wrong, please report it with the result you expected. If you believe this pull request is incorrectly routed as waiting on the author, comment |
Co-authored-by: Vibhanshu Singh <find.vibhanshu@gmail.com>
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.
Vulnerability Detail
The
fluent_forwardreceiver (receiver/fluentforwardreceiver) decodes incoming msgpack frames from peer connections.Previously, several decode paths in
conversion.goread 32-bit length prefixes from the incoming stream and used them directly to allocate Go data structures (viaEnsureCapacityormake(map[string]any, hint)) and drive iteration loops, without any size checks.This allowed an unauthenticated attacker to send a few bytes and force the collector to attempt multi-gigabyte allocations, triggering an out-of-memory (OOM) crash or causing CPU exhaustion.
Fix Implementation
To prevent this vulnerability:
parseRecordToLogRecord(map headers)parseOptions(map headers)forwardEventLogRecords.DecodeMsg(array headers)maxFluentArrayLen, we abort parsing immediately and return an error without performing allocations.How it Works Now
Safe Allocation: Any frame specifying a length larger than
1 << 20is immediately rejected. The memory allocation (EnsureCapacityormake) is never executed, preventing memory exhaustion.Robust Iteration: Loops are bound to a maximum size of
1 << 20, protecting against infinite/unbounded execution.Validation: Added a dedicated unit test suite
TestDecodeMsgExcessiveLengthsto verify rejection behavior.I, a human, wrote this pull request description myself.
Closes #49229