GithubHelp home page GithubHelp logo

dontpanico / jwtxploiter Goto Github PK

View Code? Open in Web Editor NEW
259.0 7.0 30.0 368 KB

A tool to test security of json web token

License: GNU General Public License v3.0

Python 98.70% Shell 1.30%
jku jwks x5u-injection jwt jwt-security jwt-cracker jwt-exploit security-tools pentesting pentest

jwtxploiter's Introduction

Python 3.7|3.9 License: GPL v3 release 1.2.1 pypi 1.2.1

jwtXploiter

A tool to test security of JSON Web Tokens. Test a JWT against all known CVEs;

  • Tamper with the token payload: changes claims and subclaims values.
  • Exploit known vulnerable header claims (kid, jku, x5u)
  • Verify a token
  • Retrieve the public key of your target's ssl connection and try to use it in a key confusion attack with one option only
  • All JWAs supported
  • Generates a JWK and insert it in the token header
  • And much, much more!

Wiki

  • Read the wiki! wiki

Installation

N.B. Cloning the repository should be avoided except for development purposes! N.B. Deb package has to be considered beta

  • With rpm:

    wget http://andreatedeschi.uno/jwtxploiter/jwtxploiter-1.2.1-1.noarch.rpm
    sudo rpm --install jwtxploiter-1.2.1-1.noarch.rpm

    or, if previous version is installed on your machine

    sudo rpm --upgrade jwtxploiter-1.2.1-1.noarch.rpm
  • With pip:

    sudo pip install jwtxploiter
  • With deb:

    wget http://andreatedeschi.uno/jwtxploiter/jwtxploiter_1.2.1-1_all.deb
    sudo dpkg -i jwtxploiter_1.2.1-1_all.deb
  • Cloing the repo:

    git clone https://github.com/DontPanicO/jwtXploiter.git
    ./install.sh

N.B. python3-pip package is required to install dependencies, be sure to have it installed.

Who this tool is written for?

  • Web Application Penetration Tester / Bug Bounty Hunters

    • This tool has been written with the aim of become a key part of pentesters toolkit.
  • Devs who need to test the secuirty of JWTs used in their applications

  • CTF Players

  • Not For Students

    • Since this tool automates lot of stuff, without force the user to know what's happening under the hood, it won't help you to understand the vulnerabilities it exploits.

To Know

  • For attacks that generates a jwks file, you could find it in the current working directory. Remeber to deletes such files in order to avoid conflicts.

  • For jku/x5u injection that needs to merge two urls (the server vulnerable url and your one), the HERE keyword is required.

  • For redirect attacks the keyword should replace the redirect url, e.g.

  • For jku/x5u injections via HTTP header injection attacks, the HERE keyword sould be appended to the vulnerable parameter, without replacing its value, e.g.

  • Also, in such cases, be sure to pass the server url and your one as comma separated values.

  • '/.well-known/jwks.json' is automatically appended to your url in jku/x5u attacks. So make sure to place the jwks file under this path on your server.

  • If you don't want that happen, use the --manual option, but this option is compatible only with --jku-basic and --x5u-basic so, you will need to manually craft the url and pass it to those options, even for attacks that exploit Open Redirect or HTTP header injection.

  • Look at the wiki for a detailed documentation.

jwtxploiter's People

Contributors

auror007 avatar dontpanico avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

jwtxploiter's Issues

FileNotFoundError when passing non existing key file to -k/--key

Describe the bug
Exception FileNotFoundError not properly handled, when passing a non existing key file to -k/--key.
This happen only with asymmetric algorithms, since it's been handled with HS*

To Reproduce

  1. Get a valid JWT (you can grab it from jwt.io)
  2. Run an attack using an asymmetric algorithm and passing a non existing key file to -k
    jwtxpl <token> -a rs256 -p <key>:<value> -k /path/to/non/existing

Expected behavior
The script should properly handle this exception and return a custom error

CLOSED!!! UnboundLocalError with none algortihm

  • Before time of writing, selecting alg none will raise an exceptions. This is due since during validation the script converts algorithms
    to uppercase, but the method which select the signature only look for 'none' or 'None'.

  • SOLVED, converting algorithm to uppercase only if its lowercase differ from 'none'.

  • I WILL LEAVE THE ISSUE OPENED 3 DAYS IN ORDER TO MAKE IT MORE VISIBLE TO PEOPLE RAN INTO THAT ERROR.

AttributeError if jwks file does not contain the verifier key

Describe the bug
Running --find-key-from-jwks raise AttributeError if jwks file does not contain a key that can verify the token

To Reproduce

  1. Get a token
  2. Get a JWKS file that does not contain the key that can verify the token signature
  3. run jwtxpl <token> --find-key-from-jwks <jwks_file>

Expected behavior
No AttributeError should be raised

Additional context
This is due to a typo an attribute has been typed incorrectly), and not for an unhandled exception

JWKS file not properly generated

Describe the bug
Jku and x5u attacks that return jwks files miss to generates it.

To Reproduce
Run a jku/x5u attack against a valid target (not --jku-inbody and --x5u-inbody, since they does not returns jwks files)

Expected behavior
The tool should return the crafted jwks file

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.