SlideShare a Scribd company logo
1 of 29
{
Pentesting JWT
By Jaya Kumar Kondapalli
WhoAM I?
Just a Security Enthusiast
Was Functional tester by chance..
Now, Penetration tester by choice..
I feel Shy talking about myself
History behind JWT?
What is JWT and it’s structure?
Security concerns with JWT
Recommendations
Agenda
Have you ever seen data like this??
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIi
wibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF
2QT4fwpMeJf36POk6yJV_adQssw5c
Have you observed any pattern in the above value??
Let’s go back to History:
HTTP is Stateless
Select queryPost /login
User=Jay&pass=xyz
200 Ok
Set-cookie:Name=Jay
Found Jay
Browser Server
GET /profile
Cookie:name=Jay
/profile
Hi Jay
Select query
Post /login
User=Jay&&pass=xy
200 Ok
Set-cookie:sessionid=6swe.. Set id=6swe…[]
Get /homepage
Cookie:sessionid=6swe…
Browser Server
Storage where reference s
200 ok
response
Found Jay
Id=6swe
..
Is there any alternative approach instead of storing user’s
state at server side??
Statelessness
which is more preferable for API’s authentication where
Authentication can be done by one server(Authentication
server) and resource can be retrieved by another
server(resource server)
Example: Any single sign on implementation
Select query
Post /login
User=Jay&&pass=xyz
200 Ok
Set-cookie: eyr…[]
Get /homepage
Cookie: eyr…[]
Write + Sign
Verify + Read
200 ok
response
A JSON Web Token (JWT) is a JSON
object that is defined in RFC 7519 as a
safe way to exchange set of information
between two parties. The token is
composed of a header, a payload, and a
signature.
What it JWT??
Structure of JWT??
Both Header and payload are base64 encoded values not encrypted Values..
So anyone can decode header and payload values..
{
"alg": "HS256",
"typ": "JWT"
}
In short header says what algorithm is
being used to create signature
Header : Header part contains Meta Data
Claims:
{
"iss": "Identifier of our Authentication
Server",
"iat": 1504699136,
"sub": "github|353454354354353453",
"exp": 1504699256
}
Payload: Actual data to be exchanged between
two parties
• aud (audience): Recipient for which the JWT is intended
• iss (issuer): Issuer of the JWT
• sub (subject): Subject of the JWT (the user)
• exp (expiration time): Time after which the JWT expires
• nbf (not before time): Time before which the JWT must not be accepted
for processing
• iat (issued at time): Time at which the JWT was issued; can be used to
determine age of the JWT
• jti (JWT ID): Unique identifier; can be used to prevent the JWT from
being replayed (allows a token to be used only once)
More Claims..
HMACSHA256(
base64UrlEncode(header) + "."
+ base64UrlEncode(payload),
secret)
Signature : This part handles
integrity
Typical Workflow of JWT
Now, the important question
what are the security concerns
with JWT..??
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3
ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwic3NuIjoiNzg5MTIzNDU2Ny
IsImRvYiI6IjE1LTA4LTE5OTgiLCJpYXQiOjE1MTYyMzkwMjJ9.tEN
6j4ZeHfeU9HdcpRD9ecF37Xr48CTwxqBBYWRfAwg
Since header and payload are base64 encoded, anyone can decode it
to view data. If we decode above token, you can view sensitive data
Information Leakage
Two mitigate this issue, JWT token has to be implemented in JWE format
JWT is classified based on JOSE
JWT can be implemented in Two ways
1. JWS (JSON web Signature )
2. JWE (JSON web Encryption)
To mitigate information leakage vulnerability one has to
implement JWE
Decode header value and change ‘alg’ value as ‘none’
and encode it again.
Since we are changing algorithm as none, no need to
have signature value.. Let’s try..
Demo time:
http://demo.sjoerdlangkemper.nl/jwtdemo/hs256.php
Check if JWT supports ‘NONE’ as
algorithm
Symmetric Algorithm(Single
key concept)
Asymmetric algorithm (Public
key and private key concept)
What are the cryptography algorithms can be
used to create signature
What could be possible hacks??
Bruteforcing is possible
Demo time with jwt.io
In case of symmetric algorithm key strength
of secret is very crucial.
If it weak, it can be easily brute forcible
using any brute forcing tools like (John the
ripper..)
What if Symmetric alg used?
Demo with RS256
What if Asymmetric alg used?
What if I convert alg value from ‘RS256’ to ‘HS256’ and
What if I consider public key as secret to create a signature??
 Question is how to get Public key..!!
 openssl s_client -connect
zonksec.com:443 | openssl x509 -pubkey
-noout
 Get with the help if android application
exists
Conti..
Possibility of authorization bypass exists if developer’s
appends payload parameters into URL parameters..
Eg: Employee id parameter in both JWT token and as URL parameter
GET /Empinfo?employeid=544123
Host: xyz.com
Authorization:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0
NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwic3NuIjoiOTIzNDQ1Njc5IiwiZ
W1wbG95ZWlkIjoiNTQ0MTIzIiwiaWF0IjoxNTE2MjM5MDAyMn0.lLX7hN
kRJzZsk_4xuzmPZwStfVe8s20caJEOqpBcrlA
Note: This scenario mayn’t come into JWT’s security bucket but possibility of security threat is there if developers
transmits parameters values in both as part of JWT and as part of URL parameters
Authorization Bypass
Jsonwebtokens extension
Json-webtokenattacker extension for
checking RSA
Burp Automation Support
 Recommended to use Asymmetric algorithm to
create signature. Incase of symmetric algorithm key
has to be shared with resource server(if multiple
resource server’s exists it would be a problem..!!)
 Use an appropriate Key size
 Don’t pass sensitive data as part of JWT
 Always verify ‘alg’ value at server side such that it
should not contains ‘none’ as value for ‘alg’ field
Recommendations
 https://www.sjoerdlangkemper.nl/2016/09/28/attacking-jwt-
authentication/
 https://github.com/hashcat/hashcat/issues/1057
 https://www.nccgroup.trust/uk/about-us/newsroom-and-
events/blogs/2019/january/jwt-attack-walk-through/
References:
Questions Please..!!
Thank you 

More Related Content

What's hot

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
 
Modern API Security with JSON Web Tokens
Modern API Security with JSON Web TokensModern API Security with JSON Web Tokens
Modern API Security with JSON Web TokensJonathan LeBlanc
 
Hacking Adobe Experience Manager sites
Hacking Adobe Experience Manager sitesHacking Adobe Experience Manager sites
Hacking Adobe Experience Manager sitesMikhail Egorov
 
Pentesting Rest API's by :- Gaurang Bhatnagar
Pentesting Rest API's by :- Gaurang BhatnagarPentesting Rest API's by :- Gaurang Bhatnagar
Pentesting Rest API's by :- Gaurang BhatnagarOWASP Delhi
 
Java Deserialization Vulnerabilities - The Forgotten Bug Class
Java Deserialization Vulnerabilities - The Forgotten Bug ClassJava Deserialization Vulnerabilities - The Forgotten Bug Class
Java Deserialization Vulnerabilities - The Forgotten Bug ClassCODE WHITE GmbH
 
Understanding REST
Understanding RESTUnderstanding REST
Understanding RESTNitin Pande
 
A2 - broken authentication and session management(OWASP thailand chapter Apri...
A2 - broken authentication and session management(OWASP thailand chapter Apri...A2 - broken authentication and session management(OWASP thailand chapter Apri...
A2 - broken authentication and session management(OWASP thailand chapter Apri...Noppadol Songsakaew
 
REST API and CRUD
REST API and CRUDREST API and CRUD
REST API and CRUDPrem Sanil
 
OAuth 2.0 and OpenId Connect
OAuth 2.0 and OpenId ConnectOAuth 2.0 and OpenId Connect
OAuth 2.0 and OpenId ConnectSaran Doraiswamy
 
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization BlueHat v17 || Dangerous Contents - Securing .Net Deserialization
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization BlueHat Security Conference
 
Client-side JavaScript
Client-side JavaScriptClient-side JavaScript
Client-side JavaScriptLilia Sfaxi
 
Node js overview
Node js overviewNode js overview
Node js overviewEyal Vardi
 
HTTP Request Smuggling via higher HTTP versions
HTTP Request Smuggling via higher HTTP versionsHTTP Request Smuggling via higher HTTP versions
HTTP Request Smuggling via higher HTTP versionsneexemil
 

What's hot (20)

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
 
JSON Web Tokens
JSON Web TokensJSON Web Tokens
JSON Web Tokens
 
Modern API Security with JSON Web Tokens
Modern API Security with JSON Web TokensModern API Security with JSON Web Tokens
Modern API Security with JSON Web Tokens
 
Hacking Adobe Experience Manager sites
Hacking Adobe Experience Manager sitesHacking Adobe Experience Manager sites
Hacking Adobe Experience Manager sites
 
Pentesting Rest API's by :- Gaurang Bhatnagar
Pentesting Rest API's by :- Gaurang BhatnagarPentesting Rest API's by :- Gaurang Bhatnagar
Pentesting Rest API's by :- Gaurang Bhatnagar
 
Java Deserialization Vulnerabilities - The Forgotten Bug Class
Java Deserialization Vulnerabilities - The Forgotten Bug ClassJava Deserialization Vulnerabilities - The Forgotten Bug Class
Java Deserialization Vulnerabilities - The Forgotten Bug Class
 
Understanding REST
Understanding RESTUnderstanding REST
Understanding REST
 
A2 - broken authentication and session management(OWASP thailand chapter Apri...
A2 - broken authentication and session management(OWASP thailand chapter Apri...A2 - broken authentication and session management(OWASP thailand chapter Apri...
A2 - broken authentication and session management(OWASP thailand chapter Apri...
 
REST API and CRUD
REST API and CRUDREST API and CRUD
REST API and CRUD
 
Spring Security 5
Spring Security 5Spring Security 5
Spring Security 5
 
Jhon the ripper
Jhon the ripper Jhon the ripper
Jhon the ripper
 
OAuth 2.0 and OpenId Connect
OAuth 2.0 and OpenId ConnectOAuth 2.0 and OpenId Connect
OAuth 2.0 and OpenId Connect
 
Node js introduction
Node js introductionNode js introduction
Node js introduction
 
Codeigniter framework
Codeigniter framework Codeigniter framework
Codeigniter framework
 
Spring Security
Spring SecuritySpring Security
Spring Security
 
Breaking Bad CSP
Breaking Bad CSPBreaking Bad CSP
Breaking Bad CSP
 
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization BlueHat v17 || Dangerous Contents - Securing .Net Deserialization
BlueHat v17 || Dangerous Contents - Securing .Net Deserialization
 
Client-side JavaScript
Client-side JavaScriptClient-side JavaScript
Client-side JavaScript
 
Node js overview
Node js overviewNode js overview
Node js overview
 
HTTP Request Smuggling via higher HTTP versions
HTTP Request Smuggling via higher HTTP versionsHTTP Request Smuggling via higher HTTP versions
HTTP Request Smuggling via higher HTTP versions
 

Similar to Pentesting jwt

Appsec usa2013 js_libinsecurity_stefanodipaola
Appsec usa2013 js_libinsecurity_stefanodipaolaAppsec usa2013 js_libinsecurity_stefanodipaola
Appsec usa2013 js_libinsecurity_stefanodipaoladrewz lin
 
Syrup pay 인증 모듈 개발 사례
Syrup pay 인증 모듈 개발 사례Syrup pay 인증 모듈 개발 사례
Syrup pay 인증 모듈 개발 사례HyungTae Lim
 
[4developers2016] - Security in the era of modern applications and services (...
[4developers2016] - Security in the era of modern applications and services (...[4developers2016] - Security in the era of modern applications and services (...
[4developers2016] - Security in the era of modern applications and services (...PROIDEA
 
Test & Tea : ITSEC testing, manual vs automated
Test & Tea : ITSEC testing, manual vs automatedTest & Tea : ITSEC testing, manual vs automated
Test & Tea : ITSEC testing, manual vs automatedZoltan Balazs
 
How to Build Your Own Blockchain
How to Build Your Own BlockchainHow to Build Your Own Blockchain
How to Build Your Own BlockchainLeonid Beder
 
Hacking MongoDB at RelateIQ, A Salesforce Company
Hacking MongoDB at RelateIQ, A Salesforce CompanyHacking MongoDB at RelateIQ, A Salesforce Company
Hacking MongoDB at RelateIQ, A Salesforce CompanyMongoDB
 
2016 pycontw web api authentication
2016 pycontw web api authentication 2016 pycontw web api authentication
2016 pycontw web api authentication Micron Technology
 
How to Shot Web - Jason Haddix at DEFCON 23 - See it Live: Details in Descrip...
How to Shot Web - Jason Haddix at DEFCON 23 - See it Live: Details in Descrip...How to Shot Web - Jason Haddix at DEFCON 23 - See it Live: Details in Descrip...
How to Shot Web - Jason Haddix at DEFCON 23 - See it Live: Details in Descrip...bugcrowd
 
CBSecurity 3 - Secure Your ColdBox Applications
CBSecurity 3 - Secure Your ColdBox ApplicationsCBSecurity 3 - Secure Your ColdBox Applications
CBSecurity 3 - Secure Your ColdBox ApplicationsOrtus Solutions, Corp
 
AtlasCamp 2014: Building a Connect Add-on With Your Own Stack
AtlasCamp 2014: Building a Connect Add-on With Your Own StackAtlasCamp 2014: Building a Connect Add-on With Your Own Stack
AtlasCamp 2014: Building a Connect Add-on With Your Own StackAtlassian
 
Hacker Halted 2018: From CTF to CVE – How Application of Concepts and Persist...
Hacker Halted 2018: From CTF to CVE – How Application of Concepts and Persist...Hacker Halted 2018: From CTF to CVE – How Application of Concepts and Persist...
Hacker Halted 2018: From CTF to CVE – How Application of Concepts and Persist...EC-Council
 
Testing at Both Ends of the Triangle
Testing at Both Ends of the TriangleTesting at Both Ends of the Triangle
Testing at Both Ends of the TriangleDerek Graham
 
DEFCON 23 - Jason Haddix - how do i shot web
DEFCON 23 - Jason Haddix - how do i shot webDEFCON 23 - Jason Haddix - how do i shot web
DEFCON 23 - Jason Haddix - how do i shot webFelipe Prado
 
Testing Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchTesting Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchMats Bryntse
 
What is the cost of a secret
What is the cost of a secretWhat is the cost of a secret
What is the cost of a secretLibbySchulze
 
Secure Node Code (workshop, O'Reilly Security)
Secure Node Code (workshop, O'Reilly Security)Secure Node Code (workshop, O'Reilly Security)
Secure Node Code (workshop, O'Reilly Security)Guy Podjarny
 
Hacker vs company, Cloud Cyber Security Automated with Kubernetes - Demi Ben-...
Hacker vs company, Cloud Cyber Security Automated with Kubernetes - Demi Ben-...Hacker vs company, Cloud Cyber Security Automated with Kubernetes - Demi Ben-...
Hacker vs company, Cloud Cyber Security Automated with Kubernetes - Demi Ben-...Demi Ben-Ari
 

Similar to Pentesting jwt (20)

JWTs and JOSE in a flash
JWTs and JOSE in a flashJWTs and JOSE in a flash
JWTs and JOSE in a flash
 
Appsec usa2013 js_libinsecurity_stefanodipaola
Appsec usa2013 js_libinsecurity_stefanodipaolaAppsec usa2013 js_libinsecurity_stefanodipaola
Appsec usa2013 js_libinsecurity_stefanodipaola
 
Syrup pay 인증 모듈 개발 사례
Syrup pay 인증 모듈 개발 사례Syrup pay 인증 모듈 개발 사례
Syrup pay 인증 모듈 개발 사례
 
[4developers2016] - Security in the era of modern applications and services (...
[4developers2016] - Security in the era of modern applications and services (...[4developers2016] - Security in the era of modern applications and services (...
[4developers2016] - Security in the era of modern applications and services (...
 
Test & Tea : ITSEC testing, manual vs automated
Test & Tea : ITSEC testing, manual vs automatedTest & Tea : ITSEC testing, manual vs automated
Test & Tea : ITSEC testing, manual vs automated
 
How to Build Your Own Blockchain
How to Build Your Own BlockchainHow to Build Your Own Blockchain
How to Build Your Own Blockchain
 
Hacking MongoDB at RelateIQ, A Salesforce Company
Hacking MongoDB at RelateIQ, A Salesforce CompanyHacking MongoDB at RelateIQ, A Salesforce Company
Hacking MongoDB at RelateIQ, A Salesforce Company
 
2016 pycontw web api authentication
2016 pycontw web api authentication 2016 pycontw web api authentication
2016 pycontw web api authentication
 
How to Shot Web - Jason Haddix at DEFCON 23 - See it Live: Details in Descrip...
How to Shot Web - Jason Haddix at DEFCON 23 - See it Live: Details in Descrip...How to Shot Web - Jason Haddix at DEFCON 23 - See it Live: Details in Descrip...
How to Shot Web - Jason Haddix at DEFCON 23 - See it Live: Details in Descrip...
 
CBSecurity 3 - Secure Your ColdBox Applications
CBSecurity 3 - Secure Your ColdBox ApplicationsCBSecurity 3 - Secure Your ColdBox Applications
CBSecurity 3 - Secure Your ColdBox Applications
 
AtlasCamp 2014: Building a Connect Add-on With Your Own Stack
AtlasCamp 2014: Building a Connect Add-on With Your Own StackAtlasCamp 2014: Building a Connect Add-on With Your Own Stack
AtlasCamp 2014: Building a Connect Add-on With Your Own Stack
 
Hacker Halted 2018: From CTF to CVE – How Application of Concepts and Persist...
Hacker Halted 2018: From CTF to CVE – How Application of Concepts and Persist...Hacker Halted 2018: From CTF to CVE – How Application of Concepts and Persist...
Hacker Halted 2018: From CTF to CVE – How Application of Concepts and Persist...
 
Testing at Both Ends of the Triangle
Testing at Both Ends of the TriangleTesting at Both Ends of the Triangle
Testing at Both Ends of the Triangle
 
Real_World_0days.pdf
Real_World_0days.pdfReal_World_0days.pdf
Real_World_0days.pdf
 
Eyes or heart
Eyes or heartEyes or heart
Eyes or heart
 
DEFCON 23 - Jason Haddix - how do i shot web
DEFCON 23 - Jason Haddix - how do i shot webDEFCON 23 - Jason Haddix - how do i shot web
DEFCON 23 - Jason Haddix - how do i shot web
 
Testing Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchTesting Ext JS and Sencha Touch
Testing Ext JS and Sencha Touch
 
What is the cost of a secret
What is the cost of a secretWhat is the cost of a secret
What is the cost of a secret
 
Secure Node Code (workshop, O'Reilly Security)
Secure Node Code (workshop, O'Reilly Security)Secure Node Code (workshop, O'Reilly Security)
Secure Node Code (workshop, O'Reilly Security)
 
Hacker vs company, Cloud Cyber Security Automated with Kubernetes - Demi Ben-...
Hacker vs company, Cloud Cyber Security Automated with Kubernetes - Demi Ben-...Hacker vs company, Cloud Cyber Security Automated with Kubernetes - Demi Ben-...
Hacker vs company, Cloud Cyber Security Automated with Kubernetes - Demi Ben-...
 

Recently uploaded

cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 

Recently uploaded (20)

cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 

Pentesting jwt

  • 1. { Pentesting JWT By Jaya Kumar Kondapalli
  • 2. WhoAM I? Just a Security Enthusiast Was Functional tester by chance.. Now, Penetration tester by choice.. I feel Shy talking about myself
  • 3. History behind JWT? What is JWT and it’s structure? Security concerns with JWT Recommendations Agenda
  • 4. Have you ever seen data like this?? eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIi wibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF 2QT4fwpMeJf36POk6yJV_adQssw5c Have you observed any pattern in the above value??
  • 5. Let’s go back to History: HTTP is Stateless Select queryPost /login User=Jay&pass=xyz 200 Ok Set-cookie:Name=Jay Found Jay Browser Server GET /profile Cookie:name=Jay /profile Hi Jay
  • 6. Select query Post /login User=Jay&&pass=xy 200 Ok Set-cookie:sessionid=6swe.. Set id=6swe…[] Get /homepage Cookie:sessionid=6swe… Browser Server Storage where reference s 200 ok response Found Jay Id=6swe ..
  • 7. Is there any alternative approach instead of storing user’s state at server side?? Statelessness which is more preferable for API’s authentication where Authentication can be done by one server(Authentication server) and resource can be retrieved by another server(resource server) Example: Any single sign on implementation
  • 8. Select query Post /login User=Jay&&pass=xyz 200 Ok Set-cookie: eyr…[] Get /homepage Cookie: eyr…[] Write + Sign Verify + Read 200 ok response
  • 9. A JSON Web Token (JWT) is a JSON object that is defined in RFC 7519 as a safe way to exchange set of information between two parties. The token is composed of a header, a payload, and a signature. What it JWT??
  • 10. Structure of JWT?? Both Header and payload are base64 encoded values not encrypted Values.. So anyone can decode header and payload values..
  • 11. { "alg": "HS256", "typ": "JWT" } In short header says what algorithm is being used to create signature Header : Header part contains Meta Data
  • 12. Claims: { "iss": "Identifier of our Authentication Server", "iat": 1504699136, "sub": "github|353454354354353453", "exp": 1504699256 } Payload: Actual data to be exchanged between two parties
  • 13. • aud (audience): Recipient for which the JWT is intended • iss (issuer): Issuer of the JWT • sub (subject): Subject of the JWT (the user) • exp (expiration time): Time after which the JWT expires • nbf (not before time): Time before which the JWT must not be accepted for processing • iat (issued at time): Time at which the JWT was issued; can be used to determine age of the JWT • jti (JWT ID): Unique identifier; can be used to prevent the JWT from being replayed (allows a token to be used only once) More Claims..
  • 14. HMACSHA256( base64UrlEncode(header) + "." + base64UrlEncode(payload), secret) Signature : This part handles integrity
  • 16. Now, the important question what are the security concerns with JWT..??
  • 17. eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3 ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwic3NuIjoiNzg5MTIzNDU2Ny IsImRvYiI6IjE1LTA4LTE5OTgiLCJpYXQiOjE1MTYyMzkwMjJ9.tEN 6j4ZeHfeU9HdcpRD9ecF37Xr48CTwxqBBYWRfAwg Since header and payload are base64 encoded, anyone can decode it to view data. If we decode above token, you can view sensitive data Information Leakage Two mitigate this issue, JWT token has to be implemented in JWE format
  • 18. JWT is classified based on JOSE JWT can be implemented in Two ways 1. JWS (JSON web Signature ) 2. JWE (JSON web Encryption) To mitigate information leakage vulnerability one has to implement JWE
  • 19. Decode header value and change ‘alg’ value as ‘none’ and encode it again. Since we are changing algorithm as none, no need to have signature value.. Let’s try.. Demo time: http://demo.sjoerdlangkemper.nl/jwtdemo/hs256.php Check if JWT supports ‘NONE’ as algorithm
  • 20. Symmetric Algorithm(Single key concept) Asymmetric algorithm (Public key and private key concept) What are the cryptography algorithms can be used to create signature
  • 21. What could be possible hacks?? Bruteforcing is possible Demo time with jwt.io In case of symmetric algorithm key strength of secret is very crucial. If it weak, it can be easily brute forcible using any brute forcing tools like (John the ripper..) What if Symmetric alg used?
  • 22. Demo with RS256 What if Asymmetric alg used? What if I convert alg value from ‘RS256’ to ‘HS256’ and What if I consider public key as secret to create a signature??
  • 23.  Question is how to get Public key..!!  openssl s_client -connect zonksec.com:443 | openssl x509 -pubkey -noout  Get with the help if android application exists Conti..
  • 24. Possibility of authorization bypass exists if developer’s appends payload parameters into URL parameters.. Eg: Employee id parameter in both JWT token and as URL parameter GET /Empinfo?employeid=544123 Host: xyz.com Authorization:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0 NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwic3NuIjoiOTIzNDQ1Njc5IiwiZ W1wbG95ZWlkIjoiNTQ0MTIzIiwiaWF0IjoxNTE2MjM5MDAyMn0.lLX7hN kRJzZsk_4xuzmPZwStfVe8s20caJEOqpBcrlA Note: This scenario mayn’t come into JWT’s security bucket but possibility of security threat is there if developers transmits parameters values in both as part of JWT and as part of URL parameters Authorization Bypass
  • 25. Jsonwebtokens extension Json-webtokenattacker extension for checking RSA Burp Automation Support
  • 26.  Recommended to use Asymmetric algorithm to create signature. Incase of symmetric algorithm key has to be shared with resource server(if multiple resource server’s exists it would be a problem..!!)  Use an appropriate Key size  Don’t pass sensitive data as part of JWT  Always verify ‘alg’ value at server side such that it should not contains ‘none’ as value for ‘alg’ field Recommendations
  • 27.  https://www.sjoerdlangkemper.nl/2016/09/28/attacking-jwt- authentication/  https://github.com/hashcat/hashcat/issues/1057  https://www.nccgroup.trust/uk/about-us/newsroom-and- events/blogs/2019/january/jwt-attack-walk-through/ References: