Skip to main content

UEFI variable store tools

Project description

uefivars

This is a set of Python modules and a helper application "uefivars" to introspect and modify UEFI variable stores.

Why do I need this?

UEFI variable stores are typically opaque to users. You access them using UEFI runtime services as function calls. However, the data is then stored in a binary data format. When running virtual machines or extracting UEFI variable stores directly from Flash storage, you can receive and write that binary data and thus modify variables directly.

This is useful in situations where you have incorrect UEFI variable data and need to modify variables without runtime service access. It can also be useful to analyze and introspect the variable store and check what data is stored inside.

How do I use it?

You can convert a variable store into human readable format by setting the output type to json. This will show you all variables that are currently present in the variable store.

$ uefivars -i edk2 -o json -I OVMF_VARS.secboot.fd
[
    {
        "name": "SecureBootEnable",
        "data": "AQ==",
        "guid": "f0a30bc7-af08-4556-99c4-001009c93a44",
        "attr": 3
    },
    [...]
]

In addition, you can convert from the human readable json representation back into edk2 format:

$ uefivars -i json -o edk2 -I vars.json -O OVMF_VARS.fd

Given any variable store (including an empty one) the --PK , --KEK , --db and --dbx switches can be used to (over-)write the four SecureBoot variables from input files. (Usually .esl files). For a general rundown of the key generation process the ArchLinux wiki has proven itself as a first point of guidance.

You can also use the tool to convert between the AWS EC2 uefi-data format and edk2 to import and export UEFI variable stores between an EC2 instance and QEMU:

$ uefivars -i edk2 -o aws -I OVMF_VARS.fd -O uefi-data.aws
$ uefivars -i aws -o edk2 -I uefi-data.aws -O OVMF_VARS.fd

How can I take a snapshot of my current UEFI variable store?

If you are running on a live UEFI system, the variable store that gets exposed to the Operating System is incomplete: It does not contain UEFI variables that are only present at boot time and it does not get access to variable authentication data.

If you don't need either - for example because you're only interested in saving the boot order - you can use the efivarfs backend to convert the local variable store into a file:

$ uefivars -i efivarfs -o aws -I /sys/firmware/efi/efivars -O uefi-data.aws

What formats are supported?

This package currently supports the following formats:

aws - File format used in AWS EC2
edk2 - File format used for flash storage in OVMF
efivarfs - Ingests all non-authenticated variables from an efivarfs mount point (read only)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uefivars-1.2.tar.gz (26.4 kB view details)

Uploaded Source

Built Distribution

uefivars-1.2-py3-none-any.whl (27.2 kB view details)

Uploaded Python 3

File details

Details for the file uefivars-1.2.tar.gz.

File metadata

  • Download URL: uefivars-1.2.tar.gz
  • Upload date:
  • Size: 26.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for uefivars-1.2.tar.gz
Algorithm Hash digest
SHA256 415b1726a0ba83659b695fb500b6994d843603144b2c82036ddc35e58d750b74
MD5 cf834df13512b27eb55b906150c3c38d
BLAKE2b-256 70f5589ce6fcd5d2feac681978dedc252389dfb139b8108114102158302ba968

See more details on using hashes here.

File details

Details for the file uefivars-1.2-py3-none-any.whl.

File metadata

  • Download URL: uefivars-1.2-py3-none-any.whl
  • Upload date:
  • Size: 27.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for uefivars-1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 29f3a126808b8588d78d7df15ecfbbc35f2182e0b9cecc8bd4149f2b107bf7ca
MD5 5cf44b23e68b3e7ea563872b67503c7e
BLAKE2b-256 14eaa3ec573f071d31b6e95521b94d29632bc210ad4a1a848441511cda56e1ae

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page