How to (slowly) steal secrets over the network from chip security holes: NetSpectre summoned
Billions of devices potentially at risk – but Intel isn't worried
Computer security researchers have devised a way to exploit the speculative-execution design flaws in modern processor chips over a network connection – a possibility that sounds rather more serious but may be something less than that.
Until now, Spectre attacks have required malicious code to be running on a vulnerable machine to potentially extract passwords, keys, and other secrets, from the memory of other software on the computer.
Now, here comes NetSpectre: a technique for potentially extracting private information from another device on the network without requiring any exploit code on the target box, albeit exfiltrating it rather slowly. There are potentially billions of computers, gadgets, and gizmos at some degree of risk.
"Spectre? Psst. Who cares. You need local code execution."— The Register (@TheRegister) July 26, 2018
*record skip* pic.twitter.com/BhKXfrpY7C
Establishing a network connection to a service running exploitable snippets of code should, in theory, be enough to very slowly discern the contents of application memory remotely. This requires precise timing and constant measurement, so noisy network environments, such as the internet, will hamper exploitation to some extent.
That's the first stage. The next step is to pull out interesting data rather than grab temporary variables and other inconsequential stuff lying around in a program's memory – a step that is non-trivial.
"We show that Spectre attacks do not require local code execution but can also be mounted remotely," said Michael Schwartz, one of the NetSpectre researchers, in an email to The Register. "Moreover, with the new covert channel, we show that Spectre does not necessarily require the cache to leak values."
The major catch, described in a paper titled NetSpectre: Read Arbitrary Memory over Network, is that this side-channel attack only leaks 15 bits per hour, or 60 bits an hour via an AVX-based covert channel, which means it could take days to find and gather privileged information such as an encryption key or authentication token.
Schwartz reckons this data leakage is something people should worry about, although, admitted that the speed at which it can be conducted is a limiting factor.
"Luckily, the speed is quite limited, which makes this attack mainly interesting for targeted attacks on high-value targets," he said. "If the system is fully patched against Spectre, including the new gadget variants we show in the paper, the attack should be prevented. However, we are still at the beginning of understanding how Spectre gadgets can look like, so this is not a problem that is trivial to solve."
Spectre attacks manipulate the branch prediction mechanisms used in modern CPUs' speculative execution engines to force the target process to access memory in a way that leaks privileged information. Today's processors rely on speculative execution to run software at high speed, predicting where the flow of the program will go ahead and priming themselves with code and data in anticipation. It is possible to discern the contents of memory that is otherwise out of sight by manipulating and observing the effects of this predictive execution.
Woo-yay, Meltdown CPU fixes are here. Now, Spectre flaws will haunt tech industry for yearsREAD MORE
For a remote Spectre attack, the targeted device must include code that performs an operation such as an reading through an array in a loop with a bounds check on each iteration. The exploit abuses design decisions within the processor microarchitecture to induce speculative execution, and discern the content of memory as a result. The paper, written by Michael Schwarz, Daniel Gruss, Martin Schwarzl, Moritz Lipp, and Stefan Mangard of Austria's Graz University of Technology, calls these code fragments "Spectre gadgets."
"Similar to a local Spectre attack, our remote attack requires the presence of a Spectre gadget in the code of the target," the paper explained. "We show that systems containing the required Spectre gadgets in an exposed network interface or API can be attacked with our generic remote Spectre attack, allowing to read arbitrary memory over the network. The attacker only sends a series of crafted requests to the victim and measures the response time to leak a secret value from the victim’s memory."
The attack involves sending multiple network packets at the target with a value that's always in bounds, thereby training the branch predictor to predict the comparison as true.
Don't cross the (bit) streams
For example, given this code running on a vulnerable device:
if (x < bitstream_length) if(bitstream[x]) flag = true;
...a miscreant can attempt to use the
bitstream[x] access to extract a bit from the software's private memory. "The attacker sends a packet where x is out of bounds, such that bitstream[x] is a secret bit in the target’s memory," the paper explained.
The branch predictor then assumes the bounds check is true and the memory access is speculatively executed.
Intel, informed by the researchers of their findings earlier this year, doesn't appear to be terribly alarmed. Essentially, if you've updated your code and applications to mitigate previous Spectre exploits, you should be safe from NetSpectre.
"NetSpectre is an application of Bounds Check Bypass (CVE-2017-5753), and is mitigated in the same manner – through code inspection and modification of software to ensure a speculation stopping barrier is in place where appropriate," a spokesperson told The Register in an emailed statement.
Intel said it has updated its white paper, Analyzing Potential Bounds Check Bypass Vulnerabilities, to incorporate information related to the findings and thanked the researchers for reporting their research.
Red Hat says it has been working with the researchers and plans to publish details about the impact on its products, if any, in a blog post on Friday. "We have not identified any viable userspace Spectre gadget attacks but are actively auditing all of the daemons that listen over the network and the rest of the stack," said Jon Masters, chief Arm architect and computer microarchitecture lead at Red Hat, via Twitter.
So far, as with the other Spectre and Meltdown variants and sub-variants, no malware is exploiting these flaws in the wild, that we know of. ®
Sponsored: What next after Netezza?