SlideShare a Scribd company logo
1 of 30
JWTs and JOSE in a Flash
Evan Johnson
About Me
● CloudFlare Security Systems Engineer
● Previously an engineer at LastPass
● Wrote passgo (https://github.com/ejcx/passgo)
● On twitter @ejcx_
● Personal sites:
○ https://ejj.io
○ https://twiinsen.com
What is JOSE
● Fairly new standard.
● It is actually a “suite” of standards.
● Methods for encrypting and signing javascript objects.
● Useful for stateless tokens
● https://jwt.io has a great demo but we’re about to do
one ourselves
What is a stateless token?
● Used in large web applications.
● Server provides a client with a token containing some
information needed by other servers to service the
request
● Cryptographically validated
● Meant to decrease load. Crypto is cheaper than
databases
● Commonly used for authentication
● Less code
What does JOSE look like
eyJhbGciOiJSUzI1NiIsImp3ayI6eyJrdHkiOiJSU0EiLCJuIjoieVRxNnRPbFdWNnBDdGJMT2Z
5dXZxVzlaeFlramxtX0pWbnZrN0syMEFYakxUV0dmTlI0bUNNU3A0djhuZXdhVUZITnIyYlJUYX
Zxc213Q1U3M3lONUlmclBYcU5sOVdWeTJ2eGh0dnZOM01sVXREWklFVkJDWkl2WVpZVlBsOW82L
W9HbnR6bUZqMmc1bDRERjFRNkc0enRhVGlER2s5V3BHRnNHVW4xNHJyWnR4a0JJeVVfMS1fRjRf
cnR0bHlQcjRSSW02QTM0OGU4cWV5SU9KZW9rbXNQZWNPWnRzN01RenRnVEVmMVJYTnRXQUg4ZGZ
FbG9PT0FpRG1sX0dtU1BCZ0RhYU5MQnhlV3ZPT1FITVU4NU5YbXFLVndkYWJESVcxQTlRUUg3LW
1NMmw0QzVLUGJmcEtvNklhbU5jX0dCRGd3TjFzd2kzcThNcTkwb2UtSmx3IiwiZSI6IkFRQUIif
X0.eydqdGknOidkZWFkYmVlZicsICdtc2cnOidUaGFua3MgZm9yIGNvbWluZyB0byBteSB0YWxr
J30.DQU1MV5NaWadp45mT66oH7-yQ_ltZNTU88gHOnrcnAjxRummFEH7wuAXaHSPChf7pPc-
ZBE5kEMEPFN0e_pY1df58xfabNPlJNpKnZJjiqClYRZ2VZbbB9_ePgj-XxVPgGeAmFakh-
O59xxvyHyG97NKtnBjwtdnvLgp5jnnwIiojh8LXdSmjyo2yJNbj34mluSF1qf3IgVGYUUuJAMy_
lxX8bIXLTnwLxCSd28mK6CqF7yBnmYLx6rzk1KMKkgzDrmLJMSdvwR-JYV6fFSnWixNLk-
Ttf7pJSZAV_n2TlGlTlgO-YkL-tGi2YFmzg2PLYcXrFJ1cutvtCp3Z_0BvA
What does JOSE look like
base64url({JSON JOSE HEADER})
.
base64url({JSON JWT Payload})
.
base64url(signature of previous two)
What does JOSE look like
eyJhbGciOiJSUzI1NiIsImp3ayI6eyJrdHkiOiJSU0EiLCJuIjoieVRxNnRPbFdWNnBDdGJMT2Z
5dXZxVzlaeFlramxtX0pWbnZrN0syMEFYakxUV0dmTlI0bUNNU3A0djhuZXdhVUZITnIyYlJUYX
Zxc213Q1U3M3lONUlmclBYcU5sOVdWeTJ2eGh0dnZOM01sVXREWklFVkJDWkl2WVpZVlBsOW82L
W9HbnR6bUZqMmc1bDRERjFRNkc0enRhVGlER2s5V3BHRnNHVW4xNHJyWnR4a0JJeVVfMS1fRjRf
cnR0bHlQcjRSSW02QTM0OGU4cWV5SU9KZW9rbXNQZWNPWnRzN01RenRnVEVmMVJYTnRXQUg4ZGZ
FbG9PT0FpRG1sX0dtU1BCZ0RhYU5MQnhlV3ZPT1FITVU4NU5YbXFLVndkYWJESVcxQTlRUUg3LW
1NMmw0QzVLUGJmcEtvNklhbU5jX0dCRGd3TjFzd2kzcThNcTkwb2UtSmx3IiwiZSI6IkFRQUIif
X0.eydqdGknOidkZWFkYmVlZicsICdtc2cnOidUaGFua3MgZm9yIGNvbWluZyB0byBteSB0YWxr
J30.DQU1MV5NaWadp45mT66oH7-yQ_ltZNTU88gHOnrcnAjxRummFEH7wuAXaHSPChf7pPc-
ZBE5kEMEPFN0e_pY1df58xfabNPlJNpKnZJjiqClYRZ2VZbbB9_ePgj-XxVPgGeAmFakh-
O59xxvyHyG97NKtnBjwt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0BvA
What does JOSE look like (Body + Claims)
{
'jti':'deadbeef',
'msg':'Thanks for coming to my talk’
}
What does JOSE look like
eyJhbGciOiJSUzI1NiIsImp3ayI6eyJrdHkiOiJSU0EiLCJuIjoieVRxNnRPbFdWNnBDdGJMT2Z
5dXZxVzlaeFlramxtX0pWbnZrN0syMEFYakxUV0dmTlI0bUNNU3A0djhuZXdhVUZITnIyYlJUYX
Zxc213Q1U3M3lONUlmclBYcU5sOVdWeTJ2eGh0dnZOM01sVXREWklFVkJDWkl2WVpZVlBsOW82L
W9HbnR6bUZqMmc1bDRERjFRNkc0enRhVGlER2s5V3BHRnNHVW4xNHJyWnR4a0JJeVVfMS1fRjRf
cnR0bHlQcjRSSW02QTM0OGU4cWV5SU9KZW9rbXNQZWNPWnRzN01RenRnVEVmMVJYTnRXQUg4ZGZ
FbG9PT0FpRG1sX0dtU1BCZ0RhYU5MQnhlV3ZPT1FITVU4NU5YbXFLVndkYWJESVcxQTlRUUg3LW
1NMmw0QzVLUGJmcEtvNklhbU5jX0dCRGd3TjFzd2kzcThNcTkwb2UtSmx3IiwiZSI6IkFRQUIif
X0.eydqdGknOidkZWFkYmVlZicsICdtc2cnOidUaGFua3MgZm9yIGNvbWluZyB0byBteSB0YWxr
J30.DQU1MV5NaWadp45mT66oH7-yQ_ltZNTU88gHOnrcnAjxRummFEH7wuAXaHSPChf7pPc-
ZBE5kEMEPFN0e_pY1df58xfabNPlJNpKnZJjiqClYRZ2VZbbB9_ePgj-XxVPgGeAmFakh-
O59xxvyHyG97NKtnBjwtdnvLgp5jnnwIiojh8LXdSmjyo2yJNbj34mluSF1qf3IgVGYUUuJAMy_
lxX8bIXLTnwLxCSd28mK6CqF7yBnmYLx6rzk1KMKkgzDrmLJMSdvwR-JYV6fFSnWixNLk-
Ttf7pJSZAV_n2TlGlTlgO-YkL-tGi2YFmzg2PLYcXrFJ1cutvtCp3Z_0BvA
Why do we need JOSE?
Why do we need JOSE?
func generateMyJwt(userName, userId, jwtUse) {
return encThenSign( userName + “||” + userId + “||” + jwtUse, secretKey);
}
func validateMyJwt(myJwt) {
jwtData = valThenDecThenSplit(myJwt)
return jwtData[1], jwtData[2], jwtData[3]
}
What does JOSE fix?
Json is fairly universally supported. Easy.
No hacky parsing for homebrew solutions required.
Asymmetric key support.
Lots of cryptographic options
Compact and URL Safe.
Useful for many trust models.
URL Safe
What vocab do we need?
JSON Web Token (JWT)
JSON Web Encryption (JWE)
JSON Web Signature (JWS)
JSON Web Key (JWK)
JSON Web Algorithms (JWA)
JOSE Header
All types of JWTs contain a JOSE Header.
Type, Recommended to be ‘JWT’.
Content Type, image, video, etc.
Algorithm, Variety of algorithms. Sometimes ‘none’.
Certificates, can contain x509 certs, json web keys, or URLs
to published x509 certs
JSON Web Signatures (JWS) RFC 7515 (JOSE Header)
Data integrity but no encryption. Like our example.
Key ID, The Key ID used to secure the JWT.
JWK Set URL, URL of public keys.
JSON Web Key, A public key
x509 URL, x509 Chain, x509 Fingerprint (SHA1/2). Must support
TLS
JSON Web Encryption (JWE) RFC 7516 (JOSE Header)
Data protection and integrity.
Compression Algorithm, DEFLATE.
Encryption Algorithm, Defined in JWA
Public Keys,
THIS RFC IS MASSIVE
What is in the Payload?
JWT ID, Random ID of that individual JWT.
Issued At, Not Before, Expiration, Standard Time Stuff.
Audience, Who is the JWT for. Must be checked.
Issuer, Who issued it? A StringOrUri should go here.
Subject, What is it for? A StringOrUri should go here.
Other, Applications can agree on non-registered claims.
JSON Web Algorithms (JWA) RFC 7518
Just a list of supported crypto algorithms, and what is
necessary to use them. Very confusing.
Lots and lots of algorithms
Lots and lots of logic
Lots and lots of special tags for the JOSE Header
JSON Web Algorithms (JWA) RFC 7518
JWT Best Practices
Compartmentalize. Different keys for each service
Short lived? Long lived? Think about it.
Follow the algorithms for validating and generating. They are
in the RFC (if you’re writing code for this)
Strict JSON Format Checking.
Use a library
JWT Best Practices
Distinguish between JWS and JWEs
Look for 5 sections and 4 periods for a JWE.
alg in the header.
Look for payload versus ciphertext
Security Considerations
Security Considerations
- Moxie’s Cryptographic Doom Principal
- https://auth0.com/blog/critical-vulnerabilities-in-json-
web-token-libraries/
- Great bug ^
Trouble with JWTs
JOSE Conclusion
The RFCs are massively over-engineered.
Tons of features. Tons of ways to do things that few use.
It’s getting worse.
Is slow JWT adoption because of this?
JOSE has gotten a lot more popular.
Think about revocation
Questions?

More Related Content

What's hot

An Authentication and Authorization Architecture for a Microservices World
An Authentication and Authorization Architecture for a Microservices WorldAn Authentication and Authorization Architecture for a Microservices World
An Authentication and Authorization Architecture for a Microservices WorldVMware Tanzu
 
Getting Started in Blockchain Security and Smart Contract Auditing
Getting Started in Blockchain Security and Smart Contract AuditingGetting Started in Blockchain Security and Smart Contract Auditing
Getting Started in Blockchain Security and Smart Contract AuditingBeau Bullock
 
Getting Started with Spring Authorization Server
Getting Started with Spring Authorization ServerGetting Started with Spring Authorization Server
Getting Started with Spring Authorization ServerVMware Tanzu
 
Data Security Essentials - JavaOne 2013
Data Security Essentials - JavaOne 2013Data Security Essentials - JavaOne 2013
Data Security Essentials - JavaOne 2013javagroup2006
 
NextGenPSD2 OAuth SCA Mode Security Recommendations
NextGenPSD2 OAuth SCA Mode Security Recommendations NextGenPSD2 OAuth SCA Mode Security Recommendations
NextGenPSD2 OAuth SCA Mode Security Recommendations Torsten Lodderstedt
 
2019 03 18_kenneth_simplebitcoinwebsite
2019 03 18_kenneth_simplebitcoinwebsite 2019 03 18_kenneth_simplebitcoinwebsite
2019 03 18_kenneth_simplebitcoinwebsite Hu Kenneth
 
Authentication in microservice systems
Authentication in microservice systemsAuthentication in microservice systems
Authentication in microservice systemsDavid Borsos
 
Bruno Lowagie (iText) #cfoconferenz
Bruno Lowagie (iText) #cfoconferenzBruno Lowagie (iText) #cfoconferenz
Bruno Lowagie (iText) #cfoconferenzFDMagazine
 
Web 20 Security - Vordel
Web 20 Security - VordelWeb 20 Security - Vordel
Web 20 Security - Vordelguest2a1135
 
Various Types of OpenSSL Commands and Keytool
Various Types of OpenSSL Commands and KeytoolVarious Types of OpenSSL Commands and Keytool
Various Types of OpenSSL Commands and KeytoolCheapSSLsecurity
 
OpenID Connect - An Emperor or Just New Cloths?
OpenID Connect - An Emperor or Just New Cloths?OpenID Connect - An Emperor or Just New Cloths?
OpenID Connect - An Emperor or Just New Cloths?Oliver Pfaff
 
OpenID Connect 4 SSI (DIFCon F2F)
OpenID Connect 4 SSI (DIFCon F2F)OpenID Connect 4 SSI (DIFCon F2F)
OpenID Connect 4 SSI (DIFCon F2F)Torsten Lodderstedt
 
Bitcoin, the Blockchain, and Open Source
Bitcoin, the Blockchain, and Open SourceBitcoin, the Blockchain, and Open Source
Bitcoin, the Blockchain, and Open SourceAll Things Open
 
Analyzing RDP traffc with Bro
Analyzing RDP traffc with BroAnalyzing RDP traffc with Bro
Analyzing RDP traffc with BroJosh Liburdi
 
Javascript Object Signing & Encryption
Javascript Object Signing & EncryptionJavascript Object Signing & Encryption
Javascript Object Signing & EncryptionAaron Zauner
 
OpenID Connect 1.0 Explained
OpenID Connect 1.0 ExplainedOpenID Connect 1.0 Explained
OpenID Connect 1.0 ExplainedEugene Siow
 
OpenID Connect: An Overview
OpenID Connect: An OverviewOpenID Connect: An Overview
OpenID Connect: An OverviewPat Patterson
 

What's hot (20)

An Authentication and Authorization Architecture for a Microservices World
An Authentication and Authorization Architecture for a Microservices WorldAn Authentication and Authorization Architecture for a Microservices World
An Authentication and Authorization Architecture for a Microservices World
 
OpenSSL
OpenSSLOpenSSL
OpenSSL
 
Getting Started in Blockchain Security and Smart Contract Auditing
Getting Started in Blockchain Security and Smart Contract AuditingGetting Started in Blockchain Security and Smart Contract Auditing
Getting Started in Blockchain Security and Smart Contract Auditing
 
Getting Started with Spring Authorization Server
Getting Started with Spring Authorization ServerGetting Started with Spring Authorization Server
Getting Started with Spring Authorization Server
 
Data Security Essentials - JavaOne 2013
Data Security Essentials - JavaOne 2013Data Security Essentials - JavaOne 2013
Data Security Essentials - JavaOne 2013
 
NextGenPSD2 OAuth SCA Mode Security Recommendations
NextGenPSD2 OAuth SCA Mode Security Recommendations NextGenPSD2 OAuth SCA Mode Security Recommendations
NextGenPSD2 OAuth SCA Mode Security Recommendations
 
2019 03 18_kenneth_simplebitcoinwebsite
2019 03 18_kenneth_simplebitcoinwebsite 2019 03 18_kenneth_simplebitcoinwebsite
2019 03 18_kenneth_simplebitcoinwebsite
 
Authentication in microservice systems
Authentication in microservice systemsAuthentication in microservice systems
Authentication in microservice systems
 
Bruno Lowagie (iText) #cfoconferenz
Bruno Lowagie (iText) #cfoconferenzBruno Lowagie (iText) #cfoconferenz
Bruno Lowagie (iText) #cfoconferenz
 
Hyperledger introduction
Hyperledger introductionHyperledger introduction
Hyperledger introduction
 
Web 20 Security - Vordel
Web 20 Security - VordelWeb 20 Security - Vordel
Web 20 Security - Vordel
 
Various Types of OpenSSL Commands and Keytool
Various Types of OpenSSL Commands and KeytoolVarious Types of OpenSSL Commands and Keytool
Various Types of OpenSSL Commands and Keytool
 
OpenID Connect - An Emperor or Just New Cloths?
OpenID Connect - An Emperor or Just New Cloths?OpenID Connect - An Emperor or Just New Cloths?
OpenID Connect - An Emperor or Just New Cloths?
 
OpenID Connect 4 SSI (DIFCon F2F)
OpenID Connect 4 SSI (DIFCon F2F)OpenID Connect 4 SSI (DIFCon F2F)
OpenID Connect 4 SSI (DIFCon F2F)
 
Bitcoin, the Blockchain, and Open Source
Bitcoin, the Blockchain, and Open SourceBitcoin, the Blockchain, and Open Source
Bitcoin, the Blockchain, and Open Source
 
Analyzing RDP traffc with Bro
Analyzing RDP traffc with BroAnalyzing RDP traffc with Bro
Analyzing RDP traffc with Bro
 
Javascript Object Signing & Encryption
Javascript Object Signing & EncryptionJavascript Object Signing & Encryption
Javascript Object Signing & Encryption
 
OpenID Connect 1.0 Explained
OpenID Connect 1.0 ExplainedOpenID Connect 1.0 Explained
OpenID Connect 1.0 Explained
 
OpenID Connect: An Overview
OpenID Connect: An OverviewOpenID Connect: An Overview
OpenID Connect: An Overview
 
Understanding OpenID
Understanding OpenIDUnderstanding OpenID
Understanding OpenID
 

Similar to JWTs and JOSE in a flash

支撐英雄聯盟戰績網的那條巨蟒
支撐英雄聯盟戰績網的那條巨蟒支撐英雄聯盟戰績網的那條巨蟒
支撐英雄聯盟戰績網的那條巨蟒Toki Kanno
 
Using JSON Web Tokens for REST Authentication
Using JSON Web Tokens for REST Authentication Using JSON Web Tokens for REST Authentication
Using JSON Web Tokens for REST Authentication Mediacurrent
 
Con Foo 2017 - Don't Loose Sleep - Secure Your REST
Con Foo 2017 - Don't Loose Sleep - Secure Your RESTCon Foo 2017 - Don't Loose Sleep - Secure Your REST
Con Foo 2017 - Don't Loose Sleep - Secure Your RESTAdam Englander
 
Microservices Security Patterns & Protocols with Spring & PCF
Microservices Security Patterns & Protocols with Spring & PCFMicroservices Security Patterns & Protocols with Spring & PCF
Microservices Security Patterns & Protocols with Spring & PCFVMware Tanzu
 
Introduction to JWT and How to integrate with Spring Security
Introduction to JWT and How to integrate with Spring SecurityIntroduction to JWT and How to integrate with Spring Security
Introduction to JWT and How to integrate with Spring SecurityBruno Henrique Rother
 
Don't Loose Sleep - Secure Your Rest - php[tek] 2017
Don't Loose Sleep - Secure Your Rest - php[tek] 2017Don't Loose Sleep - Secure Your Rest - php[tek] 2017
Don't Loose Sleep - Secure Your Rest - php[tek] 2017Adam Englander
 
End-to-end HTML5 APIs - The Geek Gathering 2013
End-to-end HTML5 APIs - The Geek Gathering 2013End-to-end HTML5 APIs - The Geek Gathering 2013
End-to-end HTML5 APIs - The Geek Gathering 2013Alexandre Morgaut
 
Jwt the complete guide to json web tokens
Jwt  the complete guide to json web tokensJwt  the complete guide to json web tokens
Jwt the complete guide to json web tokensremayssat
 
STIX Patterning: Viva la revolución!
STIX Patterning: Viva la revolución!STIX Patterning: Viva la revolución!
STIX Patterning: Viva la revolución!treyka
 
Building Secure User Interfaces With JWTs
Building Secure User Interfaces With JWTsBuilding Secure User Interfaces With JWTs
Building Secure User Interfaces With JWTsrobertjd
 
Jwt with flask slide deck - alan swenson
Jwt with flask   slide deck - alan swensonJwt with flask   slide deck - alan swenson
Jwt with flask slide deck - alan swensonJeffrey Clark
 
Jwt == insecurity?
Jwt == insecurity?Jwt == insecurity?
Jwt == insecurity?snyff
 
Sandboxing JS and HTML. A lession Learned
Sandboxing JS and HTML. A lession LearnedSandboxing JS and HTML. A lession Learned
Sandboxing JS and HTML. A lession LearnedMinded Security
 
I Love APIs 2015: Advanced Security Extensions in Apigee Edge - JWT, JWE, JWS
I Love APIs 2015: Advanced Security Extensions in Apigee Edge - JWT, JWE, JWSI Love APIs 2015: Advanced Security Extensions in Apigee Edge - JWT, JWE, JWS
I Love APIs 2015: Advanced Security Extensions in Apigee Edge - JWT, JWE, JWSApigee | Google Cloud
 
Nodejs and WebSockets
Nodejs and WebSocketsNodejs and WebSockets
Nodejs and WebSocketsGonzalo Ayuso
 

Similar to JWTs and JOSE in a flash (20)

支撐英雄聯盟戰績網的那條巨蟒
支撐英雄聯盟戰績網的那條巨蟒支撐英雄聯盟戰績網的那條巨蟒
支撐英雄聯盟戰績網的那條巨蟒
 
Using JSON Web Tokens for REST Authentication
Using JSON Web Tokens for REST Authentication Using JSON Web Tokens for REST Authentication
Using JSON Web Tokens for REST Authentication
 
Con Foo 2017 - Don't Loose Sleep - Secure Your REST
Con Foo 2017 - Don't Loose Sleep - Secure Your RESTCon Foo 2017 - Don't Loose Sleep - Secure Your REST
Con Foo 2017 - Don't Loose Sleep - Secure Your REST
 
Microservices Security Patterns & Protocols with Spring & PCF
Microservices Security Patterns & Protocols with Spring & PCFMicroservices Security Patterns & Protocols with Spring & PCF
Microservices Security Patterns & Protocols with Spring & PCF
 
Introduction to JWT and How to integrate with Spring Security
Introduction to JWT and How to integrate with Spring SecurityIntroduction to JWT and How to integrate with Spring Security
Introduction to JWT and How to integrate with Spring Security
 
Jwt Security
Jwt SecurityJwt Security
Jwt Security
 
Don't Loose Sleep - Secure Your Rest - php[tek] 2017
Don't Loose Sleep - Secure Your Rest - php[tek] 2017Don't Loose Sleep - Secure Your Rest - php[tek] 2017
Don't Loose Sleep - Secure Your Rest - php[tek] 2017
 
Node.js
Node.jsNode.js
Node.js
 
End-to-end HTML5 APIs - The Geek Gathering 2013
End-to-end HTML5 APIs - The Geek Gathering 2013End-to-end HTML5 APIs - The Geek Gathering 2013
End-to-end HTML5 APIs - The Geek Gathering 2013
 
Pentesting jwt
Pentesting jwtPentesting jwt
Pentesting jwt
 
Jwt the complete guide to json web tokens
Jwt  the complete guide to json web tokensJwt  the complete guide to json web tokens
Jwt the complete guide to json web tokens
 
STIX Patterning: Viva la revolución!
STIX Patterning: Viva la revolución!STIX Patterning: Viva la revolución!
STIX Patterning: Viva la revolución!
 
API
APIAPI
API
 
Building Secure User Interfaces With JWTs
Building Secure User Interfaces With JWTsBuilding Secure User Interfaces With JWTs
Building Secure User Interfaces With JWTs
 
Jwt with flask slide deck - alan swenson
Jwt with flask   slide deck - alan swensonJwt with flask   slide deck - alan swenson
Jwt with flask slide deck - alan swenson
 
Node.js 1, 2, 3
Node.js 1, 2, 3Node.js 1, 2, 3
Node.js 1, 2, 3
 
Jwt == insecurity?
Jwt == insecurity?Jwt == insecurity?
Jwt == insecurity?
 
Sandboxing JS and HTML. A lession Learned
Sandboxing JS and HTML. A lession LearnedSandboxing JS and HTML. A lession Learned
Sandboxing JS and HTML. A lession Learned
 
I Love APIs 2015: Advanced Security Extensions in Apigee Edge - JWT, JWE, JWS
I Love APIs 2015: Advanced Security Extensions in Apigee Edge - JWT, JWE, JWSI Love APIs 2015: Advanced Security Extensions in Apigee Edge - JWT, JWE, JWS
I Love APIs 2015: Advanced Security Extensions in Apigee Edge - JWT, JWE, JWS
 
Nodejs and WebSockets
Nodejs and WebSocketsNodejs and WebSockets
Nodejs and WebSockets
 

Recently uploaded

Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...tanu pandey
 
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service OnlineCALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Onlineanilsa9823
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Delhi Call girls
 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...APNIC
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.soniya singh
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Standkumarajju5765
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Delhi Call girls
 
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445ruhi
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableSeo
 
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.soniya singh
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024APNIC
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663Call Girls Mumbai
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebJames Anderson
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGAPNIC
 

Recently uploaded (20)

Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
 
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
 
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
 
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service OnlineCALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
 
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
 
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOG
 

JWTs and JOSE in a flash

  • 1. JWTs and JOSE in a Flash Evan Johnson
  • 2. About Me ● CloudFlare Security Systems Engineer ● Previously an engineer at LastPass ● Wrote passgo (https://github.com/ejcx/passgo) ● On twitter @ejcx_ ● Personal sites: ○ https://ejj.io ○ https://twiinsen.com
  • 3. What is JOSE ● Fairly new standard. ● It is actually a “suite” of standards. ● Methods for encrypting and signing javascript objects. ● Useful for stateless tokens ● https://jwt.io has a great demo but we’re about to do one ourselves
  • 4. What is a stateless token? ● Used in large web applications. ● Server provides a client with a token containing some information needed by other servers to service the request ● Cryptographically validated ● Meant to decrease load. Crypto is cheaper than databases ● Commonly used for authentication ● Less code
  • 5. What does JOSE look like eyJhbGciOiJSUzI1NiIsImp3ayI6eyJrdHkiOiJSU0EiLCJuIjoieVRxNnRPbFdWNnBDdGJMT2Z 5dXZxVzlaeFlramxtX0pWbnZrN0syMEFYakxUV0dmTlI0bUNNU3A0djhuZXdhVUZITnIyYlJUYX Zxc213Q1U3M3lONUlmclBYcU5sOVdWeTJ2eGh0dnZOM01sVXREWklFVkJDWkl2WVpZVlBsOW82L W9HbnR6bUZqMmc1bDRERjFRNkc0enRhVGlER2s5V3BHRnNHVW4xNHJyWnR4a0JJeVVfMS1fRjRf cnR0bHlQcjRSSW02QTM0OGU4cWV5SU9KZW9rbXNQZWNPWnRzN01RenRnVEVmMVJYTnRXQUg4ZGZ FbG9PT0FpRG1sX0dtU1BCZ0RhYU5MQnhlV3ZPT1FITVU4NU5YbXFLVndkYWJESVcxQTlRUUg3LW 1NMmw0QzVLUGJmcEtvNklhbU5jX0dCRGd3TjFzd2kzcThNcTkwb2UtSmx3IiwiZSI6IkFRQUIif X0.eydqdGknOidkZWFkYmVlZicsICdtc2cnOidUaGFua3MgZm9yIGNvbWluZyB0byBteSB0YWxr J30.DQU1MV5NaWadp45mT66oH7-yQ_ltZNTU88gHOnrcnAjxRummFEH7wuAXaHSPChf7pPc- ZBE5kEMEPFN0e_pY1df58xfabNPlJNpKnZJjiqClYRZ2VZbbB9_ePgj-XxVPgGeAmFakh- O59xxvyHyG97NKtnBjwtdnvLgp5jnnwIiojh8LXdSmjyo2yJNbj34mluSF1qf3IgVGYUUuJAMy_ lxX8bIXLTnwLxCSd28mK6CqF7yBnmYLx6rzk1KMKkgzDrmLJMSdvwR-JYV6fFSnWixNLk- Ttf7pJSZAV_n2TlGlTlgO-YkL-tGi2YFmzg2PLYcXrFJ1cutvtCp3Z_0BvA
  • 6. What does JOSE look like base64url({JSON JOSE HEADER}) . base64url({JSON JWT Payload}) . base64url(signature of previous two)
  • 7. What does JOSE look like eyJhbGciOiJSUzI1NiIsImp3ayI6eyJrdHkiOiJSU0EiLCJuIjoieVRxNnRPbFdWNnBDdGJMT2Z 5dXZxVzlaeFlramxtX0pWbnZrN0syMEFYakxUV0dmTlI0bUNNU3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bUZqMmc1bDRERjFRNkc0enRhVGlER2s5V3BHRnNHVW4xNHJyWnR4a0JJeVVfMS1fRjRf cnR0bHlQcjRSSW02QTM0OGU4cWV5SU9KZW9rbXNQZWNPWnRzN01RenRnVEVmMVJYTnRXQUg4ZGZ FbG9PT0FpRG1sX0dtU1BCZ0RhYU5MQnhlV3ZPT1FITVU4NU5YbXFLVndkYWJESVcxQTlRUUg3LW 1NMmw0QzVLUGJmcEtvNklhbU5jX0dCRGd3TjFzd2kzcThNcTkwb2UtSmx3IiwiZSI6IkFRQUIif X0.eydqdGknOidkZWFkYmVlZicsICdtc2cnOidUaGFua3MgZm9yIGNvbWluZyB0byBteSB0YWxr J30.DQU1MV5NaWadp45mT66oH7-yQ_ltZNTU88gHOnrcnAjxRummFEH7wuAXaHSPChf7pPc- ZBE5kEMEPFN0e_pY1df58xfabNPlJNpKnZJjiqClYRZ2VZbbB9_ePgj-XxVPgGeAmFakh- O59xxvyHyG97NKtnBjwtdnvLgp5jnnwIiojh8LXdSmjyo2yJNbj34mluSF1qf3IgVGYUUuJAMy_ lxX8bIXLTnwLxCSd28mK6CqF7yBnmYLx6rzk1KMKkgzDrmLJMSdvwR-JYV6fFSnWixNLk- Ttf7pJSZAV_n2TlGlTlgO-YkL-tGi2YFmzg2PLYcXrFJ1cutvtCp3Z_0BvA
  • 9. What does JOSE look like
  • 10. What does JOSE look like (JWT Payload) eyJhbGciOiJSUzI1NiIsImp3ayI6eyJrdHkiOiJSU0EiLCJuIjoieVRxNnRPbFdWNnBDdGJMT2Z 5dXZxVzlaeFlramxtX0pWbnZrN0syMEFYakxUV0dmTlI0bUNNU3A0djhuZXdhVUZITnIyYlJUYX Zxc213Q1U3M3lONUlmclBYcU5sOVdWeTJ2eGh0dnZOM01sVXREWklFVkJDWkl2WVpZVlBsOW82L W9HbnR6bUZqMmc1bDRERjFRNkc0enRhVGlER2s5V3BHRnNHVW4xNHJyWnR4a0JJeVVfMS1fRjRf cnR0bHlQcjRSSW02QTM0OGU4cWV5SU9KZW9rbXNQZWNPWnRzN01RenRnVEVmMVJYTnRXQUg4ZGZ FbG9PT0FpRG1sX0dtU1BCZ0RhYU5MQnhlV3ZPT1FITVU4NU5YbXFLVndkYWJESVcxQTlRUUg3LW 1NMmw0QzVLUGJmcEtvNklhbU5jX0dCRGd3TjFzd2kzcThNcTkwb2UtSmx3IiwiZSI6IkFRQUIif X0.eydqdGknOidkZWFkYmVlZicsICdtc2cnOidUaGFua3MgZm9yIGNvbWluZyB0byBteSB0YWxr J30.DQU1MV5NaWadp45mT66oH7-yQ_ltZNTU88gHOnrcnAjxRummFEH7wuAXaHSPChf7pPc- ZBE5kEMEPFN0e_pY1df58xfabNPlJNpKnZJjiqClYRZ2VZbbB9_ePgj-XxVPgGeAmFakh- O59xxvyHyG97NKtnBjwtdnvLgp5jnnwIiojh8LXdSmjyo2yJNbj34mluSF1qf3IgVGYUUuJAMy_ lxX8bIXLTnwLxCSd28mK6CqF7yBnmYLx6rzk1KMKkgzDrmLJMSdvwR-JYV6fFSnWixNLk- Ttf7pJSZAV_n2TlGlTlgO-YkL-tGi2YFmzg2PLYcXrFJ1cutvtCp3Z_0BvA
  • 11. What does JOSE look like (Body + Claims) { 'jti':'deadbeef', 'msg':'Thanks for coming to my talk’ }
  • 12. What does JOSE look like eyJhbGciOiJSUzI1NiIsImp3ayI6eyJrdHkiOiJSU0EiLCJuIjoieVRxNnRPbFdWNnBDdGJMT2Z 5dXZxVzlaeFlramxtX0pWbnZrN0syMEFYakxUV0dmTlI0bUNNU3A0djhuZXdhVUZITnIyYlJUYX Zxc213Q1U3M3lONUlmclBYcU5sOVdWeTJ2eGh0dnZOM01sVXREWklFVkJDWkl2WVpZVlBsOW82L W9HbnR6bUZqMmc1bDRERjFRNkc0enRhVGlER2s5V3BHRnNHVW4xNHJyWnR4a0JJeVVfMS1fRjRf cnR0bHlQcjRSSW02QTM0OGU4cWV5SU9KZW9rbXNQZWNPWnRzN01RenRnVEVmMVJYTnRXQUg4ZGZ FbG9PT0FpRG1sX0dtU1BCZ0RhYU5MQnhlV3ZPT1FITVU4NU5YbXFLVndkYWJESVcxQTlRUUg3LW 1NMmw0QzVLUGJmcEtvNklhbU5jX0dCRGd3TjFzd2kzcThNcTkwb2UtSmx3IiwiZSI6IkFRQUIif X0.eydqdGknOidkZWFkYmVlZicsICdtc2cnOidUaGFua3MgZm9yIGNvbWluZyB0byBteSB0YWxr J30.DQU1MV5NaWadp45mT66oH7-yQ_ltZNTU88gHOnrcnAjxRummFEH7wuAXaHSPChf7pPc- ZBE5kEMEPFN0e_pY1df58xfabNPlJNpKnZJjiqClYRZ2VZbbB9_ePgj-XxVPgGeAmFakh- O59xxvyHyG97NKtnBjwtdnvLgp5jnnwIiojh8LXdSmjyo2yJNbj34mluSF1qf3IgVGYUUuJAMy_ lxX8bIXLTnwLxCSd28mK6CqF7yBnmYLx6rzk1KMKkgzDrmLJMSdvwR-JYV6fFSnWixNLk- Ttf7pJSZAV_n2TlGlTlgO-YkL-tGi2YFmzg2PLYcXrFJ1cutvtCp3Z_0BvA
  • 13. Why do we need JOSE?
  • 14. Why do we need JOSE? func generateMyJwt(userName, userId, jwtUse) { return encThenSign( userName + “||” + userId + “||” + jwtUse, secretKey); } func validateMyJwt(myJwt) { jwtData = valThenDecThenSplit(myJwt) return jwtData[1], jwtData[2], jwtData[3] }
  • 15. What does JOSE fix? Json is fairly universally supported. Easy. No hacky parsing for homebrew solutions required. Asymmetric key support. Lots of cryptographic options Compact and URL Safe. Useful for many trust models. URL Safe
  • 16. What vocab do we need? JSON Web Token (JWT) JSON Web Encryption (JWE) JSON Web Signature (JWS) JSON Web Key (JWK) JSON Web Algorithms (JWA)
  • 17. JOSE Header All types of JWTs contain a JOSE Header. Type, Recommended to be ‘JWT’. Content Type, image, video, etc. Algorithm, Variety of algorithms. Sometimes ‘none’. Certificates, can contain x509 certs, json web keys, or URLs to published x509 certs
  • 18. JSON Web Signatures (JWS) RFC 7515 (JOSE Header) Data integrity but no encryption. Like our example. Key ID, The Key ID used to secure the JWT. JWK Set URL, URL of public keys. JSON Web Key, A public key x509 URL, x509 Chain, x509 Fingerprint (SHA1/2). Must support TLS
  • 19. JSON Web Encryption (JWE) RFC 7516 (JOSE Header) Data protection and integrity. Compression Algorithm, DEFLATE. Encryption Algorithm, Defined in JWA Public Keys, THIS RFC IS MASSIVE
  • 20. What is in the Payload? JWT ID, Random ID of that individual JWT. Issued At, Not Before, Expiration, Standard Time Stuff. Audience, Who is the JWT for. Must be checked. Issuer, Who issued it? A StringOrUri should go here. Subject, What is it for? A StringOrUri should go here. Other, Applications can agree on non-registered claims.
  • 21. JSON Web Algorithms (JWA) RFC 7518 Just a list of supported crypto algorithms, and what is necessary to use them. Very confusing. Lots and lots of algorithms Lots and lots of logic Lots and lots of special tags for the JOSE Header
  • 22. JSON Web Algorithms (JWA) RFC 7518
  • 23. JWT Best Practices Compartmentalize. Different keys for each service Short lived? Long lived? Think about it. Follow the algorithms for validating and generating. They are in the RFC (if you’re writing code for this) Strict JSON Format Checking. Use a library
  • 24. JWT Best Practices Distinguish between JWS and JWEs Look for 5 sections and 4 periods for a JWE. alg in the header. Look for payload versus ciphertext
  • 26. Security Considerations - Moxie’s Cryptographic Doom Principal - https://auth0.com/blog/critical-vulnerabilities-in-json- web-token-libraries/ - Great bug ^
  • 27.
  • 29. JOSE Conclusion The RFCs are massively over-engineered. Tons of features. Tons of ways to do things that few use. It’s getting worse. Is slow JWT adoption because of this? JOSE has gotten a lot more popular. Think about revocation

Editor's Notes

  1. Hello, This talk is called JWTs and JOSE in a flash. It is meant to be a quick introduction to this new thing called “JOSE”, and sometimes referred to as JWTs. I just want to let you know up front. There is no way you will be a JWT or JOSE expert from a 30 minute talk at the DEFCON cryptovillage. There are a lot of details here. JOSE is really wonky and has some strange things so this is more of an introductory talk. With 30 minutes. Hopefully by the end you’ll have a good idea about how JWTs work and how they are used
  2. CloudFlare Security Systems Engineer I wear a lot of different random hats. I’m the company’s appsec person I hunt vulnerabilities and then come up with remediation plans I write code to fix vulnerabilities I build security features and help make sure security products work, aren’t able to side step right around, etc. Wrote all the account management and session stuff on our site. Previously an engineer at LastPass Where I got in to this world of password managers I guess. I would regularly look at how other people’s password managers worked when I was at lastpass and learning what was good what was bad and what needed improvement. Wrote passgo (https://github.com/ejcx/passgo) It’s a command line password manager written in golang. Has modern crypto
  3. JOSE is a standard. Means “javascript object signing and encryption”. Fairly new standardization and it’s recently getting really really popular. It’s a collection of about 5-7 RFCs that describe all the different acronyms that are required to make this possible This is a really really big standard and one of the biggest hurdles to understanding the ecosystem is understanding the vocabulary. JWT.io has a great visualization of the basic how JWTs work and you should definitely check it out.
  4. Used in sessions. Explain multiple servers. Information sharing is hard you need a way for multiple servers to communicate with eachother. Ruby sessions, golang sessions in the gorilla go library, python sessions
  5. This is a JWT…… Viola….
  6. The reason for this slide is to show you all that JWTs The JOSE specifications have all of these “well known fields” that exist in both the JOSE header and the JWT Payload. This might confuse you if you’re not aware of it with my next slides. It confuses me and I’ve read the RFC 3 times probably so this is pretty normal.
  7. First thing to notice is this is not just a base64 blob of data. It has periods as delimiters. For information.
  8. This is the JOSE Header. It contains information about the JWT
  9. Inside
  10. First thing to notice is this is not just a base64 blob of data. It has periods as delimiters. For information.
  11. First thing to notice is this is not just a base64 blob of data. It has periods as delimiters. For information. “Thanks for coming to my talk”
  12. This is the signature. No magic here. Signature is generated from the base64 of the jose header plus the body/claims concatenated together and then a signature is generated. Notice that this is really really strange. The signature algorithm is part of the signature. When verifying the signature, verifiers need to check the algorithm first in order to verify the signature. Does anyone see anything immediately scary about this
  13. Here are some real digitalocean tokens that you get when you signup and when you verify an email change. These are real. Just to be clear there is no vulnerability here, but it might indicate some future weaknesses. DigitalOcean sent me a signup URL and it had multiple purposes. I could use the token at the end of the URL to both, confirm a signup to the website and verify that my email had changed. This might be undesirable. The two things that this token could be used for are close enough. What happens when they add a new “confirmation” for something more security sensitive. This thing they rolled out is just an email address and a confirmation. Nothing indicating what the token is for.
  14. Another reason why JOSE is nice is because stateless tokens are sometimes implemented in a way that string formatter bugs are common. Here is some pseudo-code that kind of shows a way someone might build stateless tokens that have a weakness. JOSE fixes can’t completely eliminate these vulns that people write, but JOSE is a lot more of a mature framework to use to create stateless tokens.
  15. What problems are JOSE meant to solve? It’s meant to standardize something that tons of people were homebrewing Json is fairly universally supported. Easy. No hacky parsing for homebrew solutions required. Asymmetric key support. Most homebrew solutions don’t have this and it’s really cool Lots of cryptographic options. I think this is bad Compact and URL Safe. Useful for many trust models. URL Safe
  16. This is kind of a lot of vocab to take in. JWT is Json web token. This is any token that follows this standard. JSON Web Encryption, or JWE is any encrypted token. JSON Web Signature is any signed token. Integrity only. This distinction is somewhere a lot of people make mistakes JSON Web Key is pretty neat. It’s a way to encode asymmetric key information, and it’s metadata as a JSON object. We will talk about that more in a minute
  17. JWE and JWS both have a JOSE header. Has information about the algorithms in the jwt’s. All types of JWTs contain a JOSE Header. Type, Recommended to be ‘JWT’. Content Type, image, video, etc. Algorithm, Variety of algorithms. Sometimes ‘none’. Certificates, can contain x509 certs, json web keys, or URLs to published x509 certs
  18. A JWT that is “plaintext” (base64’d) with a signature. This is what edge auth uses. Go check beyond.cloudflare.com, log in and check out your CF_Authorization cookie. Data integrity but no encryption. Like our example. Key ID, The Key ID used to secure the JWT. JWK Set URL, URL of public keys. JSON Web Key, A public key x509 URL, x509 Chain, x509 Fingerprint (SHA1/2). Must support TLS
  19. AFAIK we don’t use this here. It’s much more complex than JWS, but in instances where the data inside the jwt is sensitive it should be used. For example, Customer data in a JWT? Use JWE.
  20. These are what the RFC says are standard and have predetermined meaning if they exist in a jwt. You can add whatever you’d like though. JWT ID, Random ID of that individual JWT. Issued At, Not Before, Expiration, Standard Time Stuff. Audience, Who is the JWT for. Must be checked. Issuer, Who issued it? A StringOrUri should go here. Subject, What is it for? A StringOrUri should go here. Other, Applications can agree on non-registered claims.
  21. There is a whole RFC about what algorithm choices are allowed.
  22. Here’s a screenshot with SOME of the new names of stuff from the RFC. There’s more.
  23. This bug is amazing. Alg none
  24. There are a lot of considerations.
  25. This is my friend from Slack who is trying to learn more security and crypto stuff. He’s great and super motivated but it means he tries stuff often and is wrong a lot and learns quickly. He had messaged me One of the biggest problems I see with JWTs is you’re putting a lot of cryptography firepower in to the hands of people who are not necessarily crypto literate. They might not know if something is horribly broken.
  26. The RFCs are massively over-engineered. Tons of features. Tons of ways to do things that few use. It’s getting worse. Is slow JWT adoption because of this? JOSE has gotten a lot more popular. Think about revocation. If you NEED revocation. This is not for you. You can’t really revoke things in stateless systems.
  27. So. JWTs are complicated.