Spectre-v2 is a speculative execution attack class that targets indirect-branch prediction. Instead of breaking memory directly, it poisons or steers CPU predictor state so the processor speculatively follows an attacker-influenced path. That speculative work can expose secrets through side channels, even if the mispredicted instructions are later rolled back.
This matters because indirect branches are common in kernels, browsers, runtimes, and JIT engines. If predictor state persists across code reuse or privilege boundaries, stale history can influence new code and create a leak path. Defenses focus on limiting that shared state with measures such as retpoline, IBPB, IBRS, STIBP, and related branch-history clearing techniques. In practice, Spectre-v2 is less about crashing a system and more about turning performance features into information leaks, so mitigation depends on the CPU, operating system, and runtime all handling branch prediction carefully.


