Unfixable Bug found in Apple Computers

Kenny Wolf
Geek Talk
Published in
5 min readApr 1, 2024
GoFetch Bug Cover with GoFetch Dog

Scientists have recently discovered a new vulnerability on Apple Silicon chips.

The big problem is that it cannot be fixed. As the vulnerability is fixed on the chip, it cannot be patched with a software update or similar. You would have to use a new chip, and we all know how well that works on Mac computers.

The attack that has been developed is called GoFetch.

GoFetch is a microarchitectural side-channel attack that can extract secret keys from constant-time cryptographic implementations via data memory dependent prefetchers (DMP).

Wait, what?

The above paragraph is very cryptic and hard to understand, as is the research paper. For this reason, I have summarised the most important points for you and translated them in an understandable way.

In this article, I describe the GoFetch attack and what you can do about it.

GoFetch Attack

GoFetch: Breaking Constant-Time Cryptographic Implementations Using Data Memory-Dependent Prefetchers.

That’s a lot of terms I don’t know and understand. In order to understand the overall attack, let’s first dig down into the meanings of the fundamental parts this attack is based on.

Micro-architectural Side-Channel Attacks

Side channels are unintended emissions of information. — Dr. Colin O’Flynn

Dr O’Flynn explains very well in one sentence what a side channel is. Simply put, it is leaked information that indirectly provides insight into what is happening in the background.

Let’s take the Pizza Delivery Index as an example.

On 16 January 1991, Frank Meeks, owner of several Domino’s pizzas in Washington, announced that a record amount of late-night pizzas had been delivered. Similar patterns were observed prior to the invasion of Panama and Grenada.

Meeks went on to say “The increase in pizza orders at key government buildings after 10 p.m. is very unusual”.

And indeed, on 17 January 1991, the bombing of Iraq began.

The same principle works in computer science with power side channels or time side channels. Whereby the amount of voltage or the length of the response to an input can give an indication of the correctness of the input.

With a crypto ledger, for example, a PIN must be entered. The power consumption of the ledger can now be measured and analysed. Depending on the input, the power consumption is higher and therefore closer to the correct PIN. See example.

DMP — Data Memory-Dependent Prefetchers

Next on the list to clarify the method of prefetching.

I assume that you have a basic understanding of how computer hardware is structured (CPU, cache, RAM etc.). When a program makes a call, it takes the address and loads the data into the cache or registers. This loading always takes a short time.

Modern CPU manufacturers have developed the prefetch method to circumvent this process and reduce the loading time.

A loader on Apple Silicon (prefetcher) scans the memory and searches for data that looks like pointers/addresses. The prefetcher then loads the data from this pointer into the cache. This means that when a program needs variable A, it is already in the cache and can therefore be used directly.

This means that the prefetcher guesses which data will be needed in the near future. A good guess means that data is loaded faster and a miss is eliminated. A poor guess, on the other hand, leads to cache pollution and potentially to further misses.

This means that data is loaded into the cache that is not needed and thus blocks the memory for data that is actually needed.

CPU Call to load variable without prefetching
CPU Call to load prefetched variable

Constant-Time Cryptographic Implementation

Constant-time cryptography refers to a type of implementation of cryptographic algorithms in which the runtime of the algorithm remains constant regardless of the input data.

This means that the execution time of the algorithm does not depend on confidential information in the input data, which makes it more difficult to extract confidential information by timing attacks on the implementation.

Figure which shows constant time cryptographic encryption.

The Attack

So let’s go back to the beginning of the article and put together what we’ve learned.

GoFetch is a microarchitectural side-channel attack that can extract secret keys from constant-time cryptographic implementations via data memory dependent prefetchers (DMP).

The following points are important in making the attack possible:

  • The fetch itself is not constant-time, this means the cache fetch can be analysed by measuring the time.
  • There is no validation whether an object is a pointer or not, but it is loaded as long as it looks like a pointer. This mechanism is used to fill the cache with data and trigger the DMP in order to measure the time afterwards.

So the researchers use two processes in their attack. One process which encrypts data with keys and another one which fills the cache with data and analyzes the fetch times and misses.

To exploit the DMP, we craft chosen inputs to cryptographic operations, in a way where pointer-like values only appear if we have correctly guessed some bits of the secret key. We verify these guesses by monitoring whether the DMP performs a dereference through cache-timing analysis. Once we make a correct guess, we proceed to guess the next batch of key bits. — GoFetch Team

Using this approach, the researchers were able to demonstrate end-to-end key extraction attacks on popular constant-time implementations of classical (OpenSSL Diffie-Hellman Key Exchange, Go RSA decryption) and post-quantum cryptography (CRYSTALS-Kyber and CRYSTALS-Dilithium).

Conclusion

This example shows once again that even the big players in the market are not protected from vulnerabilities.

But what does this mean for Apple M-Series users?

Well, in order to launch such an attack, an attacker must already have local access to your device. If this is the case, it’s already too late anyway. That’s why it’s “half as bad”.

However, this bug is rated Medium to Severe, as it cannot be patched by a firmware update.

References

Researchers behind GoFetch: Boru Chen, Yingchen Wang, Pradyumna Shome, Christopher W. Fletcher, David Kohlbrenner, Riccardo Paccagnella, Daniel Genkin.

GoFetch Website: https://gofetch.fail/

Research Paper: https://gofetch.fail/files/gofetch.pdf

Side Channel Attack Explained: https://www.youtube.com/watch?v=D1DNz5sNDgE

--

--

Kenny Wolf
Geek Talk

I write about tech, software development and hacking for non-techies and geeks 🤓 | Software Developer 👾 | Interested in pentesting 👹