iOS Kernel Personas Use-After-Free

2018.10.20
Risk: High
Local: Yes
Remote: No
CWE: CWE-119


CVSS Base Score: 9.3/10
Impact Subscore: 10/10
Exploitability Subscore: 8.6/10
Exploit range: Remote
Attack complexity: Medium
Authentication: No required
Confidentiality impact: Complete
Integrity impact: Complete
Availability impact: Complete

iOS kernel UaF due to bad error handling in personas CVE-2018-4337 There was recently some cleanup in the persona code to fix some race conditions there, I don't think it was sufficient: In kpersona_alloc_syscall if we provide an invalid userspace pointer for the ipd outptr we can cause this copyout to fail: error = copyout(&persona->pna_id, idp, sizeof(persona->pna_id)); if (error) goto out_error; This jumps here: if (persona) persona_put(persona); At this point the persona is actually in the global list and the reference has been transfered there; this code is mistakenly assuming that userspace can't still race a dealloc call because it doesn't know the id. The id is attacker controlled so it's easy to still race this (ie we call persona_alloc in one thread, and dealloc in another), causing an extra call to persona_put. It's probably possible to make the failing copyout take a long time, allowing us to gc and zone-swap the page leading to the code attempting to drop a ref on a different type. This PoC has been tested on iOS 11.3.1 because it requires root. I have taken a look at an iOS 12 beta and it looks like the vuln is still there, but I cannot test it. It should be easy to fix up this PoC to run as root in your testing environment. Found by: ianbeer


Vote for this issue:
50%
50%


 

Thanks for you vote!


 

Thanks for you comment!
Your message is in quarantine 48 hours.

Comment it here.


(*) - required fields.  
{{ x.nick }} | Date: {{ x.ux * 1000 | date:'yyyy-MM-dd' }} {{ x.ux * 1000 | date:'HH:mm' }} CET+1
{{ x.comment }}

Copyright 2024, cxsecurity.com

 

Back to Top