Vulnerabilities / Threats

6/12/2018
03:33 PM
Connect Directly
Twitter
LinkedIn
Google+
RSS
E-Mail
50%
50%

MacOS Bypass Flaw Lets Attackers Sign Malicious Code as Apple

A security bypass weakness in macOS APIs let attackers impersonate Apple to sign malicious code and evade third-party security tools.

When is Apple-signed code not actually signed by Apple? When a hacker can manipulate the code-signing process to impersonate Apple and sign off on malicious code, bypassing common third-party security tools and tricking users into thinking illegitimate software is verified.

Such a bypass attack has been possible for years on macOS and older versions of OS X, thanks to a flaw in Apple code-signing APIs, explains Josh Pitts, staff engineer for research and exploitation at Okta. Pitts discovered the bypass flaw in third-party developers' interpretation of the APIs, which let unsigned malicious code appear as though it was verified by Apple and remain on a Mac until it was patched.

Operating systems use digital signatures to verify whether the code has been signed off by a trusted origin and hasn't been modified. Security tools use signed code for whitelisting, antivirus, incident response, and threat hunting. Detection and response teams use it to weed out untrusted code. The way many macOS security tools verify signatures has been fairly simple to bypass. As a result, popular security tools think Apple signed off on code when it hasn't.

"This really worried me a lot," says Pitts. "This allows an attacker to stay on a workstation … it's a nice way to hide in plain sight."

An attacker wouldn't need administrative access or memory corruption to bypass these code-signing checks, but several conditions need to be in place before an exploit would work.

Digging into the Details

On Windows, you can cryptographically sign "just about everything" from .NET binaries to PowerShell scripts, Pitts explains. On macOS and iOS, code signing focuses on the Mach-O binary and application bundles, which make sure only trusted code is executed in memory.

Here, the flaw exists in the difference between how the Mach-O loader loads signed code, and how improperly used code-signing APIs check the code. Attackers can exploit the vulnerability with a malformed Universal/Fat Binary, which is a binary format containing several Mach-O files. Each of these files targets a CPU architecture (i386, x86_64, PPC), found on Macs.

The following must be true for an exploit to work: Only the first Mach-O in the Fat/Universal file has to be signed by Apple. The malicious binary, or non-Apple code, must be adhoc signed and i386 compiled for an x86_64 bit target machine. The CPU_TYPE in the Fat header of the Apple binary must be set to an invalid type or CPU type not native to the host chipset.

Developers typically check the Mach-O binary or Fat/Universal binary with these APIs: SecStaticCodeCheckValidityWithErrors() or SecStaticCodeCheckValidity(). Flags -- kSecCSStrictValidate and KSecCSCheckAllArchitectures. The flags are supposed to ensure all code is cryptographically signed. However, Pitts says, the APIs "fall short by default."

Apple's code-signing APIs check the first binary for who signed the code, and then check the following binaries in the Fat/Universal file without verifying the CA root of trust. As a result, malicious code could slip past security software and get onto a target Mac. Third-party security, forensics, and incident response tools that use the official code-signing APIs are potentially affected.

An attacker could begin a successful bypass through a file-sharing or phishing attack. Once they're in, "whatever the user has access to, the malware can get access to," Pitts explains. This could include sensitive files containing personally identifiable information or financial data.

"To undermine a code signing implementation for a major OS would break a core security construct that many depend on for day to day security operations," writes Pitts in a blog post.

Affected Vendors and Available Patches

Security tools built into macOS are not exposed, and affected vendors and open-source projects have been alerted to the bypass, Okta reports. Developers are responsible for properly using the code-signing API, and POCs are released to help test their code.

Here are the affected vendors:

  • VirusTotal (CVE-2018-10408)
  • Google - Santa, molcodesignchecker (CVE-2018-10405)
  • Facebook - OSQuery (CVE-2018-6336)
  • Objective Development - LittleSnitch (CVE-2018-10470)
  • F-Secure - xFence, also LittleFocker (CVE-2018-10403)
  • Objective-See - WhatsYourSign, ProcInfo, KnockKnock, LuLu, TaskExplorer, others (CVE-2018-10404)
  • Yelp - OSXCollector (CVE-2018-10406)
  • Carbon Black - Cb Response (CVE-2018-10407)

Mac users should apply all necessary fixes to protect against malicious software that tries to manipulate the code-signing process. "If enterprises are using illicit software, they need to update," Pitts emphasizes.

Related Content:

 

Top industry experts will offer a range of information and insight on who the bad guys are – and why they might be targeting your enterprise. Click for more information

Kelly Sheridan is the Staff Editor at Dark Reading, where she focuses on cybersecurity news and analysis. She is a business technology journalist who previously reported for InformationWeek, where she covered Microsoft, and Insurance & Technology, where she covered financial ... View Full Bio

Comment  | 
Print  | 
More Insights
Comments
Oldest First  |  Newest First  |  Threaded View
Why CISOs Need a Security Reality Check
Joel Fulton, Chief Information Security Officer for Splunk,  6/13/2018
Cisco Talos Summit: Network Defenders Not Serious Enough About Attacks
Curtis Franklin Jr., Senior Editor at Dark Reading,  6/13/2018
Four Faces of Fraud: Identity, 'Fake' Identity, Ransomware & Digital
David Shefter, Chief Technology Officer at Ziften Technologies,  6/14/2018
Register for Dark Reading Newsletters
White Papers
Video
Cartoon
Current Issue
Flash Poll
Twitter Feed
Dark Reading - Bug Report
Bug Report
Enterprise Vulnerabilities
From DHS/US-CERT's National Vulnerability Database
CVE-2018-8030
PUBLISHED: 2018-06-20
A Denial of Service vulnerability was found in Apache Qpid Broker-J versions 7.0.0-7.0.4 when AMQP protocols 0-8, 0-9 or 0-91 are used to publish messages with size greater than allowed maximum message size limit (100MB by default). The broker crashes due to the defect. AMQP protocols 0-10 and 1.0 a...
CVE-2018-1117
PUBLISHED: 2018-06-20
ovirt-ansible-roles before version 1.0.6 has a vulnerability due to a missing no_log directive, resulting in the 'Add oVirt Provider to ManageIQ/CloudForms' playbook inadvertently disclosing admin passwords in the provisioning log. In an environment where logs are shared with other parties, this cou...
CVE-2018-11701
PUBLISHED: 2018-06-20
FastStone Image Viewer 6.2 has a User Mode Write AV at 0x005cb509, triggered when the user opens a malformed JPEG file that is mishandled by FSViewer.exe. Attackers could exploit this issue for DoS (Access Violation) or possibly unspecified other impact.
CVE-2018-11702
PUBLISHED: 2018-06-20
FastStone Image Viewer 6.2 has a User Mode Write AV at 0x00578cb3, triggered when the user opens a malformed JPEG file that is mishandled by FSViewer.exe. Attackers could exploit this issue for DoS (Access Violation) or possibly unspecified other impact.
CVE-2018-11703
PUBLISHED: 2018-06-20
FastStone Image Viewer 6.2 has a User Mode Write AV at 0x00402d6a, triggered when the user opens a malformed JPEG file that is mishandled by FSViewer.exe. Attackers could exploit this issue for DoS (Access Violation) or possibly unspecified other impact.