Skip to content

Instantly share code, notes, and snippets.

@Zibri
Last active August 7, 2024 01:26
Show Gist options
  • Save Zibri/19f9838ffd12349bb2c6c3afddc9388f to your computer and use it in GitHub Desktop.
Save Zibri/19f9838ffd12349bb2c6c3afddc9388f to your computer and use it in GitHub Desktop.
UEFIVAR
An "italian" army knife to manage UEFI variables in Windows.
V1.2 (C) 2019 by Zibri http://www.zibri.org
UEFIVAR [-l] [-sg] [-sn] [-G:"GUID"] [-N:"NAME"] [-hd] [-bd[[:]["filename"]]] [-D] [-WB64:b64data]
[-A:"ATTRIBUTES"] [-b64[[:]["filename"]]] [-I:"filename"] [-i:"filename"] [-WHEX:hexstring]
[-APPEND] [-h] [-m]
-l Lists all UEFI variables.
-l -sg Sorts variables by their GUIDs.
-l -sn Sorts variables by their names.
-G:"GUID" Specifies the variable GUID.
-N:"Name" Specifies the variable name.
-A:"xx" Specifies the variable attribute.
-hd Dumps the content of the variable(s) in Hex.
-bd[[:]["filename"]] Dumps the content of the variable(s) in Binary file.
-b64[[:]["filename"]] Dumps the content of the variable(s) in Base64.
-I:"fname" Imports from binary or base64 file (need GUID and NAME).
-i:"fname" Imports from binary or base64 file (using filename).
-D Deletes the variable (DANGEROUS!)
-WB64:"b64data" Writes the variable data (creating the variable if needed).
-WHEX:"hex string" Writes the variable data (creating the variable if needed).
-APPEND Appends the data to the existing variable.
-h/-H Show this help sheet.
-m/-M Manual with examples.
-z Donate (please donate more than $2 or PayPal will take it all)
An "italian" army knife to manage UEFI variables in Windows.
V1.2 (C) 2019 by Zibri http://www.zibri.org
UEFIVAR [-l [-sg] [-sn]] [-G:"GUID"] [-N:"NAME"] [-hd] [-bd[[:]["filename"]]] [-D] [-WB64:b64data]
[-A:"ATTRIBUTES"] [-b64[[:]["filename"]]] [-I:"filename"] [-i:"filename"] [-WHEX:hexstring]
[-APPEND] [-h] [-m]
Examples:
uefivar -l -bd Dumps all UEFI variables in binary format in the current directory.
uefivar -l -hd Hex-dumps all UEFI variables in the current console.
uefivar -l -b64 Dumps all UEFI variables in base64 format in the current console.
uefivar -l -b64: Dumps all UEFI variables in base64 format in the current directory.
Dump a variable on screen in hex:
uefivar -G:"8be4df61-93ca-11d2-aa0d-00e098032b8c" -N:"BootCurrent" -hd
Dump a variable on screen in base64:
uefivar -G:"8be4df61-93ca-11d2-aa0d-00e098032b8c" -N:"BootCurrent" -b64
Dump a variable on disk in binary and automatic name:
uefivar -G:"8be4df61-93ca-11d2-aa0d-00e098032b8c" -N:"BootCurrent" -bd
Dump a variable on disk in binary and custom name:
uefivar -G:"8be4df61-93ca-11d2-aa0d-00e098032b8c" -N:"BootCurrent" -bd:"bc.bin"
Import a variable from binary file (automatic):
uefivar -i:"8be4df61-93ca-11d2-aa0d-00e098032b8c-BootCurrent (BS+RT).bin"
Create a variable (base64):
uefivar -G:"12345678-1234-1234-1234-123456789012" -N:"Zibri" -WB64:"AQ==" -A:"NV"
Create a variable (hex):
uefivar -G:"12345678-1234-1234-1234-123456789012" -N:"Zibri" -WHEX:"01020304" -A:"NV"
Delete a variable:
uefivar -G:"12345678-1234-1234-1234-123456789012" -N:"Zibri" -D
Automatic import from disk of a saved binary variable:
uefivar -i:"12345678-1234-1234-1234-123456789012-Zibri (NV+BS+RT).bin"
Dump a variable on disk in base64 automatic mode:
uefivar -G:"12345678-1234-1234-1234-123456789012" -N:"Zibri" -b64:
Manual import of a variable saved in an arbitrary binary file:
uefivar -G:"12345678-1234-1234-1234-123456789012" -N:"Zibri" -I:"zibri.bin"
@Elentirith
Copy link

I got the "variable does not exist" error and it was in windows cmd.exe. I just wanted to see what the folder names were in EFI so I can tell windows which boot file to use so it stops overwriting it (dual boot linux/windows). Here's the output if you find it useful:

C:\WINDOWS\system32>uefivar -G:"8be4df61-93ca-11d2-aa0d-00e098032b8c" -N:"BootCurrent" -hd
8be4df61-93ca-11d2-aa0d-00e098032b8c-BootCurrent
variable does not exist

@littlefooch
Copy link

First of all, kudos to Zibri for even thinking of building this utility. No one realizes how many features/functions are blocked on Windows by UEFI variables (yeah like MacOS NVRAM, Windows has NVRAM too). If just one of these variables is hosed, you lose your ethernet adapters (gone from Device Manager) for no obvious reason. Tons of Thunderbolt issues posted on the web could be easily solved if Windows users realized that resetting the NVRAM would return the Thunderbolt device and function.

Do you have any idea how many motherboards and Thunderbolt AIC's have been returned as 'defective' only to be the unknowing victim of UEFI/NVRAM variables that needed to be reset.

Right now, the only way to reset the NVRAM in Windows is to clear the BIOS using the motherboard jumpers (how convenient) or by reflashing an existing BIOS which also clears the NVRAM.

I can't wait to try this, THANKS ZIBRI

@Zibri
Copy link
Author

Zibri commented Aug 24, 2021

First of all, kudos to Zibri for even thinking of building this utility. No one realizes how many features/functions are blocked on Windows by UEFI variables (yeah like MacOS NVRAM, Windows has NVRAM too). If just one of these variables is hosed, you lose your ethernet adapters (gone from Device Manager) for no obvious reason. Tons of Thunderbolt issues posted on the web could be easily solved if Windows users realized that resetting the NVRAM would return the Thunderbolt device and function.

Do you have any idea how many motherboards and Thunderbolt AIC's have been returned as 'defective' only to be the unknowing victim of UEFI/NVRAM variables that needed to be reset.

Right now, the only way to reset the NVRAM in Windows is to clear the BIOS using the motherboard jumpers (how convenient) or by reflashing an existing BIOS which also clears the NVRAM.

I can't wait to try this, THANKS ZIBRI

Thanks for your words. They made my day. Really, thanks for taking the time to write them.

The only limit of this program is that as you probably know some variables can only be modiefied in an EFI shell before the OS is loaded.
But at least with UEFIVAR you can do everything you normally can do on linux.

And yes, f*cking up some variables can cause any kind of problem but "most" of the can be solved by reflashing the BIOS... but be carefull because if something is really f°cked up then the bios could go into a boot loop and the only way to recover the computer will be to physically reflash the eeprom. (which already happened to me twice)

@sandeepansg
Copy link

I am 2 years too late to discover this awesome tool, thanks @Zibri for making it.

I have pretty straight forward requirement, but kinda lost.
I want to rename boot variables so that I can understand which one is which when booting from BIOS/UEFI.

Like renaming one of many 'Windows Boot Manager' to 'Windows 10 faulty' and things like that.
Any help ?

@Tachi107
Copy link

Tachi107 commented Jan 3, 2023

Hey @Zibri, thank you very much for this tool. You've mentioned a couple of times that more advanced use cases would need usage of the UEFI Shell, but I can't find information about how to launch it on my machine. Do you have any idea how I could invoke it? Thanks again :)

@Zibri
Copy link
Author

Zibri commented Jan 4, 2023

@Tachi107 it depends on your system BIOS AND your OS... a quick way is to install refind and find a suitable "shell.efi" for your system.. then you can just run "shell.efi" from bios even without refind.
But be very careful to what you do, because you can seriously mess up your system.

@Tachi107
Copy link

Tachi107 commented Jan 4, 2023 via email

@darkotr85
Copy link

Hello,

I just discovered this tool.
Is it possible to extract, let's say, boot logo (bmp) and replace with another one in EFI image (not BIN)?

@Zibri
Copy link
Author

Zibri commented Oct 27, 2023

@zhangyoufu

  1. you are not very clever and very bad at reverisng software.
  2. the http request is just for statistics.
  3. it has been obfucated only to make it more difficult to be used as a "weapon".
  4. nobody cares if one paranoid does not use it. Hundreds of downloads prove otherwise.

@aesdae
Copy link

aesdae commented Apr 2, 2024

This is malware.

@Zibri
Copy link
Author

Zibri commented Apr 9, 2024

This is malware.

NO, THIS IS NOT.
And this kind of comments is what you get when you offer something for free to morons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment