Patrick Wardle, the popular white hat hacker and chief research officer at Digita Security, has discovered a zero-day vulnerability that could allow attackers to mimic mouse-clicks for kernel access.
Wardle presented his discovery during the Def Con 2018 conference in Las Vegas, he explained that by using two lines of code he found an Apple zero-day in the High Sierra operating system that could allow a local attacker to virtually “click” a security prompt and thus load a kernel extension.
Once obtained the Kernel access on a Mac, the attack can fully compromise the system.
Apple has already in place security measures to prevent attackers from mimicking mouse-clicks for approving security prompts presented to the user when attempting to perform tasks that can potentially expose to risks the system.
Patrick Wardle has discovered a flaw that allows attackers to bypass such kind of security measures through Synthetic Mouse-Click attacks.
Good morning @Defcon attendees ☀️
My talk, "? > ⚔️" is today:
"The Mouse is Mightier than the Sword"
Sunday 10:00, 101 Track, Flamingo
Includes new bypasses of privacy controls & 0day breaking 'User Assisted Kext Loading' ???
See you there ? https://t.co/9iDWuPniwI
— patrick wardle (@patrickwardle) August 12, 2018
Wardle recently demonstrated that a local, privileged attacker could leverage vulnerabilities in third-party kernel extensions to bypass Apple’s kernel code-signing requirements.
Malware developers and hackers have started using synthetic mouse-click attacks to bypass this security mechanism and emulate human behavior in approving security warnings.
Apple mitigated the attack devised by Wardle by implementing a new security feature dubbed “User Assisted Kernel Extension Loading,” a measure that force users to manually approve the loading of any kernel extension by clicking the “allow” button in the security settings UI.
The latest macOS versions, including High Sierra introduced a filtering mechanism to ignore synthetic events.
“Before an attacker can load a (signed) kernel extension, the user has to click an ‘allow’ button. This recent security mechanism is designed to prevent rogue attacks from loading code into the kernel. If this mechanism is bypassed it’s game over,” Wardle explained.
Wardle discovered that is it possible to deceive macOS by using two consecutive synthetic mouse “down” events because the operating system wrongly interprets them as a manual approval.
“For some unknown reason the two synthetic mouse ‘down’ events confuse the system and the OS sees it as a legitimate click,” Wardle said. “This fully breaks a foundational security mechanism of High Sierra.”
The expert explained that the operating system confuses a sequence of two-down as mouse “down” and “up.” The OS also confuse the “up” event as an internal event and for this reason, it is not filtered and it can be abused to interact with High Sierra’s user interface allowing to load kernel extensions.
Wardle accident discovered the issue by copying and pasting code for a synthetic mouse down twice.
“I was just kind of goofing around with this feature. I copied and pasted the code for a synthetic mouse down twice accidentally – forgetting to change a value of a flag that would indicate a mouse “up” event. Without realizing my ‘mistake,’ I compiled and ran the code, and honestly was rather surprised when it generated an allowed synthetic click!”
“Two lines of code completely break this security mechanism,” he added. “It is truly mind-boggling that such a trivial attack is successful. I’m almost embarrassed to talk about the bug as it’s so simple — though I’m actually more embarrassed for Apple.”
According to Wardle, the issue only affects High Sierra, because it is the using OS version that implements the Apple’s User Assisted Kernel Extension Loading.
The Wardle’s presentation is available at the following URL: