Skip to content

a visual toolkit for exploring and editing firmware images, running on web platforms

License

Notifications You must be signed in to change notification settings

Thrilleratplay/utk-web

 
 

Repository files navigation

UTK Web ⚙️

This is a web tool rendering UEFI firmware images visually.

utk-web screenshot

Usage

Currently, there are the following types of pages (views):

  • UEFI explorer
  • PSP explorer

See also TODO and Features.

Running utk-web

You need to have a Node.js runtime and npm installed. Find them in your respective OS distribution and install them through your package manager, e.g., yay -S nodejs npm.

Installing dependencies

The project depends on a handful of packages from the npm registry. Run the following to install them or update when pulling the utk-web repository:

npm install

Running utk-web

npm start

Then open http://localhost:3000 in a web browser.

Build static pages for deployment

npm run build

This will generate a directory out/ which you can put on a web server under the path /utk-web for static serving. The configuration file next.config.js determines that path. You can adjust it or remove the path according to your setup.

Generating Fixtures

To generate the fixtures for the respective view, you need to have the following CLI tools installed:

By convention, the fixtures need to have specific names. Here is how to generate them for a given firmware image. FIRMWARE_IMAGE be the path to the image file and FIRMWARE_IMAGE_NAME the name for it to use in utk-web:

  • utk "${FIRMWARE_IMAGE}" json > "src/fixtures/${FIRMWARE_IMAGE_NAME}.json"
  • fmap jusage "${FIRMWARE_IMAGE}" > "src/fixtures/${FIRMWARE_IMAGE_NAME}.fmap.json"
  • psptool --json "${FIRMWARE_IMAGE}" > "src/fixtures/${FIRMWARE_IMAGE_NAME}.psp.json"
  • uefi-firmware-parser --brute --json "${FIRMWARE_IMAGE}" > "src/fixtures/${FIRMWARE_IMAGE_NAME}.ufp.json"

For convenience, there is a script: Run ./genfixtures.sh ${FIRMWARE_IMAGE}, supplying the path to your firmware image as the argument, to generate the respective fixtures from the image file.

WIP

The following are not yet supported by upstream nor utk-web, but planned:

You would do the following (given the subcommands/switches will not change):

  • mftcli "${FIRMWARE_IMAGE}" json > "src/fixtures/${FIRMWARE_IMAGE_NAME}.mft.json"

Creating Pages

There are templates for the available kinds of pages in src/templates/. Simply copy them to src/pages/${FIRMWARE_IMAGE_NAME}.*.jsx, replace the placeholders with the paths to the respective fixtures, and add links to the pages to the src/pages/index.jsx page to be able to navigate to them from the root page.

For convenience, there is a script: Run ./genpages.sh ${FIRMWARE_IMAGE_NAME}, supplying the name of your firmware image as the argument, to generate the respective pages from the templates. However, you still need to manually add the links to src/pages/index.jsx.

TODO: autogenerate pages from fixtures

FAQ

Is there demand?

Yes.

Are there similar GUI tools?

There are proprietary, closed source, non-public tools limited to few platforms, which are licensed by IBVs for OEMs under contract, such as AMI's Aptio Utilities.

How does UEFI work?

Here's a picture of the boot flow from the TianoCore/EDK2 wiki:

UEFI boot flow

Is UEFI complicated?

The UEFI 2.6 spec is 2706 pages long. The ACPI 6.3 Errata A spec comprises 1062 pages. The Platform Initialization spec consists of 1541 pages.

Is there research on UEFI implementations?

Yes. See https://depletionmode.com/uefi-boot.html for a decent introduction.

SentinelLabs have started a decent blog post series on the practical side of interfacing with firmware on real hardware.

How are UEFI images created?

See https://edk2-docs.gitbook.io/edk-ii-build-specification/2_design_discussion/22_uefipi_firmware_images .

Do UEFI images contain more than just the UEFI firmware?

Yes. On Intel platforms, (CS)ME and ethernet adapter firmware is included, and likewise, PSP firmware on AMD platforms. This tool can already visualize output from PSPTool. Depending on OEMs and boards, EC firmware may also be included.

What is a typical UEFI firmware layout?

Full firmware images consist of regions. Intel uses the IFD (Intel Flash Descriptor), while AMD has FET (Firmware Entry Table) at the highest level. The PI specification further partiotions UEFI regions into Firmware Volumes (FVs), which can be compared to directories in common file systems like FAT. Similarly, PSP and ME have their own formats again, hence different tools are needed.

How can the behavior of the binaries be analyzed?

There are a few projects with a focus on binary analysis, such as efiXplorer, an IDA plugin.

Static analysis is possible to a certain degree, given that UEFI images contain many binary pieces. Especially dependencies in UEFI are hard to evaluate. For this reason, utk-web for now only prints out DepEx declaration sections, but you can select their GUIDs to see other occurences. Find more details in the DepEx FAQ.

Can DXE drivers be analyzed at runtime?

Sort of.

What is the maximum number of DXE drivers seen on a device in the wild?

AFAIK, close to 1k, nine-hundred-something.

Features

  • display used firmware volumes (FVs) as sections
  • uefi-firmware-parser support
  • flattened UEFI sections
  • expand / shrink large sections
  • mark GUID, highlighted globally
  • mark any blob card (no further functionality yet)
  • display flash usage as reported by fmap (in a side panel)
  • visualize PSPTool output
    • sections ("directories") and entries
    • display indicators for properties like verified, signed, packed etc
    • mark blocks used by an entry when hovering its card

TODO

  • mark BootGuard protected regions
  • load utk as in-browser back-end through WASM
  • load fmap as in-browser back-end through WASM
  • load mftcli as in-browser back-end through WASM
  • load UEFITool CLI tools as in-browser back-end through WASM

Development / Contribution

This project is based on the Next.js application framework. It contains a few widgets (UI components) to render UEFI data structures. If you would like to contribute, have ideas, etc, please feel free to create issues on GitHub and/or open pull requests. Any form of contribution is highly appreciated. As this tool is meant to be a GUI (by now :)), usability feedback is very important and welcome.

About

a visual toolkit for exploring and editing firmware images, running on web platforms

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 97.7%
  • Shell 1.8%
  • Makefile 0.5%