Saturday, January 20, 2024

Security And Privacy Of Social Logins (III): Privacy In Single Sign-On Protocols

 This post is the second out of three blog posts summarizing my (Louis Jannett) research on the design, security, and privacy of real-world Single Sign-On (SSO) implementations. It is based on my master's thesis that I wrote between April and October 2020 at the Chair for Network and Data Security.

We structured this blog post series into three parts according to the research questions of my master's thesis: Single Sign-On Protocols in the Wild, PostMessage Security in Single Sign-On, and Privacy in Single Sign-On Protocols.

Overview

Part I: Single Sign-On Protocols in the Wild

Although previous work uncovered various security flaws in SSO, it did not work out uniform protocol descriptions of real-world SSO implementations. We summarize our in-depth analyses of Apple, Google, and Facebook SSO. We also refer to the sections of the thesis that provide more detailed insights into the protocol flows and messages.
It turned out that the postMessage API is commonly used in real-world SSO implementations. We introduce the reasons for this and propose security best practices on how to implement postMessage in SSO. Further, we present vulnerabilities on top-visited websites that caused DOM-based XSS and account takeovers due to insecure use of postMessage in SSO.

Part III: Privacy in Single Sign-On Protocols

Identity Providers (IdPs) use "zero-click" authentication flows to automatically sign in the user on the Service Provider (SP) once it is logged in on the IdP and has consented. We show that these flows can harm user privacy and enable new targeted deanonymization attacks of the user's identity.

Introduction to XS-Leaks in Single Sign-On

Cross-site leak (XS-Leak) refers to a family of browser side-channel techniques that can be used to infer and gather information about users [...]. While the deanonymization capabilities of XS-Leak attacks are only just being realized, some researchers have said the technique will soon be in the OWASP Top 10. 

In SSO setups, redirects can leak private information about the user. Thus, we focused on XS-Leaks that detect cross-origin redirects, i.e., whether a cross-origin request returns an `HTTP/200` or `HTTP/302` response. In this post, we present an XS-Leak that is based on the Fetch API and detects cross-origin redirects with 100% accuracy. The following method expects a URL, sends a GET request, and finally returns `true` if the response is a redirect or `false` if the response is no redirect:
// let is_redirect = await xs_leak_redirect("<URL>");  async function xs_leak_redirect(url) { 	let res = await fetch(url, { 		mode: "cors", 		credentials: "include", 		redirect: "manual" 	}).then( (response) => { 		if (response.type == "opaqueredirect") { 			return true; 		} 	}).catch( (error) => { 		return false; 	}); 	return res; } 

More details are provided in Section 5.1.4.1 of the thesis.

XS-Leaks in Single Sign-On: Account Leakage Attack

With the account leakage attack, the attacker can determine whether the victim has an account on a targeted SP with a certain IdP. Specifically, the attacker checks whether the victim has granted consent to the targeted SP with the IdP. This attack is scalable: The attacker can test multiple (SP, IdP) pairs and check for which pair the victim has an account on the SP. The following prerequisites must hold:
  • The victim visits an attacker-controlled website.
  • The victim is signed-in on the IdP (i.e., in Google Chrome with its Google account).
  • The IdP supports the standardized `prompt=none` parameter.
The attack idea is simple: Let's assume the attacker wants to know whether the victim has an account on SP `sp.com` with the IdP `idp.com`. The attacker first tricks the victim into visiting its malicious website `attacker.com`. We further assume that the victim has an active session on the IdP. Then, the attacker constructs an Authentication Request URL, as shown in the figure below. Note that the SP `sp.com` has the `client_id=superSecretClient` on the IdP, the `redirect_uri` is set to `sp.com/redirect`, and the `prompt=none` parameter is set. 
From the attacker's website, a cross-origin `Fetch` request is sent to that URL as shown before. If the `prompt=none` flow is requested with established consent on the SP, the IdP returns the Authentication Response as an `HTTP/302` redirect to the `redirect_uri`. If the victim has not granted the SP's consent, the IdP returns the consent page with an `HTTP/200` response and asks the user to grant the consent. Thus, based on whether the victim has or has not an account on `sp.com`, the IdP returns an `HTTP/302` redirect or an `HTTP/200` response. Although the Same Origin Policy prevents us from viewing the response from `idp.com`, we can use the XS-Leak to detect whether a redirect was performed or not. If a redirect was performed, the victim has an account on `sp.com` with the IdP. If no redirect was performed, the victim has no account.

We tested this attack with the Apple, Google, and Facebook IdP. It only works for Google and Facebook since Apple requires user interaction in each flow. A working PoC is provided on https://xsleak.sso.louisjannett.de. If the "Start" button is clicked, the website checks if you have an account on adobe.com, ebay.com, imdb.com, medium.com, or vimeo.com using either the Google or Facebook IdP. Make sure that you are signed in at Google and Facebook before testing and enable third-party cookies.

To circumvent this attack, the IdP must return an error as `HTTP/302` redirect if the `prompt=none` flow is requested, but no consent is given. This mitigation is described in the OpenID Connect specification, but as shown, not adopted by real-world IdPs.

More details are provided in Section 5.1 of the thesis.

XS-Leaks in Single Sign-On: Identity Leakage Attack

The identity leakage attack extends the account leakage attack by the `login_hint` parameter. The attacker can determine whether the victim has a certain identity on a targeted IdP. The attacker can use this information to check if a certain person is visiting its website. Therefore, all prerequisites of the account leakage attack must hold and the IdP must support the standardized `login_hint` parameter.

Once a victim visits the malicious website, the attacker must initially guess an (SP, IdP) pair that the victim most likely gave consent to, i.e., that causes the IdP in the `prompt=none` flow to return a redirect to `sp.com/redirect`. The attacker can use the account leakage attack to determine such a pair by testing the most-popular SPs and IdPs. Then, a new Authentication Request is created, and the `login_hint` parameter is set to the email address of the victim, i.e., `alice@example.com`. The attacker sends the Fetch request and determines whether the IdP returns an `HTTP/302` redirect or an `HTTP/200` response. If a redirect was performed, the attacker knows that the Authentication Request was valid, and thus the victim is `alice@example.com`. If no redirect was performed, the victim is not `alice@example.com`. The success of this attack depends on whether the attacker can guess (or eventually knows) an (SP, IdP) pair that the targeted victim gave consent to.

We tested this attack with the Apple, Google, and Facebook IdP. It only works for Google since Apple does not support the `prompt=none` flow, and Facebook does not support the `login_hint` parameter. We discovered that the `login_hint` parameter must contain a valid email address registered at Google. Otherwise, this parameter is ignored.


To mitigate this leakage, the IdP must return an error as `HTTP/302` redirect if a `login_hint` parameter is queried that the user does not own. We did not find any information about the `login_hint` parameter in the OpenID Connect specification that proposes guidelines for this scenario.

More details are provided in Sections 5.1 of the thesis.

Automatic Sign-In and Session Management Practices in the Wild

Following the observations of the account leakage and identity leakage attacks, we analyzed "zero-click" SSO flows in terms of automatic sign-in features provided by the IdPs with their SDKs. We found that under certain assumptions, the SDKs can be configured to automatically sign in the user on the SP even though the user did not click on the sign-in button and may not notice the sign-in process.

Google and Facebook support automatic sign-in with their SSO SDKs: Google Sign-In, Google One Tap, and Facebook Login. They follow a similar approach: The user visits the SP website that integrates and initializes the SDK with automatic sign-in enabled. Suppose the user has an active session on the IdP, valid consent for the SP, and third-party cookies enabled. In that case, the SDK first retrieves a logout state from browser storage to determine whether the user signed out previously using the SDK's sign-out method. If the logout state is set to false or does not exist, the SDK returns the Authentication Response to the SP website, i.e., to a registered callback. If it is set to true, the SDK does not proceed with the automatic sign-in and instead requires the user to click on the sign-in button. Thus, the execution of the automatic sign-in flow depends on the stored logout state. If the browser storage is cleared (i.e., cookies are deleted or a private window is opened), the logout state does not exist, and thus the automatic sign-in is enabled.

Note that the logout state is only a feature provided by the SDKs to stop unwanted sign-in operations on the SP. They do not prevent the SP from secretly receiving tokens from the IdP. If the SP does not use the SDK's sign-out method, the logout state will never be set to true. Alternatively, the SP may manually request the tokens from the IdP in the background without paying attention to any logout state. Note that this automatic sign-in flow is different than the standardized `prompt=none` flow because it returns the tokens in the background (i.e., via Fetch requests), whereas the `prompt=none` flow requires a redirect that is in some form visible to the user.

Google and Facebook use different approaches to receive the Authentication Response in the background. Google sends a `getTokenResponse` RPC from the SP website to its proxy iframe and receives the tokens with postMessage. Facebook issues a simple CORS request and receives the tokens in the CORS response.

For instance, SPs can send the following CORS request with the Fetch API to Facebook:
GET /x/oauth/status?client_id=<CLIENT_ID> HTTP/1.1 Host: www.facebook.com Origin: https://sp.com Cookie: c_user=REDACTED; xs=REDACTED; 

If the user has an active session at Facebook (i.e., cookies are set) and valid consent, Facebook responds with a CORS response and explicitly allows the SP to read the `fb-ar` header that contains the tokens:
HTTP/1.1 200 OK Access-Control-Allow-Origin: https://sp.com Access-Control-Allow-Credentials: true Access-Control-Expose-Headers: fb-ar,fb-s fb-s: connected fb-ar: {"user_id": "REDACTED", "access_token": "REDACTED", "signed_request": "REDACTED"} 

We tested the automatic sign-in on top-visited SPs and found that some of them implement it as expected. For instance, `change.org` supports automatic sign-in with Facebook: First, we open `change.org` without being logged in on Facebook. Thus, we are not signed-in automatically. Then, we log in on Facebook and reload `change.org`. As shown, `change.org` uses the CORS request to receive the tokens from Facebook and finally logs us in. The user interface does not indicate that we were just signed in. Only the small profile picture in the top right corner is added to the UI.


More details and examples of automatic sign-in flows are provided in Section 5.3 of the thesis.

Acknowledgments

My thesis was supervised by Christian MainkaVladislav Mladenov, and Jörg Schwenk. Huge "thank you" for your continuous support, advice, and dozens of helpful tips. 
Also, special thanks to Lauritz for his feedback on this post and valuable discussions during the research. Check out his blog post series on Real-life OIDC Security as well.

Authors of this Post

Louis Jannett

Related news


  1. Hacker Tools 2019
  2. Hack Tools For Pc
  3. Free Pentest Tools For Windows
  4. Best Hacking Tools 2020
  5. Top Pentest Tools
  6. How To Install Pentest Tools In Ubuntu
  7. Hack Tools 2019
  8. Top Pentest Tools
  9. Hacks And Tools
  10. Hack Tools Github
  11. Pentest Box Tools Download
  12. Pentest Tools For Android
  13. Pentest Tools Find Subdomains
  14. Hack Apps
  15. Hacker Tools For Ios
  16. Hacker Tools For Pc
  17. Hacking Tools For Games
  18. Hack Tools
  19. Ethical Hacker Tools
  20. Hack Tools For Pc
  21. Pentest Tools Nmap
  22. Hak5 Tools
  23. Hack Tools 2019
  24. Hacker Tools For Windows
  25. Hacker Tools Hardware
  26. Hacking Tools For Kali Linux
  27. Hacking Tools For Mac
  28. Pentest Tools Subdomain
  29. Hack And Tools
  30. Pentest Tools Website
  31. Pentest Tools Open Source
  32. Pentest Tools Github
  33. Pentest Tools Port Scanner
  34. Hack Tool Apk No Root
  35. Hacking Tools For Windows
  36. Hack Tools
  37. Kik Hack Tools
  38. How To Hack
  39. Pentest Tools For Android
  40. Pentest Tools Kali Linux
  41. Hacking Tools And Software
  42. How To Make Hacking Tools
  43. Pentest Tools Tcp Port Scanner
  44. Ethical Hacker Tools
  45. How To Make Hacking Tools
  46. Hacker Tools Software
  47. Hacking Tools
  48. Hacking Tools Kit
  49. Hack Tools Pc
  50. Hacking Tools Online
  51. Hacker Tools For Pc
  52. How To Make Hacking Tools
  53. Pentest Tools Review
  54. Nsa Hack Tools
  55. Hacker Security Tools
  56. Hack And Tools
  57. Github Hacking Tools
  58. What Are Hacking Tools
  59. Hacking Tools 2019
  60. Best Hacking Tools 2019
  61. Pentest Tools Bluekeep
  62. Hacking Tools Windows
  63. Hacking Tools Windows
  64. New Hack Tools
  65. Hak5 Tools
  66. Hacker Tools Free
  67. Hacking Tools For Beginners
  68. Hack Tools 2019
  69. Termux Hacking Tools 2019
  70. Pentest Tools For Windows
  71. Hack Tools Pc
  72. Best Hacking Tools 2020
  73. Physical Pentest Tools
  74. Tools For Hacker
  75. Easy Hack Tools
  76. Hacking Tools For Games
  77. Hacker Tools Github
  78. Hacker Tools Github
  79. Pentest Tools List
  80. How To Hack
  81. Hacker Tools Free
  82. Hacking Tools For Kali Linux
  83. Pentest Tools Alternative
  84. Hacking Tools Name
  85. Hack Tools Pc
  86. Hacker Tools
  87. Pentest Tools Github
  88. Hacking Tools For Windows 7
  89. What Is Hacking Tools
  90. Pentest Tools Framework
  91. Pentest Tools Review
  92. Hacker Tools For Mac
  93. Hacking Tools For Windows
  94. Pentest Tools Url Fuzzer
  95. Hacker Search Tools
  96. World No 1 Hacker Software
  97. Top Pentest Tools
  98. What Are Hacking Tools
  99. Pentest Tools Review
  100. Hacking Tools Usb
  101. Nsa Hack Tools Download
  102. Hacking Tools Mac
  103. Kik Hack Tools
  104. Pentest Tools Website Vulnerability
  105. Hacker Tool Kit
  106. Nsa Hack Tools
  107. Hack App
  108. Pentest Tools Subdomain
  109. Hacks And Tools
  110. Beginner Hacker Tools
  111. Computer Hacker
  112. Pentest Tools
  113. Pentest Tools
  114. How To Make Hacking Tools
  115. Hacking Tools For Mac
  116. Pentest Tools Nmap
  117. Android Hack Tools Github
  118. Best Hacking Tools 2020
  119. Hacker Tools
  120. Hack Tool Apk
  121. Pentest Tools Find Subdomains
  122. Pentest Tools Apk
  123. Pentest Tools For Mac
  124. Hack Tools
  125. Hacker Techniques Tools And Incident Handling
  126. Pentest Tools Online
  127. Hack Tools For Games
  128. Hacking Tools Free Download
  129. Hacker Tools Apk
  130. Hack Tools For Mac
  131. Hacking Tools Pc
  132. Pentest Recon Tools
  133. Hacker Tools For Windows
  134. Pentest Tools Android
  135. Blackhat Hacker Tools
  136. Hacking Tools 2020
  137. Hack Tools For Games
  138. Hacking Tools And Software
  139. Hacking Tools Kit
  140. Hacker
  141. Game Hacking
  142. Beginner Hacker Tools
  143. Pentest Tools For Ubuntu
  144. Hacking Tools Github
  145. Hacker Tools Free Download
  146. Pentest Automation Tools
  147. Install Pentest Tools Ubuntu
  148. Hacker Tools Apk Download
  149. Blackhat Hacker Tools
  150. World No 1 Hacker Software
  151. Pentest Tools Github
  152. Hacking Tools Pc
  153. Hacking Tools Software
  154. Free Pentest Tools For Windows
  155. Nsa Hack Tools
  156. Best Pentesting Tools 2018
  157. Pentest Tools Linux
  158. Hacker Tool Kit
  159. Pentest Tools Find Subdomains
  160. Android Hack Tools Github
  161. Hack Tools Download
  162. Blackhat Hacker Tools
  163. Hacking Tools Windows 10
  164. Hacker Search Tools
  165. Hack And Tools
  166. Hacking Tools For Games
  167. Pentest Tools Kali Linux
  168. World No 1 Hacker Software
  169. Hack App
  170. Tools For Hacker
  171. Nsa Hack Tools
  172. Pentest Tools List
  173. Hack Tools For Games
  174. Hacking Tools Mac
  175. Hacking Tools Name
  176. How To Hack

No comments:

Post a Comment

Related Posts with Thumbnails