Voice recording is one of the most important features of instant messaging systems, it allows users to rapidly send messages in an easy way avoiding typing them. WhatsApp, Facebook Messenger, and others implement it.
The Egyptian security expert Mohamed A. Baset discovered a flaw in the Facebook Messenger audio clip recording feature that could be exploited to conduct a man-in-the-middle attack in order to capture audio clip files and listen to your personal voice messages. Unfortunately, Facebook still hasn’t patched the vulnerability.
— Mohamed A. Baset (@SymbianSyMoh) January 17, 2017
Colleagues at TheHackerNews reported a technical description of the attack. Everytime users record a clip and send it to the recipient it is uploaded onto the Facebook’s CDN server.
“Whenever you record an audio clip (video message) to send it to your friend, the clip gets uploaded onto the Facebook’s CDN server (i.e., https://z-1-cdn.fbsbx.com/…), from where it serves the same audio file, over HTTPS, to both the sender as well as the receiver.” states THN.
An attacker that shares the same network segment could launch a MITM attack with SSL Strip. A hacker can extract absolute links, including secret authentication token embedded in the URL, to all audio files exchanged between the sender and receiver.
The attacker can modify the links from HTTPS to HTTP to download files without any authentication, this is possible because the Facebook CDN server does not force HTTP Strict Transport Security (HSTS) policy making possible communications through HTTP connections.
Another problem is the lack of proper authentication, the expert highlighted that if a file has been shared between two Facebook users it should not be accessible by others, even if a third party has the absolute URL to the resource (which includes a secret token to access that file).
Mohamed A. Baset provided a proof-of-concept for the attack by sending an audio clip to one of his friends over Facebook Messenger, below the absolute link to the audio file extracted using MITM attack.
Anyone can download it from the Facebook platform even if he/she is not authenticated.
“GET requests are something that the browsers can remember it in its cache also in its history, Better to have this files played via POST requests with an anti-CSRF token implemented,” Mohamed told The Hacker News.
The bad news is that Mohamed was not awarded for his discovery because Facebook doesn’t want to pay for such kind of loopholes.
“We are in the process of rolling out HSTS across various facebook.com subdomains. The fact that we have not rolled it out on particular subdomains does not constitute a valid report under our program.” is the reply provided by Facebook to the expert.
“In general, sending in reports that claim we should be using defense-in-depth mechanisms like HSTS will not qualify under our program. We make very deliberate decisions about when we roll out (or not) particular protections and so reports suggesting that we make changes there generally do not qualify.”
Facebook still hasn’t patched the flaw and I hope it will give a payoff to the Egyptian expert for his work. yet.
Below a video PoC of the attack.
(Security Affairs – Facebook Messenger, hacking)