Memory Sinkhole Proof of Concept
This exploit is used to hijack ring -2 execution through the APIC overlay attack. The SMBASE register of the core under attack is set to 0x1f5ef800 and the location of the attack GDT is determined by which register will be read out of the APIC. The value added to SMBASE by the SMM handler to compute the protected mode far jump offset is 0x8097 and the offset of the SMM DSC structure from which the handler loads critical information is 0xfb00. The descriptor value used in the SMM handler’s far jump is 0x10 and the MSR number for the APIC location is 0x1b. The target memory address to sinkhole is calculated by adding TARGET_SMBASE and DSC_OFFSET and then taking the bitwise AND of the result with 0xfffff000. The payload offset is set to 0x1000 and the CS base is calculated by subtracting FJMP_OFFSET from PAYLOAD_OFFSET. The APIC BSP is set to 0x100 and the APIC must be activated for the attack to work.