汎用セキュリティ⭐ リポ 0品質スコア 65/100
hardware-firmware-detect
ファームウェアとブートローダーのフォレンジック調査に対応しています。UEFI/BIOSの整合性検証、Secure Bootのキーチェーン確認、TPM PCRの状態確認、initramfsの検査、GRUB設定の分析、ACPIテーブルの解析、ファームウェアルートキット/インプラントの検出ができます。
description の原文を見る
Firmware and bootloader forensic reconnaissance. UEFI/BIOS integrity, Secure Boot key chain, TPM PCR state, initramfs inspection, GRUB configuration, ACPI table analysis, and firmware rootkit/implant detection.
SKILL.md 本文
ファームウェア・リコン
目的: ブートおよびファームウェアに重点を置いたリコンサイサンス(調査)であり、高影響度の永続性ベクトルを対象としています。UEFI/BIOSルートキット、Secure Boot回避、initramfs改ざん、サプライチェーン型ファームウェア埋め込みを検出します。
コア重点分野
- UEFI/BIOS整合性: バージョンフィンガープリント、チェックサムベースライン、SPIフラッシュダンプ比較
- Secure Boot チェーン: PK/KEK/db/dbx キーインベントリ、MOK分析、ブートエントリ操作
- TPM 2.0 状態: PCR値、EK証明書、NVインデックスインベントリ、シール化キー監査
- initramfs 分析: 埋め込みスクリプト、予期しないバイナリ、フック注入
- GRUB 設定: カスタムコマンド、モジュール、パスワード回避の兆候
- ACPI テーブル: DSDT/SSDT注入による永続的なコード実行
- ファームウェア更新履歴: fwupdログ、バージョンロールバック、不正な更新
- ハードウェア埋め込み兆候: 予期しないPCIeデバイス、DMA異常、USB埋め込み
主要な手法とツール
UEFI/BIOSフィンガープリント
# BIOS version, date, vendor
sudo dmidecode -t bios 2>/dev/null | grep -E "(Vendor|Version|Release|Revision|Char)"
# Full DMI table
sudo dmidecode 2>/dev/null | head -80
# UEFI variable listing
efivar --list 2>/dev/null | head -30
efibootmgr -v 2>/dev/null
# UEFI boot order and entries
efibootmgr --unicode 2>/dev/null
# Check for rogue UEFI boot entries (not in expected list)
efibootmgr -v 2>/dev/null | grep -v "^Boot000[0-9]" | grep -E "^Boot[0-9]{4}"
Secure Boot キーチェーン
# Secure Boot status
mokutil --sb-state 2>/dev/null
# Platform Key (PK)
mokutil --pk 2>/dev/null | openssl x509 -noout -text 2>/dev/null | \
grep -E "(Subject|Issuer|Not After)"
# Key Exchange Keys (KEK)
mokutil --kek 2>/dev/null | grep -E "(Subject|Issuer|CN=)"
# Authorized (db) and revoked (dbx)
mokutil --db 2>/dev/null | grep -E "(Subject|Issuer|SHA)"
mokutil --dbx 2>/dev/null | head -10
# MOK (Machine Owner Keys) — user-enrolled keys
mokutil --list-enrolled 2>/dev/null | grep -E "(Subject|SHA|Finger)"
# All UEFI signature lists
for db in PK KEK db dbx; do
echo "=== $db ==="
efi-readvar -v "$db" 2>/dev/null | head -10
done
TPM 2.0 分析
# TPM device info
cat /sys/class/tpm/tpm0/tpm_version_major 2>/dev/null
cat /sys/class/tpm/tpm0/description 2>/dev/null
# PCR values — PCR[0-7] cover firmware and boot path
tpm2_pcrread sha256:0,1,2,3,4,5,6,7 2>/dev/null
# Expected PCR values vs baseline
tpm2_pcrread sha256 2>/dev/null | diff - ./cybersec-shared/baselines/tpm_pcr_baseline.txt 2>/dev/null || \
echo "No baseline available — document current values"
# EK (Endorsement Key) certificate
tpm2_getekcertificate -o /tmp/ek_cert.pem 2>/dev/null && \
openssl x509 -in /tmp/ek_cert.pem -noout -text 2>/dev/null | \
grep -E "(Subject|Issuer|Not After|Serial)"
# Persistent TPM handles (sealed secrets, bound keys)
tpm2_getcap handles-persistent 2>/dev/null
# NV indexes (EK cert locations)
tpm2_getcap handles-nv-index 2>/dev/null
# TPM audit log
tpm2_eventlog /sys/kernel/security/tpm0/binary_bios_measurements 2>/dev/null | head -40
initramfs 検査
# Extract and inspect initramfs content
INITRAMFS=$(ls /boot/initramfs-linux*.img 2>/dev/null | head -1)
[ -z "$INITRAMFS" ] && INITRAMFS=$(ls /boot/initrd*.img 2>/dev/null | head -1)
# lsinitcpio (Arch/Garuda)
lsinitcpio -l "$INITRAMFS" 2>/dev/null | head -50
# Analyze hooks in initramfs
lsinitcpio -a "$INITRAMFS" 2>/dev/null | head -20
# Extract to temp dir and inspect
mkdir -p /tmp/initramfs_extract
lsinitcpio -x "$INITRAMFS" -d /tmp/initramfs_extract/ 2>/dev/null || \
(cd /tmp/initramfs_extract && zcat "$INITRAMFS" | cpio -i 2>/dev/null)
# Look for unexpected executables in initramfs
find /tmp/initramfs_extract -type f -executable 2>/dev/null | head -20
find /tmp/initramfs_extract -name "*.sh" 2>/dev/null | xargs grep -l "curl\|wget\|nc\|ncat" 2>/dev/null
# Checksum comparison
sha256sum "$INITRAMFS" 2>/dev/null
GRUB 分析
# GRUB configuration
cat /boot/grub/grub.cfg 2>/dev/null | grep -E "(menuentry|set|linux|initrd|password)" | head -30
# GRUB environment block
grub-editenv list 2>/dev/null
# Unexpected GRUB modules loaded
ls /boot/grub/$(uname -m)-efi/ 2>/dev/null | grep -v "^normal\|^boot\|^linux\|^chain"
# Check GRUB password protection
grep -i "password" /boot/grub/grub.cfg 2>/dev/null | head -5
# GRUB2 superuser check
grep "set superusers\|password_pbkdf2" /boot/grub/grub.cfg 2>/dev/null
ACPI テーブル分析
# Dump ACPI tables
acpidump -o /tmp/acpi_tables.dat 2>/dev/null
acpixtract -a /tmp/acpi_tables.dat 2>/dev/null
# Decompile DSDT (primary ACPI definition table)
iasl -d /tmp/dsdt.dat 2>/dev/null
grep -iE "(Execute|Load|Store|_INI|_PTS)" /tmp/dsdt.dsl 2>/dev/null | head -20
# Check for SSDT overlays (common injection technique)
ls /tmp/ssdt*.dat 2>/dev/null | wc -l
cat /sys/firmware/acpi/tables/SSDT* 2>/dev/null | strings | head -20
ファームウェア更新履歴
# fwupd history — check for unauthorized updates or version rollbacks
fwupdmgr get-history 2>/dev/null | head -30
# Currently installed firmware versions
fwupdmgr get-devices 2>/dev/null | head -40
# Check for pending or available updates
fwupdmgr get-updates 2>/dev/null | head -20
# fwupd daemon logs
journalctl -u fwupd --since "30 days ago" 2>/dev/null | \
grep -E "(install|downgrade|update|error)" | head -20
ハードウェア埋め込み兆候
# PCIe device inventory — compare against baseline
lspci -vv 2>/dev/null | grep -E "(VendorID|DeviceID|SubVendorID|^[0-9])" | head -30
lspci -mm 2>/dev/null > /tmp/pci_live.txt
# DMA protection status
dmesg | grep -iE "(iommu|dmar|vt-d|amd-vi)" | head -10
cat /proc/iomem | grep -i "reserved\|unusable" | head -10
# USB device inventory
lsusb -v 2>/dev/null | grep -E "(idVendor|idProduct|iManufacturer|iProduct|bDeviceClass)" | head -30
# Unexpected USB devices (compare against baseline)
lsusb 2>/dev/null | sort > /tmp/usb_live.txt
diff ./cybersec-shared/baselines/usb_devices.txt /tmp/usb_live.txt 2>/dev/null | head -10
MITRE ATT&CK マッピング
| 検出事項 | 手法 |
|---|---|
| UEFI/BIOS 改変 | T1542.001 – System Firmware |
| Secure Boot 回避 / 不正キー | T1542.003 – Bootkit |
| 攻撃者キーの MOK 登録 | T1553.004 – Install Root Certificate |
| initramfs バックドア | T1542.004 – ROMMONkit (同等) |
| ACPI テーブル注入 | T1542 – Pre-OS Boot |
| 不正なファームウェアダウングレード | T1195.003 – Compromise Hardware Supply Chain |
| PCIe/USB ハードウェア埋め込み | T1200 – Hardware Additions |
エージェント向けルール
- TPM PCR 値がベースラインから変更 = 重大 — すぐに CYBERSEC-AGENT にエスカレート
- ベースラインにない不正な UEFI ブートエントリ = 重大
- 予期しない MOK 登録キー = 高
- ネットワークツール (curl/wget/nc) を含む initramfs = 高
- fwupd 履歴に不正なファームウェアダウングレード = 高
- セッション開始時には常に PCR 値と UEFI ブートエントリをベースライン化する
- セッション終了時に共有メモリーにすべてのファームウェア IOC を同期する
ライセンス: MIT(寛容ライセンスのため全文を引用しています) · 原本リポジトリ
詳細情報
- 作者
- DCx7C5
- ライセンス
- MIT
- 最終更新
- 2026/5/9
Source: https://github.com/DCx7C5/ai-marketplace / ライセンス: MIT