Skip to content
0:00 / 0:00

#oauth2.0#xss#backend-for-frontend

The insecurity of OAuth 2.0 in frontends - Philippe de Ryck - NDC Security 2023

NDC Conferences

230K subscribers • 110 videos on Hallway • Conference channel

YouTube
  • Recommended by 2 people: 2 in engineering communities.
  • Presented by Philippe de Ryck

Intermediate. Assumes working knowledge.

20K views3 years ago2 recommendations

SecurityWeb developmentWeb and application securityCryptographyHTTP, REST and GraphQL

Philippe de Ryck explains the security risks of storing OAuth tokens in browser-based frontends and advocates for the Backend-for-Frontend pattern.

Everyone agrees that Cross-Site Scripting (XSS) is a real threat to browser-based applications, but many underestimate the true power of XSS. In fact, various OAuth 2.0 security mechanisms for frontends, such as refresh token rotation or token isolation in workers, fail to look beyond script kiddie XSS attacks. In this talk, we take an in-depth look at the consequences of XSS in frontend OAuth 2.0 clients. We explore real-world attacker capabilities and map them against a concrete threat model. We also explore how structural solutions like the Backend-for-Frontend pattern effectively increase the security of frontend applications. By the end of this session, you will have the necessary knowledge to assess the security of your frontends and choose the appropriate defense strategy. Check out our new channel: NDC Clips: @ndcclips Check out more of our featured speakers and talks at ndcconferences.com/ ndc-security.com/

Why it's here

2 people recommend this

What people say. Recommended as an excellent explanation of why storing JWTs in single-page applications is insecure and how BFF solves it.

u/Shaddarin r/dotnet • Recommends

On “Are Cookies getting ditched in favor of JWT?”

No, because it is not possible to securely store a token in the browser. For SPAs the current best practice is to use a BFF + specifically configured cookies: David Fowler's TODO Api [Securing SPAs and Blazor Applications using the BFF (Backend for Frontend) Pattern - Dominick Baier ] The insecurity of OAuth 2.0 in frontends - Philippe de Ryck

u/Meradin r/dotnet • Recommends

On “how do you handle auth between an API and an SPA?”

Strictly speaking there is no 100% safe way to store JWT in a SPA. If you're really interested I recommend this presentation. The thing is though, most (all? it's been a while since I watched it) of his attack vectors rely on malicious javascript code running in the page. If you're running a public facing site that pulls in 3rd party code at runtime, _especially_ ads, then you should be serious about this because your the most vulnerable. The only real way to be secure is to use a BFF that can store the JWT (or whatever auth info) in secure cookies. If you're operating an app that's less vulnerable - no code injected at runtime, and assuming that you reasonably vet the libraries you…

u/Shaddarin r/dotnet • Recommends

On “How Can I Deal With Refresh Tokens In Blazor Webassembly?”

Here's a couple of excellent talks on this topic: The insecurity of OAuth 2.0 in frontends - Philippe de Ryck [Securing SPAs and Blazor Applications using the BFF (Backend for Frontend) Pattern ] SPAs shouldn't handle refresh tokens because they have no way of securely storing them.

u/tragicsharkin r/dotnet • Mentions

On “Why does it seem that most .NET roles require web development skills (HTML/CSS/JS)?”

…L api for the past year. Almost everything I have done has been C# (with some data entry in GraphQL and JSON for various tests). I haven't touched HTML, CSS or JavaScript. My days involve Postman and VS (and docker and postgres and so on). There is another team here that has a React application stack with a thin C# backend that handles user auth (link to this video and proxies to the GraphQL service I work on. However we have separated the team like this because we offer the GraphQL api as a service directly to customers to let them do things like MuleSoft integrations with Salesforce or write their own frontends or whatever other service integration they desire. We also support a number of bulk servi…