Close this search box.

Written by: Mike Yang

Using easily available and inexpensive parts, a security researcher has been able to bypass the passcode retry restrictions on an iPhone 5C through hardware mirroring of the NAND memory.
The researcher’s technique involved several steps and quite a bit of patience and work, but eventually Sergei Skorobogatov of the University of Cambridge in the UK was able to remove the NAND Flash memory chip, backup the data on it, reinstall the chip and continue trying passcode. Skorobogatov estimates that using this technique, an attacker could brute-force a four-digit passcode on an iPhone 5C in less than 24 hours.
Skorobogatov’s technique is the first public demonstration of a hardware-based NAND mirroring attack on the iPhone and comes several months after the FBI said it wouldn’t use NAND mirroring to access a 5C used by a terrorist in the San Bernardino shooting last year. Skorobogatov began by tearing down an iPhone 5C and then removing the NAND memory chip, a very delicate and difficult process. He had to heat a special wire to about 700ºC in order to soften the epoxy holding the chip enough to remove it without damaging the components around it. He then used super-heated air and a thin-bladed knife to remove the chip from the board.
Skorobogatov then reconnected the NAND chip to the main board using short external wires and, after some trial and error, was able to restore the iPhone to its original settings through iTunes. He used an intermediate PCB board to collect the signals from the phone with an oscilloscope and logic analyzer probes. He encountered some more hardware issues, but eventually was able to capture the commands used during the boot process.

“This fully proved the correctness of the hardware NAND mirroring attack on iPhone 5c.”

This, Skorobogatov said in an email to On the Wire, was the biggest challenge for him during the project,
“The most difficult step was building an intermediate board for eavesdropping on NAND communication. This is because when a high-speed memory device is wired the signals got distorted and delayed. Getting the iPhone to work reliably while allowing to hook an oscilloscope or logic analyser took me about 2 months. Of course that wasn’t full time project as I have other ongoing projects to do and supervise,” Skorobogatov said.
After capturing and analyzing the NAND commands, Skorobogatov backed up the data on the chip to an identical NAND chip. He then tried several incorrect passcode attempts on the phone, with the original NAND chip attached, and restored the data to the original chip afterward.
“The process of NAND mirroring is relatively simple. Once the backup copy is created and verified, the original chip is plugged back into the iPhone 5c. After the power up, which takes about 35 seconds, we enter the passcode 6 times. Then the phone is powered down by holding the power button and sliding the power off message. It is necessary to wait until the power is removed from the NAND which takes about 10 seconds. Once the LED attached to the NAND goes off it is safe to remove the NAND and plug it into the test board,” Skorobogatov said in the paper.
While cloning the NAND memory, Skorobogatov ran into some problems when he discovered some hidden pages in the NAND memory that weren’t being copied. He changed his mirroring software to include those pages, and found the cloning process worked perfectly.
“As a result the newly created clone of the original NAND chip was fully functional in the iPhone 5c. It was then tested with six incorrect passcode attempts before replacing it with the original chip. After the boot process it was possible to enter the incorrect passcodes again six times until the one minute delay was introduced. This fully proved the correctness of the hardware NAND mirroring attack on iPhone 5c,” Skorobogatov said in the paper.
The entire research project took Skorobogatov about four months, he said, but he wasn’t working on it full time. He said it could’ve been done in about a month if he’d been able to devote all of his time to it. The next step in improving this attack would be to automate some of the steps, he said.
“One automation step was already confirmed yesterday after the paper submission. USB keyboard can be plugged into iPhone 5c, hence, no need to touch the iPhone screen at all. The power button will have to be wired to a control board,” Skorobogatov said in his email.
“Then full automation can be done in 2 ways: a) use the current setup but place an electrical switch between multiple NAND chips. While one is tested others can be rewritten then switched over. That will still require building a dedicated PCB but could be done within 2 weeks. B) replace NAND with full emulator based on FPGA. This will involve further analysis of undocumented NAND commands and full understanding their functinality. Very likely some challenges will delay the process, hence, most likely will take 2-3 months. However, that way a very efficient solution will be built which will not depend on reliability of real NAND samples.”
Skorobogatov said that though he has only tested this work on the iPhone 5C, the iPhone 5S and 6 both use the same type of NAND memory as the 5C. Later models use different chips and would require different hardware for this kind of attack.
Image from Flickr photo stream of Kārlis Dambrāns.