FAPI IMA eventlog: bound the event name read by the template size - #3156
Open
ManoharPaturi wants to merge 1 commit into
Open
ManoharPaturi wants to merge 1 commit into
ManoharPaturi wants to merge 1 commit into
Conversation
moritzbuhl
force-pushed
the
fix-ima-eventname-bounds
branch
from
October 2, 2026 05:21
3755bbf to
f132850
Compare
JuergenReppSIT
requested changes
Oct 5, 2026
JuergenReppSIT
left a comment
Member
There was a problem hiding this comment.
Small style nit: please declare nul together with the other local variables at the start of the function (next to size) instead of in the middle of the block. This matches the style used in the rest of this file, where declarations are grouped at the top of the block, and keeps the function consistent with its surroundings.
Signed-off-by: Manohar Paturi <manoharpaturi@users.noreply.github.com>
ManoharPaturi
force-pushed
the
fix-ima-eventname-bounds
branch
from
October 5, 2026 14:14
f132850 to
72a5620
Compare
Author
|
@JuergenReppSIT Done,the |
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.
Problem
eventname_cb()reads the IMA event name with an unboundedstrlen(src/tss2-fapi/ifapi_ima_eventlog.c:360 — the line even carries a// TODO checknote):For an old-format
imaevent whose name field is not NUL-terminated (a corrupt or hostile measurement log),strlenruns past the template buffer before any length check runs.Confirmed with AddressSanitizer against current
masterusing a crafted old-format event:READ of size 257 ... 0 bytes after 276-byte regionineventname_cb←convert_ima_event_buffer←ifapi_read_ima_event_log. The IMA log path is reachable through the public FAPI eventlog API and theima_log_fileconfiguration.Fix
Bound the scan with
memchrover the remaining template bytes and reject unterminated names withTSS2_FAPI_RC_BAD_VALUE.Verification
Sanitizers clean on the crafted input after the fix; the existing
test/unit/fapi-ima-fuzzing.charness takes such a.binpayload directly for a regression case.