Apple Security Framework Crash due to Uninitialized Pointer
A crash was identified in Apple's Security framework due to an uninitialized pointer in the SecError function, leading to the dereference of an invalid memory address.
A vulnerability exists within Apple’s Security framework that can lead to application crashes. The issue stems from an uninitialized pointer, CFErrorRef *error, within the SecCDSAKeyCopyPublicKey function. This function is part of the Swift framework responsible for handling cryptographic operations, specifically dealing with certificate authorities and key generation. When an error occurs during the execution of SecCDSAKeyCopyPublicKey, a catch block is invoked. This catch block then calls the SecError function with the uninitialized CFErrorRef pointer. The SecError function attempts to dereference this uninitialized pointer, resulting in an attempt to access an invalid memory address and triggering an EXC_BAD_ACCESS exception, ultimately crashing the application. This vulnerability was discovered during the development of a security utility named “Do Not Disturb (DND)”.
Attack Chain
- Application invokes the
SecCDSAKeyCopyPublicKeyfunction within Apple’s Security framework. - An error occurs during the execution of
SecCDSAKeyCopyPublicKey, triggering aMacOSError,CommonError,std::bad_alloc, or other exception. - The
BEGIN_SECKEYAPIandEND_SECKEYAPImacros wrap the function in a try/catch block. - The catch block is executed due to the error.
- Within the catch block, the
SecErrorfunction is called. - The
SecErrorfunction receives an uninitializedCFErrorRef *errorpointer because it was declared but not assigned a valid memory address withinSecCDSAKeyCopyPublicKey. SecErrorattempts to dereference the invalidCFErrorRef *errorpointer.- This dereference operation results in an
EXC_BAD_ACCESSexception, causing the application to crash.
Impact
The vulnerability leads to application crashes on macOS. While the source does not specify the number of victims or sectors targeted, any application utilizing the vulnerable SecCDSAKeyCopyPublicKey function within Apple’s Security framework is susceptible to this crash. A successful exploitation of this vulnerability results in a denial-of-service condition for the affected application.
Recommendation
- Monitor for crash reports indicating
EXC_BAD_ACCESSexceptions originating within theSecErrorfunction of Apple’s Security framework, specifically when called fromSecCDSAKeyCopyPublicKey. - Examine the logs for exceptions or errors occurring within cryptographic functions that may trigger the described crash within
SecCDSAKeyCopyPublicKey. - Deploy the Sigma rule “Detect Security Framework Crashes due to Uninitialized Pointer” to identify potential exploitation attempts.
- Implement runtime monitoring to detect attempts to call
SecErrorwith invalidCFErrorRefpointers.
Detection coverage 2
Detect Security Framework Crashes due to Uninitialized Pointer
highDetects crashes in Apple's Security framework due to dereferencing an uninitialized CFErrorRef pointer in SecError.
Detect Security Framework Crashes
mediumDetects crashes in Apple's Security framework based on exception type and module
Detection queries are available on the platform. Get full rules →