Skip to content

SMoTherSpectre

Bir victim'in secret-dependent branch sonucunu SMoTher üzerinden sızdıran spekülatif bir code-reuse saldırısı — SMT sibling'leri arasındaki execution-port contention'ı zamanlayan bir port-contention side channel — ve hiçbir cache modülasyonu gerektirmez (Flush+Reload yok).

Mechanism

Neden çalışır

SMoTherSpectre (Bhattacharyya et al., CCS 2019) iki bileşeni birleştirir:

  • SMoTher — side channel. Bir SMT core'da "two co-located ... hardware threads of execution share execution units. Instructions that are scheduled to execute on the same execution port will contend for the available resources." Bir port-bound instruction dizisini zamanlayarak "an unprivileged attacker process can detect whether a co-located victim process is running an instruction on a given port." SMoTher fine-grained'dir: o "detects contention based on a single victim instruction." İki victim dizisi, bazı port(lar)a farklı yük bindiriyorlarsa SMoTher-differentiable'dır; attacker bunu timing dağılımlarının istatistiksel (Student's t-test, %95 güven) bir karşılaştırmasıyla ayırt eder.

  • Branch Target Injection — speculation primitive'i. SMoTherSpectre "starts at an indirect jump on the victim's usual execution path." Attacker, victim'in fetch unit'i indirect jump target'ını istediğinde, onun victim'in binary'sindeki ayrı bir data-dependent conditional jump'a — bir SMoTher gadget'a — yönlendirilmesi için BTB'yi BTI (Spectre v2 tarzı) ile "poison"lar; bu gadget'ın target ve fall-through path'leri SMoTher-differentiable'dır.

Speculation sırasında victim "evaluates the condition and jumps to either the target or fall-through sequences"; attacker, hangi path'in çalıştığını çıkarmak için kendi port-bound dizisini zamanlar ve victim'in secret verisi hakkında bir bit öğrenir.

Cache kanalı gerekmez — ve misspeculation'da geri alma yetersizdir

Cache tabanlı kanallara (örn. ikinci bir array'in Flush+Reload'u) dayanan Spectre v1/v2 read-out'un aksine, SMoTherSpectre speculative pencerenin kendisi sırasındaki port contention üzerinden iletim yapar. Yazarlar şunu vurgular: "because the transmission occurs before speculative execution ends, reverting side effects of speculative execution would not be sufficient as a defense."

Walkthrough

Saldırı, victim'de BTI ile zincirlenmiş iki gadget gerektirir:

  • BTI gadget — "Stores secret data into memory or a register (called the SMoTherSpectre target) followed by an indirect branch that can be poisoned by the attacker."
  • SMoTher gadget — "A data-dependent conditional jump whose control variable is the SMoTherSpectre target, with SMoTher-differentiable target and fall-through code paths."

Makalenin örneğinde BTI gadget secret'ı rdi'ye, bir pointer'ı rax'a yükler ve jmp rax yapar; SMoTher gadget ise iki path'i SMoTher-differentiable diziler içeren (örn. popcnt vs ror) rdi-bağımlı bir conditional branch'tir.

Phase 1 (attacker):  perform Spectre-v2 BTI to poison rax's indirect jump
                     -> point speculation at the SMoTher gadget,
                     then busy-wait (nops) to ALIGN with victim speculation
Phase 2 (attacker):  time a port-bound sequence (e.g. 42x crc32 -> port 1)
                     while the victim speculatively runs the SMoTher gadget
Decode:              statistical analysis of the timing distribution -> 1 bit
                     (repeat with other gadgets to reconstruct the secret)

PoC, BTI başarısını şöyle maksimize eder: indirect branch'ten önce N adet always-taken branch ekleyerek; branch'leri (BTI target dahil) attacker ile victim arasında congruent address'lere yerleştirerek; ASLR'yi devre dışı bırakarak; ve speculation penceresini uzatmak için indirect-jump pointer'ını tutan cache line'ı evict ederek. BTI başarısı BR_MISP_EXEC.TAKEN_INDIRECT_JUMP_NON_CALL_RET PMC event'iyle doğrulanır (delta 1 == bir mispredict edilen indirect jump).

Port seçimi ve gadget bolluğu

attacker timing seq:  42x crc32   (executes exclusively on port 1)
victim fall-through:  crc32 seq   -> contends on port 1  => HIGH latency
victim target path:   ops on ports 0/1/5/6 -> less contention => lower latency

Gadget supply is large: "libcrypto from the OpenSSL library contains more
than 12,000 readily usable gadgets." Common condition-setting instructions
in real SMoTher gadgets: cmp, test, add, sub (cmp-jxx / test-jxx).
Önemli olan şu: bir SMoTher gadget klasik bir data-dependent-control-flow güvenlik açığı değildir: ilgisiz bir secret load'u (BTI gadget) o değer üzerindeki bağımsız bir compare-and-jump'a bağlar, "making the pattern harder, if not entirely impossible, to eliminate."

Detection

  • Sıcak indirect call site'larındaki poisoning etkinliği için indirect-branch misprediction PMC'lerini izle (PoC'nin kendisinin yaptığı gibi).
  • Port-contention timing'ine özgü, sıkı, single-port instruction döngüleri (örn. crc32/popcnt/bts) yayan anormal co-resident thread'ler.

Mitigation

Yazarlar mevcut BTI kontrollerini sıralar: retpoline'lar (software) ve "for flushing the indirect branch predictors at the appropriate times and for not sharing them across SMT threads" amaçlı IBRS, IBPB ve STIBP donanım arayüzleri. Bunların "come with a potentially severe performance impact" olduğunu ve bu yüzden "have been enabled only for selected system components such as the kernel, and none of the user-space programs we have analysed make use of them" gözlemini yaparlar.

  • STIBP / SMT'yi devre dışı bırakmak, co-resident speculation/predictor paylaşımını engelleyerek cross-sibling port-contention kanalını doğrudan hedefler.
  • retpoline / IBRS / eIBRS, speculation'ı SMoTher gadget'a yönlendiren BTI primitive'ini kaldırır ya da kısıtlar.
  • IBPB, domain switch'lerinde indirect branch predictor'ı flush eder.

References