[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6ADTGSV7A93WE3X0P7K7ZTE":3,"skill-same:01M6ADTGSV7A93WE3X0P7K7ZTE":109},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":43,"linkOnly":44,"markdownContent":45,"markdownBody":46,"frontMatter":47,"refName":68,"commitSha":69,"skillDirectory":70,"forksCount":71,"repositoryHtmlUrl":72,"repositoryHomepageUrl":73,"ownerHtmlUrl":74,"ownerBlogUrl":75,"ownerDescription":76,"updatedAt":77,"install":78,"resources":91},"01M6ADTGSV7A93WE3X0P7K7ZTE","analyzing-uefi-bootkit-persistence",null,"Analyzes UEFI bootkit persistence (SPI flash implants, ESP modifications, Secure Boot bypass, UEFI variable manipulation) using chipsec for firmware integrity verification, detecting known families like BlackLotus, LoJax, and MoonBounce. Use for UEFI malware analysis, firmware persistence investigation, or Secure Boot bypass detection.","mukul975\u002FAnthropic-Cybersecurity-Skills","mukul975","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F42860185?v=4","01M6ADEQR8T5M4EEG6C67BQCWF","Mahipal","01M6ADJPMYWG1E5GM1FWBE3128",36078,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fanalyzing-uefi-bootkit-persistence\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42],"analyzing uefi bootkit persistence","analyzing","persistence","UEFI","bootkit","malware analysis","ESP","chipsec","Secure-Boot","firmware","malware","security","monitoring","verification","code","boot","pr","secure","cybersecurity","2026-11-10 10:12:30",false,"---\nname: analyzing-uefi-bootkit-persistence\ndescription: 'Analyzes UEFI bootkit persistence (SPI flash implants, ESP modifications,\n  Secure Boot bypass, UEFI variable manipulation) using chipsec for firmware integrity\n  verification, detecting known families like BlackLotus, LoJax, and MoonBounce.\n  Use for UEFI malware analysis, firmware persistence investigation, or Secure Boot\n  bypass detection.\n\n  '\ndomain: cybersecurity\nsubdomain: firmware-security\ntags:\n- UEFI\n- bootkit\n- firmware\n- Secure-Boot\n- chipsec\n- ESP\n- persistence\nversion: 1.0.0\nauthor: mukul975\nlicense: Apache-2.0\nd3fend_techniques:\n- Platform Hardening\n- Restore Object\n- Platform Monitoring\n- Firmware Verification\n- Firmware Embedded Monitoring Code\nnist_csf:\n- ID.RA-01\n- PR.PS-01\n- PR.PS-02\nmitre_attack:\n- T1542.001\n- T1542.003\n- T1553.006\n- T1542\n- T1014\n---\n\n# Analyzing UEFI Bootkit Persistence\n\n## When to Use\n\n- A compromised system re-establishes C2 communication after OS reinstallation or disk replacement\n- Secure Boot has been tampered with, disabled, or shows unexpected Machine Owner Key (MOK) enrollment\n- Firmware integrity verification fails against vendor-provided baselines\n- Memory forensics reveals rootkit components loading during early boot phase\n- Investigating advanced persistent threat (APT) campaigns known to deploy UEFI implants\n- Auditing firmware security posture for enterprise endpoint hardening\n\n**Do not use** for standard MBR-based bootkits on legacy BIOS systems without UEFI; use MBR\u002FVBR bootkit analysis instead.\n\n## Prerequisites\n\n- chipsec framework for SPI flash dumping, UEFI variable inspection, and firmware security modules\n- UEFITool \u002F UEFIExtract for firmware volume parsing and DXE driver extraction\n- Python 3.8+ with struct, hashlib, subprocess, and os modules\n- Bootable Linux live USB for offline analysis (avoid running compromised OS)\n- Volatility 3 for memory forensics of boot-phase artifacts\n- YARA with UEFI malware rule sets for pattern-based detection\n- Access to vendor firmware baselines for integrity comparison\n\n## Workflow\n\n### Step 1: Dump SPI Flash Firmware\n\nAcquire the UEFI firmware from the SPI flash chip for offline analysis:\n\n```bash\n# Using chipsec to dump SPI flash contents\npython chipsec_util.py spi dump firmware_dump.rom\n\n# Using flashrom as an alternative\nflashrom -p internal -r firmware_dump.rom\n\n# Verify dump integrity\nsha256sum firmware_dump.rom\n\n# Read SPI flash descriptor information\npython chipsec_util.py spi info\n\n# Check SPI flash region access permissions\npython chipsec_main.py -m common.spi_access\n\n# Verify BIOS write protection is enabled\npython chipsec_main.py -m common.bios_wp\n\n# Check SPI flash controller lock\npython chipsec_main.py -m common.spi_lock\n```\n\n### Step 2: Inspect UEFI Variables\n\nEnumerate and analyze UEFI variables for unauthorized modifications:\n\n```bash\n# List all UEFI variables on a live system\npython chipsec_util.py uefi var-list\n\n# List UEFI variables from a SPI flash dump\npython chipsec_util.py uefi var-list-spi firmware_dump.rom\n\n# Read specific Secure Boot variables\npython chipsec_util.py uefi var-read SecureBoot 8BE4DF61-93CA-11D2-AA0D-00E098032B8C\npython chipsec_util.py uefi var-read SetupMode 8BE4DF61-93CA-11D2-AA0D-00E098032B8C\npython chipsec_util.py uefi var-read PK 8BE4DF61-93CA-11D2-AA0D-00E098032B8C\npython chipsec_util.py uefi var-read KEK 8BE4DF61-93CA-11D2-AA0D-00E098032B8C\npython chipsec_util.py uefi var-read db D719B2CB-3D3A-4596-A3BC-DAD00E67656F\n\n# Dump UEFI key databases for analysis\npython chipsec_util.py uefi keys\n\n# Check Secure Boot configuration module\npython chipsec_main.py -m common.secureboot.variables\n```\n\n### Step 3: Analyze EFI System Partition (ESP)\n\nInspect the ESP for unauthorized or modified boot components:\n\n```bash\n# Mount ESP (typically the first FAT32 partition, ~100-500MB)\nmkdir \u002Fmnt\u002Fesp\nmount \u002Fdev\u002Fsda1 \u002Fmnt\u002Fesp\n\n# List all files on ESP with timestamps\nfind \u002Fmnt\u002Fesp -type f -exec ls -la {} \\;\n\n# Check for BlackLotus indicators - custom directory under ESP:\u002Fsystem32\u002F\nls -la \u002Fmnt\u002Fesp\u002Fsystem32\u002F 2>\u002Fdev\u002Fnull\n\n# Verify Windows Boot Manager signature\nsigcheck -a \u002Fmnt\u002Fesp\u002FEFI\u002FMicrosoft\u002FBoot\u002Fbootmgfw.efi\n\n# Hash all EFI binaries for comparison against known-good values\nfind \u002Fmnt\u002Fesp -name \"*.efi\" -exec sha256sum {} \\;\n\n# Check for unauthorized .efi files outside standard directories\nfind \u002Fmnt\u002Fesp -name \"*.efi\" | grep -v \"Microsoft\\|Boot\\|ubuntu\\|grub\"\n\n# Look for grubx64.efi planted by BlackLotus\nfind \u002Fmnt\u002Fesp -name \"grubx64.efi\" -exec sha256sum {} \\;\n\n# Examine MeasuredBoot logs for anomalies (Windows)\n# Logs located at C:\\Windows\\Logs\\MeasuredBoot\\\n```\n\n### Step 4: Scan Firmware for Known Bootkit Signatures\n\nAnalyze the firmware dump for known UEFI malware patterns:\n\n```bash\n# Extract all firmware modules with UEFIExtract\nUEFIExtract firmware_dump.rom all\n\n# Generate firmware module whitelist from vendor baseline\npython chipsec_main.py -m tools.uefi.whitelist -a generate,baseline.json,firmware_vendor.rom\n\n# Compare current firmware against whitelist\npython chipsec_main.py -m tools.uefi.whitelist -a check,baseline.json,firmware_dump.rom\n\n# Scan firmware with UEFI-specific YARA rules\nyara -r uefi_bootkits.yar firmware_dump.rom\n\n# Scan extracted modules individually\nfind firmware_dump.rom.dump -name \"*.efi\" -exec yara -r uefi_bootkits.yar {} \\;\n\n# Check for modified CORE_DXE module (targeted by MoonBounce, CosmicStrand)\n# Compare GUID and hash against vendor baseline\n```\n\n### Step 5: Detect Secure Boot Bypass Mechanisms\n\nCheck for known Secure Boot bypass techniques:\n\n```bash\n# Check if Secure Boot is enabled\npython chipsec_main.py -m common.secureboot.variables\n\n# Verify SMM (System Management Mode) protections\npython chipsec_main.py -m common.smm\n\n# Check SMM BIOS write protection\npython chipsec_main.py -m common.bios_smi\n\n# On Windows - check boot configuration for bypass indicators\nbcdedit \u002Fenum firmware\nbcdedit \u002Fv\n\n# Check for testsigning\u002Fnointegritychecks\u002Fdebug flags\nbcdedit | findstr \u002Fi \"testsigning nointegritychecks debug\"\n\n# Verify HVCI (Hypervisor-enforced Code Integrity) is not disabled\n# BlackLotus sets HKLM:\\...\\DeviceGuard\\...\\HypervisorEnforcedCodeIntegrity Enabled=0\nreg query \"HKLM\\SYSTEM\\CurrentControlSet\\Control\\DeviceGuard\\Scenarios\\HypervisorEnforcedCodeIntegrity\" \u002Fv Enabled\n\n# Check Secure Boot state via PowerShell\n# Confirm-SecureBootUEFI returns True if properly enabled\n```\n\n### Step 6: Perform Boot Chain Integrity Verification\n\nVerify every component in the boot chain from firmware through kernel:\n\n```bash\n# Verify firmware integrity against vendor hash\nsha256sum firmware_dump.rom\n# Compare with vendor-published hash\n\n# Verify bootloader signatures\nsigcheck -a C:\\Windows\\Boot\\EFI\\bootmgfw.efi\nsigcheck -a C:\\Windows\\System32\\winload.efi\nsigcheck -a C:\\Windows\\System32\\ntoskrnl.exe\n\n# Check for unsigned or invalid boot drivers\nsigcheck -u -e C:\\Windows\\System32\\drivers\\\n\n# Analyze Measured Boot logs for unexpected EFI_Boot_Services_Application entries\n# BlackLotus components appear as EV_EFI_Boot_Services_Application\n\n# Memory forensics for boot-phase artifacts\nvol3 -f memory.dmp windows.modules\nvol3 -f memory.dmp windows.driverscan\n```\n\n### Step 7: Document UEFI Bootkit Analysis Findings\n\nCompile a comprehensive analysis report:\n\n```\nReport should include:\n- Firmware version, vendor, and platform identification\n- SPI flash protection status (write protect, lock bits, access control)\n- Secure Boot configuration and any bypass indicators detected\n- UEFI variable anomalies (unauthorized keys, modified db\u002Fdbx, MOK enrollment)\n- ESP contents inventory with hash verification against known-good baselines\n- Firmware module comparison against vendor whitelist (added, modified, removed)\n- Known bootkit family attribution with confidence level\n- Boot chain integrity verification results for each component\n- Remediation steps (reflash, key rotation, hardware replacement)\n- MITRE ATT&CK mapping (T1542.001 - System Firmware, T1542.003 - Bootkit)\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| **UEFI Bootkit** | Malware that persists in UEFI firmware or the boot process, executing before the operating system loads and surviving OS reinstallation |\n| **SPI Flash** | Serial Peripheral Interface flash memory chip on the motherboard storing UEFI firmware; firmware-level bootkits like LoJax and MoonBounce modify SPI flash contents |\n| **EFI System Partition (ESP)** | FAT32 partition containing EFI bootloaders and drivers; bootkits like BlackLotus and ESPecter modify files on the ESP for persistence |\n| **Secure Boot** | UEFI security feature that verifies digital signatures of boot components; can be bypassed via vulnerabilities (CVE-2022-21894) or MOK enrollment |\n| **DXE Driver** | Driver Execution Environment driver loaded during UEFI boot; firmware implants inject malicious DXE drivers that execute before the OS |\n| **Machine Owner Key (MOK)** | User-installable Secure Boot key; BlackLotus enrolls attacker-controlled MOKs to sign malicious bootloaders |\n| **chipsec** | Intel platform security assessment framework for analyzing SPI flash, UEFI variables, Secure Boot, and hardware security configurations |\n| **HVCI** | Hypervisor-enforced Code Integrity, a Windows security feature that bootkits disable to load unsigned kernel drivers |\n\n## Tools & Systems\n\n- **chipsec**: Intel framework for dumping SPI flash, reading UEFI variables, verifying firmware write protection, and Secure Boot configuration auditing\n- **UEFITool**: Open-source UEFI firmware image parser for inspecting firmware volumes, extracting DXE drivers, and comparing module GUIDs\n- **sigcheck**: Sysinternals utility for verifying digital signatures of EFI binaries and boot chain components\n- **flashrom**: Open-source SPI flash programmer for reading and writing firmware chips on supported platforms\n- **YARA**: Pattern matching engine used with UEFI-specific rule sets to detect known bootkit signatures in firmware dumps\n\n## Common Scenarios\n\n### Scenario: Investigating Persistent Compromise Surviving OS Reinstallation\n\n**Context**: An enterprise endpoint was reimaged after a confirmed breach, but identical C2 beaconing resumed within hours. The endpoint has UEFI firmware with Secure Boot enabled, and a TPM 2.0 chip. The security team suspects a UEFI-level implant similar to BlackLotus or LoJax.\n\n**Approach**:\n1. Boot the system from a trusted Linux live USB to avoid executing any compromised OS components\n2. Dump SPI flash firmware using `chipsec_util.py spi dump` for offline analysis\n3. Mount the ESP and hash all `.efi` files for comparison against known-good values from identical hardware\n4. Check for the `ESP:\u002Fsystem32\u002F` directory (BlackLotus indicator) and unauthorized `grubx64.efi`\n5. Extract firmware modules with UEFIExtract and compare GUID inventory against vendor baseline\n6. Verify Secure Boot variables -- look for unauthorized MOK enrollment or modified db\u002Fdbx\n7. Check SPI flash write protection and lock bits using chipsec modules\n8. Scan firmware dump and extracted modules with UEFI-specific YARA rules\n9. If BlackLotus is suspected, check registry for HVCI disabled and MeasuredBoot logs for anomalous entries\n\n**Pitfalls**:\n- Running analysis from the compromised OS (rootkit components hide from live analysis)\n- Only checking the ESP without examining SPI flash firmware (misses firmware-level implants like LoJax, MoonBounce)\n- Assuming Secure Boot prevents all bootkits (CVE-2022-21894 and other bypasses exist)\n- Not preserving the original firmware dump before remediation (critical forensic evidence)\n- Reflashing firmware without verifying the vendor image is authentic and unmodified\n\n## Output Format\n\n```\nUEFI BOOTKIT PERSISTENCE ANALYSIS REPORT\n============================================\nSystem:           Lenovo ThinkPad X1 Carbon Gen 11\nFirmware:         N3HET82W (1.54) - Lenovo UEFI BIOS\nPlatform:         Intel 13th Gen (Raptor Lake)\nTPM:              2.0 (Infineon SLB 9672)\nSecure Boot:      ENABLED (BYPASSED via CVE-2022-21894)\nAnalysis Method:  Linux live USB + chipsec + UEFITool\n\nSPI FLASH PROTECTION STATUS\nBIOS Write Protection:    DISABLED [!]\nSPI Flash Lock (FLOCKDN): SET [OK]\nSMM BIOS Write Protect:   DISABLED [!]\nSPI Protected Ranges:     Region 0 only (descriptor)\n\nUEFI VARIABLE ANALYSIS\nSecureBoot:        Enabled (value=1)\nSetupMode:         Disabled (value=0)\nPK:                Lenovo Ltd. (legitimate)\nKEK:               Microsoft + Lenovo (legitimate)\ndb:                MODIFIED - contains unauthorized entry [!]\n  [!] Unknown certificate: CN=Secure Boot Signing, O=Unknown\n  [!] Not present in vendor baseline db\nMOK:               1 unauthorized key enrolled [!]\n  [!] MOK enrolled: CN=shim, self-signed, not from distro vendor\n\nESP PARTITION ANALYSIS\nTotal EFI binaries:     12\nVerified (signed):      9\nModified (hash mismatch): 2 [!]\nUnauthorized:           1 [!]\n\n  [!] EFI\u002FMicrosoft\u002FBoot\u002Fbootmgfw.efi - MODIFIED\n      Expected SHA-256: a3f2c8...\n      Current SHA-256:  7b1e4d...\n      Signature:        Valid (signed with unauthorized MOK)\n\n  [!] EFI\u002FMicrosoft\u002FBoot\u002Fgrubx64.efi - UNAUTHORIZED\n      SHA-256:  e9c1a7...\n      Not present in vendor baseline\n      Matches BlackLotus stage-2 loader signature\n\n  [!] system32\u002F directory present on ESP (BlackLotus artifact)\n      Directory empty (files deleted post-installation)\n\nFIRMWARE MODULE ANALYSIS\nTotal firmware modules:   312\nVendor baseline modules:  312\nAdded modules:            0\nModified modules:         0\nSPI flash integrity:      CLEAN (no firmware-level implant detected)\n\nBOOTKIT ATTRIBUTION\nFamily:           BlackLotus\nConfidence:       HIGH\nPersistence:      ESP-based (not SPI flash)\nBypass Method:    CVE-2022-21894 (baton drop)\nMITRE ATT&CK:    T1542.003 (Bootkit), T1553.006 (Code Signing Policy Modification)\n\nINDICATORS OF COMPROMISE\n- ESP:\u002Fsystem32\u002F directory (empty, post-cleanup artifact)\n- ESP:\u002FEFI\u002FMicrosoft\u002FBoot\u002Fgrubx64.efi (unauthorized, BlackLotus loader)\n- Modified bootmgfw.efi (re-signed with attacker MOK)\n- HVCI disabled via registry: DeviceGuard\\...\\Enabled = 0\n- Unauthorized MOK enrollment in UEFI variable store\n- MeasuredBoot log shows EV_EFI_Boot_Services_Application for grubx64.efi\n\nREMEDIATION\n1. Replace bootmgfw.efi with authentic copy from Windows installation media\n2. Delete unauthorized grubx64.efi and system32\u002F directory from ESP\n3. Reset Secure Boot keys to factory defaults (clear MOK, restore PK\u002FKEK\u002Fdb)\n4. Enable BIOS write protection and verify SPI flash lock bits\n5. Apply firmware update to latest version (patches CVE-2022-21894)\n6. Enable HVCI and verify via Group Policy\n7. Reimport only trusted certificates into Secure Boot db\n8. Monitor MeasuredBoot logs for anomalous boot component loading\n```\n","# Analyzing UEFI Bootkit Persistence\n\n## When to Use\n\n- A compromised system re-establishes C2 communication after OS reinstallation or disk replacement\n- Secure Boot has been tampered with, disabled, or shows unexpected Machine Owner Key (MOK) enrollment\n- Firmware integrity verification fails against vendor-provided baselines\n- Memory forensics reveals rootkit components loading during early boot phase\n- Investigating advanced persistent threat (APT) campaigns known to deploy UEFI implants\n- Auditing firmware security posture for enterprise endpoint hardening\n\n**Do not use** for standard MBR-based bootkits on legacy BIOS systems without UEFI; use MBR\u002FVBR bootkit analysis instead.\n\n## Prerequisites\n\n- chipsec framework for SPI flash dumping, UEFI variable inspection, and firmware security modules\n- UEFITool \u002F UEFIExtract for firmware volume parsing and DXE driver extraction\n- Python 3.8+ with struct, hashlib, subprocess, and os modules\n- Bootable Linux live USB for offline analysis (avoid running compromised OS)\n- Volatility 3 for memory forensics of boot-phase artifacts\n- YARA with UEFI malware rule sets for pattern-based detection\n- Access to vendor firmware baselines for integrity comparison\n\n## Workflow\n\n### Step 1: Dump SPI Flash Firmware\n\nAcquire the UEFI firmware from the SPI flash chip for offline analysis:\n\n```bash\n# Using chipsec to dump SPI flash contents\npython chipsec_util.py spi dump firmware_dump.rom\n\n# Using flashrom as an alternative\nflashrom -p internal -r firmware_dump.rom\n\n# Verify dump integrity\nsha256sum firmware_dump.rom\n\n# Read SPI flash descriptor information\npython chipsec_util.py spi info\n\n# Check SPI flash region access permissions\npython chipsec_main.py -m common.spi_access\n\n# Verify BIOS write protection is enabled\npython chipsec_main.py -m common.bios_wp\n\n# Check SPI flash controller lock\npython chipsec_main.py -m common.spi_lock\n```\n\n### Step 2: Inspect UEFI Variables\n\nEnumerate and analyze UEFI variables for unauthorized modifications:\n\n```bash\n# List all UEFI variables on a live system\npython chipsec_util.py uefi var-list\n\n# List UEFI variables from a SPI flash dump\npython chipsec_util.py uefi var-list-spi firmware_dump.rom\n\n# Read specific Secure Boot variables\npython chipsec_util.py uefi var-read SecureBoot 8BE4DF61-93CA-11D2-AA0D-00E098032B8C\npython chipsec_util.py uefi var-read SetupMode 8BE4DF61-93CA-11D2-AA0D-00E098032B8C\npython chipsec_util.py uefi var-read PK 8BE4DF61-93CA-11D2-AA0D-00E098032B8C\npython chipsec_util.py uefi var-read KEK 8BE4DF61-93CA-11D2-AA0D-00E098032B8C\npython chipsec_util.py uefi var-read db D719B2CB-3D3A-4596-A3BC-DAD00E67656F\n\n# Dump UEFI key databases for analysis\npython chipsec_util.py uefi keys\n\n# Check Secure Boot configuration module\npython chipsec_main.py -m common.secureboot.variables\n```\n\n### Step 3: Analyze EFI System Partition (ESP)\n\nInspect the ESP for unauthorized or modified boot components:\n\n```bash\n# Mount ESP (typically the first FAT32 partition, ~100-500MB)\nmkdir \u002Fmnt\u002Fesp\nmount \u002Fdev\u002Fsda1 \u002Fmnt\u002Fesp\n\n# List all files on ESP with timestamps\nfind \u002Fmnt\u002Fesp -type f -exec ls -la {} \\;\n\n# Check for BlackLotus indicators - custom directory under ESP:\u002Fsystem32\u002F\nls -la \u002Fmnt\u002Fesp\u002Fsystem32\u002F 2>\u002Fdev\u002Fnull\n\n# Verify Windows Boot Manager signature\nsigcheck -a \u002Fmnt\u002Fesp\u002FEFI\u002FMicrosoft\u002FBoot\u002Fbootmgfw.efi\n\n# Hash all EFI binaries for comparison against known-good values\nfind \u002Fmnt\u002Fesp -name \"*.efi\" -exec sha256sum {} \\;\n\n# Check for unauthorized .efi files outside standard directories\nfind \u002Fmnt\u002Fesp -name \"*.efi\" | grep -v \"Microsoft\\|Boot\\|ubuntu\\|grub\"\n\n# Look for grubx64.efi planted by BlackLotus\nfind \u002Fmnt\u002Fesp -name \"grubx64.efi\" -exec sha256sum {} \\;\n\n# Examine MeasuredBoot logs for anomalies (Windows)\n# Logs located at C:\\Windows\\Logs\\MeasuredBoot\\\n```\n\n### Step 4: Scan Firmware for Known Bootkit Signatures\n\nAnalyze the firmware dump for known UEFI malware patterns:\n\n```bash\n# Extract all firmware modules with UEFIExtract\nUEFIExtract firmware_dump.rom all\n\n# Generate firmware module whitelist from vendor baseline\npython chipsec_main.py -m tools.uefi.whitelist -a generate,baseline.json,firmware_vendor.rom\n\n# Compare current firmware against whitelist\npython chipsec_main.py -m tools.uefi.whitelist -a check,baseline.json,firmware_dump.rom\n\n# Scan firmware with UEFI-specific YARA rules\nyara -r uefi_bootkits.yar firmware_dump.rom\n\n# Scan extracted modules individually\nfind firmware_dump.rom.dump -name \"*.efi\" -exec yara -r uefi_bootkits.yar {} \\;\n\n# Check for modified CORE_DXE module (targeted by MoonBounce, CosmicStrand)\n# Compare GUID and hash against vendor baseline\n```\n\n### Step 5: Detect Secure Boot Bypass Mechanisms\n\nCheck for known Secure Boot bypass techniques:\n\n```bash\n# Check if Secure Boot is enabled\npython chipsec_main.py -m common.secureboot.variables\n\n# Verify SMM (System Management Mode) protections\npython chipsec_main.py -m common.smm\n\n# Check SMM BIOS write protection\npython chipsec_main.py -m common.bios_smi\n\n# On Windows - check boot configuration for bypass indicators\nbcdedit \u002Fenum firmware\nbcdedit \u002Fv\n\n# Check for testsigning\u002Fnointegritychecks\u002Fdebug flags\nbcdedit | findstr \u002Fi \"testsigning nointegritychecks debug\"\n\n# Verify HVCI (Hypervisor-enforced Code Integrity) is not disabled\n# BlackLotus sets HKLM:\\...\\DeviceGuard\\...\\HypervisorEnforcedCodeIntegrity Enabled=0\nreg query \"HKLM\\SYSTEM\\CurrentControlSet\\Control\\DeviceGuard\\Scenarios\\HypervisorEnforcedCodeIntegrity\" \u002Fv Enabled\n\n# Check Secure Boot state via PowerShell\n# Confirm-SecureBootUEFI returns True if properly enabled\n```\n\n### Step 6: Perform Boot Chain Integrity Verification\n\nVerify every component in the boot chain from firmware through kernel:\n\n```bash\n# Verify firmware integrity against vendor hash\nsha256sum firmware_dump.rom\n# Compare with vendor-published hash\n\n# Verify bootloader signatures\nsigcheck -a C:\\Windows\\Boot\\EFI\\bootmgfw.efi\nsigcheck -a C:\\Windows\\System32\\winload.efi\nsigcheck -a C:\\Windows\\System32\\ntoskrnl.exe\n\n# Check for unsigned or invalid boot drivers\nsigcheck -u -e C:\\Windows\\System32\\drivers\\\n\n# Analyze Measured Boot logs for unexpected EFI_Boot_Services_Application entries\n# BlackLotus components appear as EV_EFI_Boot_Services_Application\n\n# Memory forensics for boot-phase artifacts\nvol3 -f memory.dmp windows.modules\nvol3 -f memory.dmp windows.driverscan\n```\n\n### Step 7: Document UEFI Bootkit Analysis Findings\n\nCompile a comprehensive analysis report:\n\n```\nReport should include:\n- Firmware version, vendor, and platform identification\n- SPI flash protection status (write protect, lock bits, access control)\n- Secure Boot configuration and any bypass indicators detected\n- UEFI variable anomalies (unauthorized keys, modified db\u002Fdbx, MOK enrollment)\n- ESP contents inventory with hash verification against known-good baselines\n- Firmware module comparison against vendor whitelist (added, modified, removed)\n- Known bootkit family attribution with confidence level\n- Boot chain integrity verification results for each component\n- Remediation steps (reflash, key rotation, hardware replacement)\n- MITRE ATT&CK mapping (T1542.001 - System Firmware, T1542.003 - Bootkit)\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| **UEFI Bootkit** | Malware that persists in UEFI firmware or the boot process, executing before the operating system loads and surviving OS reinstallation |\n| **SPI Flash** | Serial Peripheral Interface flash memory chip on the motherboard storing UEFI firmware; firmware-level bootkits like LoJax and MoonBounce modify SPI flash contents |\n| **EFI System Partition (ESP)** | FAT32 partition containing EFI bootloaders and drivers; bootkits like BlackLotus and ESPecter modify files on the ESP for persistence |\n| **Secure Boot** | UEFI security feature that verifies digital signatures of boot components; can be bypassed via vulnerabilities (CVE-2022-21894) or MOK enrollment |\n| **DXE Driver** | Driver Execution Environment driver loaded during UEFI boot; firmware implants inject malicious DXE drivers that execute before the OS |\n| **Machine Owner Key (MOK)** | User-installable Secure Boot key; BlackLotus enrolls attacker-controlled MOKs to sign malicious bootloaders |\n| **chipsec** | Intel platform security assessment framework for analyzing SPI flash, UEFI variables, Secure Boot, and hardware security configurations |\n| **HVCI** | Hypervisor-enforced Code Integrity, a Windows security feature that bootkits disable to load unsigned kernel drivers |\n\n## Tools & Systems\n\n- **chipsec**: Intel framework for dumping SPI flash, reading UEFI variables, verifying firmware write protection, and Secure Boot configuration auditing\n- **UEFITool**: Open-source UEFI firmware image parser for inspecting firmware volumes, extracting DXE drivers, and comparing module GUIDs\n- **sigcheck**: Sysinternals utility for verifying digital signatures of EFI binaries and boot chain components\n- **flashrom**: Open-source SPI flash programmer for reading and writing firmware chips on supported platforms\n- **YARA**: Pattern matching engine used with UEFI-specific rule sets to detect known bootkit signatures in firmware dumps\n\n## Common Scenarios\n\n### Scenario: Investigating Persistent Compromise Surviving OS Reinstallation\n\n**Context**: An enterprise endpoint was reimaged after a confirmed breach, but identical C2 beaconing resumed within hours. The endpoint has UEFI firmware with Secure Boot enabled, and a TPM 2.0 chip. The security team suspects a UEFI-level implant similar to BlackLotus or LoJax.\n\n**Approach**:\n1. Boot the system from a trusted Linux live USB to avoid executing any compromised OS components\n2. Dump SPI flash firmware using `chipsec_util.py spi dump` for offline analysis\n3. Mount the ESP and hash all `.efi` files for comparison against known-good values from identical hardware\n4. Check for the `ESP:\u002Fsystem32\u002F` directory (BlackLotus indicator) and unauthorized `grubx64.efi`\n5. Extract firmware modules with UEFIExtract and compare GUID inventory against vendor baseline\n6. Verify Secure Boot variables -- look for unauthorized MOK enrollment or modified db\u002Fdbx\n7. Check SPI flash write protection and lock bits using chipsec modules\n8. Scan firmware dump and extracted modules with UEFI-specific YARA rules\n9. If BlackLotus is suspected, check registry for HVCI disabled and MeasuredBoot logs for anomalous entries\n\n**Pitfalls**:\n- Running analysis from the compromised OS (rootkit components hide from live analysis)\n- Only checking the ESP without examining SPI flash firmware (misses firmware-level implants like LoJax, MoonBounce)\n- Assuming Secure Boot prevents all bootkits (CVE-2022-21894 and other bypasses exist)\n- Not preserving the original firmware dump before remediation (critical forensic evidence)\n- Reflashing firmware without verifying the vendor image is authentic and unmodified\n\n## Output Format\n\n```\nUEFI BOOTKIT PERSISTENCE ANALYSIS REPORT\n============================================\nSystem:           Lenovo ThinkPad X1 Carbon Gen 11\nFirmware:         N3HET82W (1.54) - Lenovo UEFI BIOS\nPlatform:         Intel 13th Gen (Raptor Lake)\nTPM:              2.0 (Infineon SLB 9672)\nSecure Boot:      ENABLED (BYPASSED via CVE-2022-21894)\nAnalysis Method:  Linux live USB + chipsec + UEFITool\n\nSPI FLASH PROTECTION STATUS\nBIOS Write Protection:    DISABLED [!]\nSPI Flash Lock (FLOCKDN): SET [OK]\nSMM BIOS Write Protect:   DISABLED [!]\nSPI Protected Ranges:     Region 0 only (descriptor)\n\nUEFI VARIABLE ANALYSIS\nSecureBoot:        Enabled (value=1)\nSetupMode:         Disabled (value=0)\nPK:                Lenovo Ltd. (legitimate)\nKEK:               Microsoft + Lenovo (legitimate)\ndb:                MODIFIED - contains unauthorized entry [!]\n  [!] Unknown certificate: CN=Secure Boot Signing, O=Unknown\n  [!] Not present in vendor baseline db\nMOK:               1 unauthorized key enrolled [!]\n  [!] MOK enrolled: CN=shim, self-signed, not from distro vendor\n\nESP PARTITION ANALYSIS\nTotal EFI binaries:     12\nVerified (signed):      9\nModified (hash mismatch): 2 [!]\nUnauthorized:           1 [!]\n\n  [!] EFI\u002FMicrosoft\u002FBoot\u002Fbootmgfw.efi - MODIFIED\n      Expected SHA-256: a3f2c8...\n      Current SHA-256:  7b1e4d...\n      Signature:        Valid (signed with unauthorized MOK)\n\n  [!] EFI\u002FMicrosoft\u002FBoot\u002Fgrubx64.efi - UNAUTHORIZED\n      SHA-256:  e9c1a7...\n      Not present in vendor baseline\n      Matches BlackLotus stage-2 loader signature\n\n  [!] system32\u002F directory present on ESP (BlackLotus artifact)\n      Directory empty (files deleted post-installation)\n\nFIRMWARE MODULE ANALYSIS\nTotal firmware modules:   312\nVendor baseline modules:  312\nAdded modules:            0\nModified modules:         0\nSPI flash integrity:      CLEAN (no firmware-level implant detected)\n\nBOOTKIT ATTRIBUTION\nFamily:           BlackLotus\nConfidence:       HIGH\nPersistence:      ESP-based (not SPI flash)\nBypass Method:    CVE-2022-21894 (baton drop)\nMITRE ATT&CK:    T1542.003 (Bootkit), T1553.006 (Code Signing Policy Modification)\n\nINDICATORS OF COMPROMISE\n- ESP:\u002Fsystem32\u002F directory (empty, post-cleanup artifact)\n- ESP:\u002FEFI\u002FMicrosoft\u002FBoot\u002Fgrubx64.efi (unauthorized, BlackLotus loader)\n- Modified bootmgfw.efi (re-signed with attacker MOK)\n- HVCI disabled via registry: DeviceGuard\\...\\Enabled = 0\n- Unauthorized MOK enrollment in UEFI variable store\n- MeasuredBoot log shows EV_EFI_Boot_Services_Application for grubx64.efi\n\nREMEDIATION\n1. Replace bootmgfw.efi with authentic copy from Windows installation media\n2. Delete unauthorized grubx64.efi and system32\u002F directory from ESP\n3. Reset Secure Boot keys to factory defaults (clear MOK, restore PK\u002FKEK\u002Fdb)\n4. Enable BIOS write protection and verify SPI flash lock bits\n5. Apply firmware update to latest version (patches CVE-2022-21894)\n6. Enable HVCI and verify via Group Policy\n7. Reimport only trusted certificates into Secure Boot db\n8. Monitor MeasuredBoot logs for anomalous boot component loading\n```\n",{"name":5,"tags":48,"author":9,"domain":42,"license":15,"version":49,"nist_csf":50,"subdomain":54,"description":55,"mitre_attack":56,"d3fend_techniques":62},[27,28,33,32,31,30,26],"1.0.0",[51,52,53],"ID.RA-01","PR.PS-01","PR.PS-02","firmware-security","Analyzes UEFI bootkit persistence (SPI flash implants, ESP modifications, Secure Boot bypass, UEFI variable manipulation) using chipsec for firmware integrity verification, detecting known families like BlackLotus, LoJax, and MoonBounce. Use for UEFI malware analysis, firmware persistence investigation, or Secure Boot bypass detection.\n",[57,58,59,60,61],"T1542.001","T1542.003","T1553.006","T1542","T1014",[63,64,65,66,67],"Platform Hardening","Restore Object","Platform Monitoring","Firmware Verification","Firmware Embedded Monitoring Code","main","54a798831d2266a3ca61ce68a7acb80b81160d57","skills\u002Fanalyzing-uefi-bootkit-persistence",4414,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills","https:\u002F\u002Fmahipal.engineer\u002FAnthropic-Cybersecurity-Skills\u002F","https:\u002F\u002Fgithub.com\u002Fmukul975","Mahipal.engineer","🔐 Cybersecurity | 💻 Dev | 📷 Street Photographer\r\n🎓 MSc | 📚 Research & AI Security","2026-08-31 12:32:44",{"source":8,"skillName":5,"commands":79,"prompt":89,"zipAvailable":90},[80,83,86],{"tool":81,"command":82},"npx","npx skills add mukul975\u002FAnthropic-Cybersecurity-Skills --skill analyzing-uefi-bootkit-persistence",{"tool":84,"command":85},"bunx","bunx skills add mukul975\u002FAnthropic-Cybersecurity-Skills --skill analyzing-uefi-bootkit-persistence",{"tool":87,"command":88},"pnpm","pnpm dlx skills add mukul975\u002FAnthropic-Cybersecurity-Skills --skill analyzing-uefi-bootkit-persistence","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fanalyzing-uefi-bootkit-persistence\u002FSKILL.md",true,[92,97,103],{"path":93,"resourceType":93,"resourceTypeDesc":94,"sizeBytes":95,"sourceHtmlUrl":96},"LICENSE","许可证",11255,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fanalyzing-uefi-bootkit-persistence\u002FLICENSE",{"path":98,"resourceType":99,"resourceTypeDesc":100,"sizeBytes":101,"sourceHtmlUrl":102},"references\u002Fapi-reference.md","REFERENCE","参考文档",5768,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fanalyzing-uefi-bootkit-persistence\u002Freferences\u002Fapi-reference.md",{"path":104,"resourceType":105,"resourceTypeDesc":106,"sizeBytes":107,"sourceHtmlUrl":108},"scripts\u002Fagent.py","SCRIPT","脚本",22332,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fanalyzing-uefi-bootkit-persistence\u002Fscripts\u002Fagent.py",[110,134,155,183,209,236],{"skillNo":111,"name":112,"nameZh":6,"description":113,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":114,"categories":115,"keywords":117,"publishedAt":43},"01M6AGDM3HJXTKXX15ZZ0ZVCJ3","verifying-build-provenance-with-slsa-sigstore","Verifies artifact signatures and SLSA provenance using Sigstore's cosign (verify, verify-attestation, verify-blob-attestation) and slsa-verifier (verify-artifact), enforcing keyless OIDC builder identity and source repo against SLSA Build levels. Use in CI\u002FCD before deploying artifacts, when consuming third-party attestations, establishing a SLSA Build L3 pipeline, or confirming provenance during incident response or admission control.","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fverifying-build-provenance-with-slsa-sigstore\u002FSKILL.md",[116],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[118,119,120,121,35,42,122,123,40,38,124,125,126,127,128,129,130,131,132,133],"sigstore","provenance","slsa","verifying build provenance with slsa sigstore","incident response","identity","artifacts","ci","supply-chain","pipeline","supply-chain-security","t1195","attestation","code-signing","cosign","keyless",{"skillNo":135,"name":136,"nameZh":6,"description":137,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":138,"categories":139,"keywords":141,"publishedAt":43},"01M6AGDGBPWYVZ2F11GFKJ4HZ9","validating-tpm-measured-boot-attestation","Verifies TPM 2.0 measured-boot integrity and remote attestation with tpm2-tools -- reading PCRs (tpm2_pcrread), replaying the boot event log, generating and checking signed quotes (tpm2_quote\u002Ftpm2_checkquote), and sealing secrets to a PCR policy. Use to confirm a system booted trusted firmware\u002Fkernel for Zero Trust device posture, detect boot-chain tampering via PCR drift, or build a golden-value baseline for fleet attestation.","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fvalidating-tpm-measured-boot-attestation\u002FSKILL.md",[140],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[39,130,142,143,35,144,42,40,37,145,33,146,147,148,149,150,151,152,153,154],"TPM","validating tpm measured boot attestation","policy","ZeRO","Tools","measured-boot","PCR","integrity","secrets","remote-attestation","tpm2-tools","integrity-verification","trusted-computing",{"skillNo":156,"name":157,"nameZh":6,"description":158,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":159,"categories":160,"keywords":165,"publishedAt":43},"01M6AGDCW0Y4FXZ3362GT1941M","validating-backup-integrity-for-recovery","Validates backup integrity through cryptographic hash verification, automated restore testing, corruption detection, and recoverability checks to confirm backups are reliable for disaster recovery and ransomware response. Use before relying on backups for recovery, when building post-backup validation pipelines, auditing backup infrastructure for compliance, or checking immutable\u002Fair-gapped backups for silent corruption or tampering.","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fvalidating-backup-integrity-for-recovery\u002FSKILL.md",[161,164],{"categoryNo":162,"categoryName":163,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[149,166,167,168,169,42,170,171,37,172,173,174,175,176,177,178,179,180,181,182],"backup","recovery","validating backup integrity for recovery","testing","infrastructure","validation","compliance","hash-verification","incident-response","ransomware","cryptocurrency","detection","t1078","t1490","immutable","disaster-recovery","restore-testing",{"skillNo":184,"name":185,"nameZh":6,"description":186,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":187,"categories":188,"keywords":190,"publishedAt":43},"01M6AGD9GBG2KZ336AE763J3WH","triaging-windows-with-kape","Runs KAPE (Kroll Artifact Parser and Extractor) to collect targeted forensic artifacts (registry hives, $MFT, event logs, prefetch, browser data) via Targets and parse them with Modules wrapping Eric Zimmerman's EZ Tools (PECmd, MFTECmd, RECmd). Use during early incident containment\u002Ftriage when full disk imaging is impractical but a defensible, parseable Windows artifact set is needed quickly, including at-scale remote collection.","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Ftriaging-windows-with-kape\u002FSKILL.md",[189],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[191,192,193,42,194,195,196,197,198,199,200,201,202,203,204,205,146,206,207,208],"windows","kape","triaging windows with kape","registry","browser","logs","windows-forensics","dfir","mft","mftecmd","data","prefetch","eric-zimmerman","digital-forensics","SET","collection","pecmd","artifact-collection",{"skillNo":210,"name":211,"nameZh":6,"description":212,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":213,"categories":214,"keywords":216,"publishedAt":43},"01M6AGD5PW5J4EVZM958WD74ZQ","triaging-vulnerabilities-with-ssvc-framework","Triages and prioritizes vulnerabilities with CISA's Stakeholder-Specific Vulnerability Categorization (SSVC) decision tree, weighing exploitation status (via the CISA KEV catalog and FIRST EPSS API), technical impact, automatability, and mission prevalence to output Track\u002FTrack*\u002FAttend\u002FAct decisions. Use when prioritizing vulnerability scan results (OpenVAS, Nessus, Qualys) for remediation planning beyond raw CVSS scores.","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Ftriaging-vulnerabilities-with-ssvc-framework\u002FSKILL.md",[215],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[217,218,219,42,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235],"vulnerabilities","framework","triaging vulnerabilities with ssvc framework","status","planning","CISA","vulnerability-management","risk-management","nessus","qualys","openvas","cvss","remediation","risk","vulnerability","api","prioritization","ssvc","decision-tree",{"skillNo":237,"name":238,"nameZh":6,"description":239,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":240,"categories":241,"keywords":243,"publishedAt":43},"01M6AGD24TTQQM4CXG69E3B9TJ","triaging-security-incident","Performs initial triage of security incidents using the NIST SP 800-61r3 and SANS PICERL frameworks, classifying incident type, assigning priority by business impact, and routing to the appropriate response team. Use when a SIEM\u002FEDR alert needs human classification, concurrent alerts must be prioritized, or a user report or threat-intel IOC match requires initial incident categorization.","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Ftriaging-security-incident\u002FSKILL.md",[242],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[35,244,42,245,246,247,248,249,250,251,252,178,253,179,254,255,256,257,258,259],"triaging security incident","siem","file","ioc","soc","NIST-800-61","NIST","severity","edr","execution","analysis","classification","severity-classification","incident-triage","SANS-PICERL","SOC-operations"]