Bug 1570980 - dbxtool fails to parse UEFI signature database (patch included)
Summary: dbxtool fails to parse UEFI signature database (patch included)
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: dbxtool
Version: 27
Hardware: Unspecified
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Peter Jones
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-04-23 21:58 UTC by Michal Růžička
Modified: 2018-11-30 21:38 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-11-30 21:38:39 UTC
Type: Bug


Attachments (Terms of Use)
Patch fixing UEFI Signature List iteration (3.13 KB, patch)
2018-04-23 21:58 UTC, Michal Růžička
no flags Details | Diff
Patch fixing UEFI Signature List iteration (3.13 KB, patch)
2018-04-25 10:13 UTC, Michal Růžička
no flags Details | Diff


Links
System ID Priority Status Summary Last Updated
Red Hat Bugzilla 1508808 None CLOSED dbxtool service fails to start - EFI Signature List is malformed 2019-03-26 11:40:04 UTC

Internal Links: 1508808

Description Michal Růžička 2018-04-23 21:58:11 UTC
Created attachment 1425753 [details]
Patch fixing UEFI Signature List iteration

Description of problem:
The dbxtool fails to display the content of the UEFI signature database (db) on my system when invoked like this:
  dbxtool --list --dbx /sys/firmware/efi/efivars/db-d719b2cb-3d3a-4596-a3bc-dad00e67656f 

Version-Release number of selected component (if applicable):
8-3.fc27

How reproducible:
Always

Steps to Reproduce:
1. login to a system with more than one entry in its UEFI signature database (db)
2. run the following command while replacing the <guid> with a signature database GUID specific to your system:
  dbxtool --list --dbx /sys/firmware/efi/efivars/db-<guid>

Actual results:
Only the first entry is printed, after which an error is reported:
   1: {microsoft} {x509_cert} <certificate hex dump here>
dbxtool: EFI Signature List is malformed
dbxtool: list has 3991 bytes left, element is 1543 bytes

Expected results:
All entries are printed, no error is reported.

Additional info:
The problem seems to be in the EFI signature list iterator's esl_iter_next function. The attached patch
fixes it for me.

Comment 1 Michal Růžička 2018-04-25 10:13:21 UTC
Created attachment 1426574 [details]
Patch fixing UEFI Signature List iteration

Improved version of the patch with more appropriate validation.

Comment 2 Michal Růžička 2018-05-03 13:53:58 UTC
The bug is still present in Fedora 28.

Comment 3 Laszlo Ersek 2018-05-16 14:12:36 UTC
Hi Michal,

I've just found out about this BZ -- it looks like a duplicate of earlier bug 1508808. Fixing the issue is actually possible with a one-liner (more precisely: a one *character*) patch. Can you please check if the scratch builds in bug 1508808 comment 25 work for you? If they do, I suggest that we close bug 1570980 (i.e., this bug) as a duplicate of bug 1508808.

Thank you,
Laszlo

Comment 4 Michal Růžička 2018-05-17 20:16:29 UTC
Hi Laszlo,

the scratch build does fix the problem for me.

However as things stand now, the previously broken check is not performed for the very first element in the list.
In addition the X.509 certificate ASN.1 check performed just below the previously broken check - [1], is AFAICT duplicated by an identical check in the esd_iter_next function - [2].

My patch addresses both of these issues, so it might be worth considering using it in preference to the one liner from bug 1508808.

Thanks,
Michal

[1] https://github.com/rhboot/dbxtool/blob/338a2d097b79faba9505a913c2cfc5916b6ffa9a/src/iter.c#L231-L248
[2] https://github.com/rhboot/dbxtool/blob/338a2d097b79faba9505a913c2cfc5916b6ffa9a/src/iter.c#L104-L120

Comment 5 Laszlo Ersek 2018-05-18 11:25:35 UTC
OK, thanks for the feedback. Both BZs are now cross-referenced, so Peter should find them both regardless of which one he checks out first. Feel free to comment on the other BZ as well, of course! Peter should decide which BZ to close as the duplicate of the other.

Thank you!
Laszlo

Comment 6 Ben Cotton 2018-11-27 15:40:52 UTC
This message is a reminder that Fedora 27 is nearing its end of life.
On 2018-Nov-30  Fedora will stop maintaining and issuing updates for
Fedora 27. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora  'version' of '27'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 27 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 7 Ben Cotton 2018-11-30 21:38:39 UTC
Fedora 27 changed to end-of-life (EOL) status on 2018-11-30. Fedora 27 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.