Skip to content

S3 boot-script tampering

UEFI S3 Resume Boot Script — firmware'in S3'ten uyanışta replay ettiği bir opcode tablosu — çoğu zaman korumasız memory'de bırakılır, böylece ring-0 bir attacker onu kısmen unlocked resume path'i sırasında kod çalıştırmak, flash'ı unlock'lamak veya SMRAM açmak için yeniden yazabilir.

Mechanism

Locks yeniden set edilmeden önce attacker-writable bir opcode tablosunu replay etmek

Suspend-to-RAM (S3) sırasında firmware bir Boot Script kaydeder: resume'da platformu yeniden programlayan I/O, PCI, MMIO ve dispatch opcode'larından oluşan serialized bir liste (tam bir re-init'ten daha hızlıdır). Birçok sistemde bu tablo — ve onu locate etmek için kullanılan pointer — ring-0 yazılımının yazabileceği normal ACPI/reserved memory'de bulunur.

Kritik olarak, erken S3 resume sırasında birçok platform lock'u (BIOS write protect, SMRAM lock, SMRR) henüz uygulanmamıştır. OS'ten boot script'i düzenleyen bir attacker şunları yapabilir:

  • attacker koduna işaret eden bir DISPATCH opcode insert etmek veya mevcut bir dispatch opcode'unu retarget etmek, böylece boot-script interpreter'ının context'inde code execution kazanmak; veya
  • firmware'in script'i locate etmek için kullandığı veriyi değiştirmek.

Bir S3 suspend/resume zorlamak, platform hâlâ unlocked durumdayken tampered script'i execute eder. Kırılan invariant: "resume path yalnızca firmware-authored, integrity-protected adımları replay eder." Sonuçlar arasında SMRAM read/write, SPI flash reflash ve Secure Boot bypass yer alır.

Wojtczuk & Kallenberg (CCC 2014) ve Cr4sh tarafından disclose edildi; VU#976132 olarak takip ediliyor. CHIPSEC common.uefi.s3bootscript tarafından kontrol edilir.

Walkthrough

# Detection: CHIPSEC checks whether the S3 boot script is protected.
sudo python chipsec_main.py -m common.uefi.s3bootscript
# A FAIL/WARNING indicates the boot script table sits in unprotected memory.

Kavramsal tamper path (public research'e göre):

1. From ring 0, locate the S3 Boot Script table in ACPI/reserved memory.
2. Insert or retarget a DISPATCH opcode to point at attacker-controlled code.
3. Trigger S3 suspend, then resume.
4. The interpreter executes the injected opcode while flash/SMRAM/SMRR locks
   are not yet set -> code exec, flash reflash, or SMRAM access.

Vulnerable bir platformda beklenen sonuç: resume sırasında, downstream lock'ları yenme yeteneğiyle code execution; protected bir platformda script locked/SMM memory'de yaşar ve düzenlenemez.

Detection

  • CHIPSEC common.uefi.s3bootscript (yukarıda).
  • Boot-script integrity measurement; beklenmeyen DISPATCH opcode'larında alert.

Mitigation

References