RTFM 0day in iOS apps: G+, Gmail, FB Messenger, etc.


Update:

Turns out Guillaume K. Ross also had related discoveries.
Check his presentation here: http://www.irongeek.com/i.php?page=videos/bsideslasvegas2014/pg10-ios-url-schemes-omg-guillaume-k-ross
Follow him: @gepeto42

Intro

Normal people spend their nights watching movies, reading articles, socializing or (yes, I know it's odd) sleeping.

I spend my nights reading RFCs and pentesting various applications/services.

One night I was randomly reading the tel URI scheme RFC as I am fascinated by old relics that are still used today, their flaws and the way people never read the RFC which leads to RTFM pwnage as I call it.

Let's try it out

As I finished reading the tel RFC I looked at my iPhone and said: Cool, let's try it out!. I instacoded a small html page and loaded it in Safari, here is the code:

image

As I clicked the click me link I was prompted with a nice dialog asking me if I really want to call 0000.

Apple

I didn't have much as this point and I was not looking for a security issue, just trying out the tel thing. As Apple likes to change stuff and make it better I thought: Hey, maybe Apple has its own RFC for tel!. And I was right: here it is.

The one line I fall in love with

Apple's documentation on the tel scheme is really short and easy to read. While reading the first paragraph something caught my attention:

When a user taps a telephone link in a webpage, iOS displays an alert asking if the user really wants to dial the phone number and initiates dialing if the user accepts. When a user opens a URL with the tel scheme in a native app, iOS does not display an alert and initiates dialing without further prompting the user.

So if I click the link in Safari I get the prompt asking me to confirm my action, if I click the link in a native app's webView it doesn't ask and performs the action right away (makes the call).

Do people read documentation?

No. And it's bad.

I instantly assumed people do read documentation so there was no way a big player like Facebook, Twitter, Google, LinkedIn, etc. would do such a silly mistake... but I was wrong.

Testing on Facebook Messenger

I sent the page link through Facebook Messeger, clicked it to get to the webView (social apps don't want you to ever leave the app and that's why the use webViews) and then clicked the sneaky click me link:

So clicking on the link initiates the call right away. Hold on... that's bad.

Making the link click itself

A lot of people make fake assumptions such as links are only clicked by users. Using some sneaky-beaky-like javascript I quickly made the link click itself:

image

Watch what happens:

image

Note: you can also do this server-side by redirecting the user to a tel location: header("Location: tel://0000")

So how is this a security issue?

I can make you call a phone number by clicking a link in any app that didn't implement custom handling for tel links.

Imagine I register a premium-rate phone number and then I send you the link on Facebook Messenger or Twitter. You click it and call me, I pick up instantly and charge you.

Facetime: "Hello pretty!" attack

I just made out the name for this attack, it's cool right? Facetime also had a URL scheme just like tel, and you can use it the same way. Needless to say it's vulnerable to the same exploit.

Facetime calls are instant. Imagine you clicking a link, your phone calls my (attacker) account, I instantly pick it up and (yes) save all the frames. Now I know how your face looks like and maybe where you are. Hello pretty!

Yes, it works. I tried.

This is wrong! Who did the mistake?

Well Apple did not. People didn't read the documentation at all. The first paragraph of the tel docs says what, when and how happens and also clearely specifies that However, a native app can be configured to display its own alert.

Who didn't RTFM?

Facebook Messenger

image

Gmail

image

Google+

image

Everybody...

Beware

While I only tested on a few apps which are big names, it is safe to assume that the smaller teams and platform haven't even thought about preventing this.

Comment on this on Hacker News

Here is the link: https://news.ycombinator.com/item?id=8208244