Bug 2140670

Summary: Segmentation fault in /usr/share/keylime/create_mb_refstate script
Product: Red Hat Enterprise Linux 9 Reporter: Anderson Sasaki <ansasaki>
Component: keylimeAssignee: Sergio Correia <scorreia>
Status: CLOSED ERRATA QA Contact: Patrik Koncity <pkoncity>
Severity: unspecified Docs Contact: Jan Fiala <jafiala>
Priority: unspecified    
Version: 9.1CC: afarley, ansasaki, dueno, jafiala, ksrot, lvrabec, pkoncity, scorreia
Target Milestone: rcKeywords: Triaged, ZStream
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: keylime-6.5.2-1.el9 Doc Type: Bug Fix
Doc Text:
.Keylime policy generation script no longer causes a segmentation fault and core dump The `create_mb_refstate` script generates policies for measured boot attestation in Keylime. Previously, `create_mb_refstate` incorrectly calculated the data length in the `DevicePath` field. As a consequence, the script tried to access invalid memory using the incorrectly calculated length, which resulted in a segmentation fault and core dump. This update, which has been published in advisory link:https://errata.devel.redhat.com/advisory/105318[RHBA-2022:105318-02], prevents the segmentation fault when processing the measured boot event log. As a consequence, you can generate a measured boot policy.
Story Points: ---
Clone Of:
: 2142034 (view as bug list) Environment:
Last Closed: 2023-05-09 07:45:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2150830    
Bug Blocks: 2142034    
Attachments:
Description Flags
base64 encoded binary measured boot log none

Description Anderson Sasaki 2022-11-07 15:18:22 UTC
Created attachment 1922775 [details]
base64 encoded binary measured boot log

Description of problem:
Running /usr/share/keylime/create_mb_refstate script with some inputs (e.g. the input provided as an attachment) causes a segmentation fault and core dump.

Version-Release number of selected component (if applicable):
keylime-6.5.1-1.el9_1.x86_64

How reproducible:
Deterministic

Steps to Reproduce:
1. Download the attachment mb_log.b64

2. Decode to a binary file:
$ base 64 -d mb_log.b64 > mb_log.bin

3. Provide the decoded binary as input (may require privileges to access configuration files)
# /usr/share/keylime/create_mb_refstate mb_log.bin mb_refstate.json

Actual results:
Segmentation fault (core dumped)

Expected results:
The scripts execute normally and the output file mb_refstate.json is created

Additional info:
Initially reported upstream as https://github.com/keylime/keylime/issues/1153

Comment 21 errata-xmlrpc 2023-05-09 07:45:11 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (keylime bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:2307