This article is more than 1 year old

Google engineer urges web devs to step up and secure their code in this data-spilling Spectre-haunted world

'This is going to be a lot of work ... a reasonable set of mitigation primitives exists today, ready and waiting for use'

After the disclosure of the 2018 Spectre family of vulnerabilities in modern microprocessor chips, hardware vendor and operating system makers scrambled to reduce the impact of data-leaking side-channel attacks designed to exploit the way chips try to predict future instructions.

Intel and others rolled out firmware patches, Linux kernel maintainers added capabilities like STIBP (Single Thread Indirect Branch Predictors), and browser makers took steps like reducing the precision of timers.

Now web security professionals are asking developers to do their part by recognizing that Spectre broke the old threat model and by writing code that reflects the new one.

The One Ring from Lord of the Rings

Intel CPU interconnects can be exploited by malware to leak encryption keys and other info, academic study finds


Last month, Mike West, a Google security engineer, drafted a note titled, "Post-Spectre Web Development," and Mozilla's Daniel Veditz of the W3C's Web Application Security Working Group asked the group to come to a consensus on supporting the recommendations. While the group has yet to formally accept the proposal, the responses on the group's mailing list suggest the advice will be adopted as a set of best practices.

West argues that Spectre demonstrated the assumptions of the web security model need to be rethought, for both browser vendors and web developers. Citing post-Spectre Chromium project guidelines, he said the open source browser project now assumes that "'active web content … will be able to read any and all data in the address space of the process that hosts it.'"

For browsers, this has meant projects like Site Isolation and Project Fission, which put web sites and associated code into separate processes so websites can't meddle with one another. And now developers have some work to do.

"The bad news is that this is going to be a lot of work, much of it falling on the shoulders of web developers," writes West. "The good news is that a reasonable set of mitigation primitives exists today, ready and waiting for use."

We should mention that we've yet to see a Spectre exploit being used in the wild to attack and steal data from a significant number of victims, so this advice seems to us more to be heading off potential future danger.

Five step program

West makes five general recommendations, which require devs to pay attention to the walls, or lack thereof, between different web resources.

First, developers should decide when their code responds or doesn't respond to incoming requests by examining incoming request headers, in accordance with the desired resource isolation policy.

Second, they should set a cross-origin resource policy (CORP) to restrict an attacker's ability to load your data as a subresource.

Third, web devs should prevent attackers from framing website data using framing protections.

Fourth, they're advised to make sure attackers can't obtain a reference or handle to a site's window object by setting a cross-origin opener policy (COOP).

And fifth, they're directed to implement defenses against MIME-type confusion attacks using mechanisms like cross-origin read blocking (CORB) and opaque response blocking (ORB) to set appropriate defensive Content-Type headers.

Without defenses like these, an attacker, for example, might be able to craft a malicious web page that refers to a JSON file as a linked image. When the page is visited, the file data would be passed to the browser's render process but wouldn't be rendered because it's not properly formatted image data. Nonetheless, the JSON could be read in memory through a Spectre exploit, potentially leading to a breach of confidentiality or security.

CORB, in this instance, could prevent the JSON from being stored in memory because it doesn't have the MIME-type of an image.

Now it's just a matter of convincing web devs to take the time to make sure their code is secure. We'll let you know when that happens. ®

More about


Send us news

Other stories you might like