SandJacking Attack Puts iOS Devices At Risk to Rogue Apps

At Hack in the Box last week, a researcher demonstrated a new tool that swaps out legitimate iOS apps with malicious versions, beating mitigations in place on Apple devices.

Apple has yet to patch a vulnerability disclosed during last week’s Hack in the Box hacker conference in Amsterdam that allows an attacker with physical access—even on the latest versions of iOS—to swap out legitimate apps with malicious versions undetected on the device.

Researcher Chilik Tamir of mobile security company Mi3 Security disclosed last week during his talk at the show that an iOS mitigation for a previous attack he’d developed was incomplete and with a modification, he could still infect non-jailbroken iOS devices with malicious or misbehaving apps.

Apple declined to comment about the vulnerability it has known about the issue since Jan. 27. On May 23 Apple informed Tamir that it was working on a patch.

A number of factors enable this attack, starting with a change Apple instituted about six months ago in Xcode7 that allows developers to obtain a developers certificate from Apple—with restrictions—by providing an email address and Apple ID, both of which are free and simple to obtain.

Tamir’s first attack, which was publicly disclosed March 31 during Black Hat Asia in Singapore, was enabled by a tool he developed call Su-A-Cyder. Using this software, an attacker can swap out legitimate versions of apps, developed with the said certificate, in order to spy on users and gain elevated privileges on the device that expose contacts, messaging, photos, the microphone and more. So long as the malicious app had the same bundle ID as the original, the attacker was in business.

After iOS 8.3, however, Apple prevented this attack vector. Tamir, since has found a way around the mitigation with a new technique called SandJacking, which allows an attacker access to an app’s sandbox contents.

“Apple patched the front door installation process which denies an upgrade of any app with mismatched files,” Tamir said. “They forgot the backdoor, or the restore process.”

His SandJacking attack works by first backing up the device, deleting the original application and installing a rogue one. By initiating a restore from backup on the device, the device will re-emerge with the evil client, as Tamir calls it. Tamir’s attack requires, because of Apple’s modifications, that users manually approve apps. A malicious app—he demonstrated a rogue version of Skype in an interview with Threatpost—is likely to skate through unnoticed by a user and will be approved.

Tamir pointed out that while physical access to the device can be an impediment, law enforcement, malicious actors at a repair shop, or even family members wishing to spy on one another, could use Su-A-Cyder to copy an app and side-load extra functionality such as recording capabilities.

“Any iPhone repair shop becomes a pwn shop,” Tamir said. “Anyone with access to the phone can run code and install malware anonymously. You would only need the device and the passcode.”

Hackers have been able to find clever ways to scale Apple’s so-called walled garden and sneak malicious apps such as XcodeGhost, WireLurker, YiSpecter and others into the App Store and third-party download sites.

The common element in most of these incidents is that developers with Apple-issued certs from the iOS Developer Enterprise Program were able to write malicious or misbehaving apps that were trusted by Apple.

Apple’s change six months ago requiring only an email address to earn a certificate comes with limitations; apps built on this program cannot use Apple Pay, iCloud, have in-app purchase features and more. Apps, however, could be granted access to GPS location data, Health Kit, inter-application recording, wireless features and much more, all of which can be abused anonymously using Tamir’s attack, he said.

Tamir said he will release his SandJacking PoC tool once Apple patches the vulnerability.

Suggested articles