apple ios kernel stack memory disclosure due to failure to check copyin return value

▸▸▸ Exploit & Vulnerability >>   dos exploit & ios vulnerability




apple ios kernel stack memory disclosure due to failure to check copyin return value Code Code...
				
Here's a code snippet from sleh.c with the second level exception handler for undefined instruction exceptions: static void handle_uncategorized(arm_saved_state_t *state, boolean_t instrLen2) { exception_type_t exception = EXC_BAD_INSTRUCTION; mach_exception_data_type_t codes[2] = {EXC_ARM_UNDEFINED}; mach_msg_type_number_t numcodes = 2; uint32_t instr; <------ (a) if (instrLen2) { uint16_t instr16; COPYIN(get_saved_state_pc(state), (char *)&instr16, sizeof(instr16)); instr = instr16; } else { COPYIN(get_saved_state_pc(state), (char *)&instr, sizeof(instr)); <------- (b) } .... else { codes[1] = instr; <------ (c) } } exception_triage(exception, codes, numcodes); <-------- (d) At (a) the uint32_t instr is declared uninitialized on the stack. At (b) the code tries to copyin the bytes of the exception-causing instruction from userspace note that the COPYIN macro doesn't itself check the return value of copyin, it just calls it. At (c) instr is assigned to codes[1], which at (d) is passed to exception_triage. that codes array will eventually end up being sent in an exception mach message. The bug is that we can force copyin to fail by unmapping the page containing the undefined instruction while it's being handled. (I tried to do this with XO memory but the kernel seems to be able to copyin that just fine.) This PoC has an undefined instruction (0xdeadbeef) on its own page and spins up a thread to keep switching the protection of that page between VM_PROT_NONE and VM_PROT_READ|VM_PROT_EXECUTE. We then keep spinning up threads which try to execute that undefined instruction. If the race windows align the thread executes the undefined instruction but when the sleh code tries to copyin the page is unmapped, the copying fails and the exception message we get has stale stack memory. This PoC just demonstrates that you do get values which aren't 0xdeadbeef in there for the EXC_ARM_UNDEFINED type. You'd have to do a bit more fiddling to work out how to get something specific there. Note that there are lots of other unchecked COPYIN's in sleh.c (eg when userspace tries to access a system register not allowed for EL0) and these seem to have the same issue. tested on iPod Touch 6g running 11.3.1, but looking at the kernelcache it seems to still be there in iOS 12. Proof of Concept: https://github.com/offensive-security/exploitdb-bin-sploits/raw/master/bin-sploits/45649.zip

Apple ios kernel stack memory disclosure due to failure to check copyin return value Vulnerability / Exploit Source : Apple ios kernel stack memory disclosure due to failure to check copyin return value



Last Vulnerability or Exploits

Developers

Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Easy integrations and simple setup help you start scanning in just some minutes
Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Discover posible vulnerabilities before GO LIVE with your project
Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Manage your reports without any restriction

Business Owners

Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Obtain a quick overview of your website's security information
Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Do an audit to find and close the high risk issues before having a real damage and increase the costs
Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Verify if your developers served you a vulnerable project or not before you are paying
Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Run periodically scan for vulnerabilities and get info when new issues are present.

Penetration Testers

Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Quickly checking and discover issues to your clients
Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Bypass your network restrictions and scan from our IP for relevant results
Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Create credible proved the real risk of vulnerabilities

Everybody

Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check If you have an website and want you check the security of site you can use our products
Website Vulnerability Scanner - Online Tools for Web Vulnerabilities Check Scan your website from any device with internet connection

Tusted by
clients

 
  Our Cyber Security Web Test application uses Cookies. By using our Cyber Security Web Test application, you are agree that we will use this information. I Accept.