Sound Hijacking – Abusing Missing XFO
This article examines a new attack on Google Docs called Sound Hijacking, which leads to the takeover of users’ audio input devices. We investigate how the attack works and conclude with an evaluation of the importance of the X-Frame-Options Header for the attack and information on which browsers support it.
Your Information will be kept private.
Stay up to date on web security trends
Your Information will be kept private.
A Clickjacking attack works by loading a malicious website inside a low-opacity iframe and overlaying it with an innocuous looking button, checkbox or link. This tricks the user into interacting with the vulnerable website beneath. The user is then forced to click the apparently safe UI element, triggering a set of actions on the embedded vulnerable website.
These so called UI Redressing attacks, that take place when the website is loaded within an iframe, are widely discussed in the web security world. We've already discussed the Clickjacking attack and its countermeasures extensively on our HTTP Security Headers Whitepaper.
In this article, we examine research that creatively abuses a Clickjacking attack. Security researcher Raushan Raj found a new attack vector we're calling 'Sound Hijacking in Google Docs'. He realised that the lack of an X-Frame-Options header on docs.google.com could open the door for hackers to take over users’ audio input devices.
The Methodology of the Sound Hijacking Attack
Google enabled Chrome users to use their voice to 'write' into documents and sheets (Tools>Voice Typing). In his proof of concept, Raj first created an empty Google Docs file and configured the Share settings to 'On - Public on the web'. He then loaded the document in an iframe on his website:<iframe src=“https://docs.google.com/document/d/XXXXXXX/edit” allow=“microphone *”></iframe>
When visitors landed on Raj’s website, the document acted as a spying tool and began transcripting all the incoming voice from the user’s device into Raj's Docs file!
Feature Policy Mechanism
It's important to note that the allow attribute on the iframe command plays a crucial role in this scenario. This Feature Policy mechanism enables developers to control the browser features that receive user data, using commands specific to each website:- Location information
- Microphone and camera use
- Multimedia controls
- Gyroscope sensors etc
- And, more
The Importance of X-Frame-Options Header in Preventing Clickjacking Attacks
As illustrated, the lack of X-Frame-Options (XFO) header is used to exploit unique attack vectors. Here are a few notes on the X-Frame-Options header:- It should be present in the HTTP response of every page
- The frame-ancestors directive of the Content Security Policy (CSP) header can be used instead of X-Frame-Options
Content-Security-Policy: frame-ancestors 'none'; // Doesn’t load any URLs within an iframe.
Content-Security-Policy: frame-ancestors 'self'; // Has the same use as the SAMEORIGIN parameter.
The advantage of CSP over XFO is that while you can whitelist only one URL with XFO, you can whitelist multiple domains using CSP frame-ancestors. We recommend that you set one of these headers depending on the functions of your website.