5 ms·
This is a fundamental security issue due to a combination of the OAuth protocol and UIWebView (and whatever the Android equivalent is), which I've posted about
by chatmasta 10y ago
This is a fundamental security issue due to a combination of the OAuth protocol and UIWebView (and whatever the Android equivalent is), which I've posted about before [0]. Basically, the problem is that OAuth depends on web-based access granting, but an app has full permissions over the DOM of the WebView where the OAuth screen is. So you're entering your password into a WebView of a third party URL, but unlike a traditional safari page, the WebView is fully "owned" by the app, so the developers can inject arbitrary code into the DOM of the third party website.
There is no technical limitation to an app engaging in very nefarious activity. For example an app could modify the DOM on the sign-in screen to grab your password after you enter it. Of course the accountability of MITM and security reviews might mitigate this risk, but passwords are generally only a few bytes and could easily be obfuscated and passed surreptitiously over the wire.
I've seen a (quite popular) app implement this for facebook invitations, which should only have a limit of 50 friends, to secretly (in the background, without any action on your behalf other than logging in, or perhaps pressing a "continue" button) invite every one of your friends to download the app. Since facebook does not notify you when you send an inviation, you would not even know the app did this unless one of your friends who you invited asked you about it.
[0] https://news.ycombinator.com/item?id=11637209 https://news.ycombinator.com/item?id=11637209 (thanks molecule)
- molecule 10y ago> how do I permalink to a comment? The comment's timestamp is a link.
- crescentfresh 10y ago> the WebView is fully "owned" by the app, so the developers can inject arbitrary code into the DOM of the third party website Uh, seriously? I just suggested to our mobile team to integrate this way on Android (I implemented the OAuth 2 server). I would've made the same suggestion to a 3rd party app vendor when the day comes.
- russjr08 10y agoA Chrome Custom Tab is probably the better way to go.
- deleted 10y ago[deleted]
- KirinDave 10y agoIn summary, if you give a nefarious app your password it can do a nefarious thing? I'm curious how exactly this is specific to the UIWebView implementation.
- skewart 10y agoIt's because the app has access to and control over the DOM of the UIWebView. Suppose some app called EvilGameFoo is asking you to authenticate with your Google account. They should kick you to a UI controlled by Google, which EvilGameFoo cannot in any way inspect or access, where you enter your credentials. Google then tells EvilGameFoo that they can vouch for you. Instead, UIWebView lets the app asking you to sign in via an identity provider inspect the DOM of the UK where you enter your credentials. Hence it lets EvilGameFoo read your password.
- bradleyjg 10y agoHow are you supposed to know that it is actually a UI controlled by google and not a simulation of a UI controlled by google? The OAuth model not only enables phishing directly even worse than that, it disarms people's natural skepticism towards phishing attempts. Its adoption was a terrible idea.
- skewart 10y agoWell, on the web you're generally following redirects to a URL. You can verify the owner and authenticity of the host. (A phone app could kick you out to a browser app (not a web view) to authenticate.) Then after you've signed in and granted permission on, say, Google, Google will redirect you to a URL that the other app configured with Google. On a phone that URL should have a host or protocol that the app has registered with so your phone's OS will kick you back to the app after you signed in on the web browser. Of course, you're absolutely right that it would be trivial to spoof, say, Google or Facebook or Twitter and collect credentials. I would _hope_ that behavior would be detected by Apple or Google during app security screening, but maybe not. Regardless, I totally agree with you about OAuth and security. It does present a lot of problems.
- jonny_eh 10y agoIf an app does this, won't Google revoke their API key?
- ceejayoz 10y agoThey have to detect it. The app could quietly collect credentials for months/years, and revoking the API key won't change those passwords.
- qzervaas 10y agoIn iOS 9 there is SFSafariViewController which doesn't give such control. Some providers (e.g. Fitbit) require you use this instead of UIWebView in order to access their API, presumably to avoid accessing the DOM. Not sure exactly how they are enforcing this though, since they don't provide their own OAuth library.
- chatmasta 10y agoYeah, you could always override the method in the Fitbit library that implements that requirement.