Logo Sast Jwt

Sast Jwt

Cộng đồngPhổ biến
utkusen
sast-jwt

Detect insecure JWT (JSON Web Token) implementations in a codebase using a two-phase approach: first map all JWT issuance and verification sites to understand the token lifecycle and signing configuration, then check each verification site for exploitable weaknesses such as algorithm confusion, missing signature verification, weak secrets, header injection, and missing claim validation. Requires sast/architecture.md (run sast-analysis first). Outputs findings to sast/jwt-results.md. If no JWT usage is found in Phase 1, Phase 2 is skipped. Use when asked to find JWT, token forgery, or authentication bypass bugs.

Tổng quan

Nhà phát hànhutkusen
Kho mãsast-skills
Tên kỹ năngsast-jwt
Sao
1.3K
Bản fork
64
Tệp đi kèm
Chỉ có hướng dẫn
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Hướng dẫn có đủ mọi thứ cần thiết

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được utkusen công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Sast Jwt trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/utkusen/sast-skills/tree/main/sast-files/.agents/skills/sast-jwt
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/utkusen/sast-skills.git /tmp/sast-skills
mkdir -p .claude/skills
cp -r /tmp/sast-skills/sast-files/.agents/skills/sast-jwt .claude/skills/sast-jwt
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Sast Jwt trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Sast Jwt ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Sast Jwt với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

JWT Vulnerability Detection

You are performing a focused security assessment to find insecure JSON Web Token (JWT) implementations. This skill uses a two-phase approach with subagents: recon (map the full JWT lifecycle — issuance, verification, and configuration) then analysis (identify every exploitable weakness in those verification sites).

Prerequisites: sast/architecture.md must exist. Run the analysis skill first if it doesn't.


What is an Insecure JWT Implementation

JWTs consist of three Base64URL-encoded parts: header.payload.signature. The header declares the signing algorithm (alg), the payload carries claims (e.g., sub, role, exp), and the signature is a cryptographic proof of integrity. Vulnerabilities arise when the server trusts the token's own claims about how it was signed, fails to verify the signature at all, uses a guessable secret, or trusts attacker-controlled key material embedded in the token itself.

The core pattern: the server does not fully verify the JWT's authenticity and integrity before trusting its claims.

What JWT Vulnerabilities ARE

1. Algorithm confusion — alg: none The server accepts a JWT whose header declares "alg": "none", bypassing signature verification entirely. An attacker crafts an arbitrary payload, sets alg to none, and omits the signature. If the library processes it, the forged token is accepted.

2. Algorithm confusion — RS256 → HS256 A server configured for RS256 (asymmetric: sign with private key, verify with public key) can be tricked into HS256 mode if the library allows the algorithm to be specified by the token. Since the public key is often retrievable, the attacker signs a forged token with HS256 using the server's public key as the HMAC secret. The server verifies the HMAC using the same public key and accepts the token.

3. Missing or disabled signature verification The server decodes the JWT payload without actually verifying the signature. Common patterns:

  • Python (PyJWT): jwt.decode(token, options={"verify_signature": False})
  • Node.js (jsonwebtoken): jwt.decode(token) instead of jwt.verify(token, secret)
  • Manual base64 decode of the payload with no signature check
  • algorithms=["none"] accepted in the decode call

4. Weak or hardcoded HMAC secret The server signs tokens with a short, guessable, or hardcoded secret (e.g., "secret", "password", "changeme", "jwt-secret-key"). An attacker who captures a valid token can brute-force the secret offline with tools like hashcat or jwt_tool, then forge arbitrary tokens.

5. Embedded JWK (jwk header injection) The token header contains an embedded JSON Web Key (jwk parameter). If the verification code trusts the embedded key to verify the token's own signature, an attacker generates their own key pair, signs a forged token with their private key, and embeds their public key in the header. The server verifies the signature using the attacker's embedded public key and accepts the token.

6. JKU / X5U header injection The jku (JWK Set URL) or x5u (X.509 certificate URL) header value is used to fetch the verification key from a URL. If the server does not validate the URL against an allowlist, the attacker can point it to their own server hosting a crafted key set.

7. Key ID (kid) header injection The kid header is used to look up the signing key, often from a database or the filesystem. If the kid value is interpolated into a SQL query without sanitization, it becomes an SQL injection vector. If it is concatenated into a file path, it becomes a path traversal vector.

8. Missing claim validation

  • exp not checked → expired tokens remain valid forever
  • iss (issuer) not checked → tokens issued by other services are accepted
  • aud (audience) not checked → tokens intended for other services are accepted
  • nbf (not-before) not checked → tokens used before their valid window

9. No token revocation There is no token blacklist or revocation mechanism. Stolen or logged-out tokens remain valid until they expire. This matters most when token lifetimes are long.

What JWT Vulnerabilities are NOT

Do not flag these as JWT vulnerabilities:

  • IDOR: Changing a user_id claim to access another user's data is an authorization flaw, not a JWT forgery — only flag if the token itself can be forged
  • XSS via JWT payload: Injecting <script> into a claim that is later rendered unescaped — that's XSS, not a JWT bug
  • CSRF: JWT in cookies without SameSite — that's a CSRF concern, not a JWT integrity issue
  • Properly restricted verification: jwt.verify(token, secret, { algorithms: ['HS256'] }) with a strong secret — not vulnerable

Patterns That Prevent JWT Vulnerabilities

1. Algorithm allowlist in verification call

python
# Python — PyJWT: explicitly specify allowed algorithms
payload = jwt.decode(token, secret, algorithms=["HS256"])

# Node.js — jsonwebtoken: restrict algorithms
jwt.verify(token, secret, { algorithms: ['HS256'] })

# Java — jjwt: specify expected algorithm
Jwts.parserBuilder().setSigningKey(key).build().parseClaimsJws(token)
# (jjwt does not use the header's alg; it uses the key type)

2. Strong, randomly generated secret

python
# Strong secret: at least 256 bits of entropy, not hardcoded
import secrets
SECRET_KEY = secrets.token_hex(32)  # load from env in production

3. Full claim validation

python
payload = jwt.decode(
    token, secret, algorithms=["HS256"],
    options={"require": ["exp", "iss", "aud"]},
    issuer="https://myapp.example.com",
    audience="myapp-api"
)

4. Asymmetric keys with no algorithm ambiguity

javascript
// Use RS256 with public key for verification; never accept HS256 on the same endpoint
jwt.verify(token, publicKey, { algorithms: ['RS256'] })

5. JWK/JKU URL allowlist

python
# Only fetch keys from a known, trusted JWKS endpoint
ALLOWED_JWKS_URLS = {"https://accounts.google.com/.well-known/jwks.json"}
if jku not in ALLOWED_JWKS_URLS:
    raise ValueError("Untrusted JWK URL")

Vulnerable vs. Secure Examples

Python — PyJWT

python
# VULNERABLE: signature verification disabled
def get_current_user(token: str):
    payload = jwt.decode(token, options={"verify_signature": False})
    return payload["user_id"]

# VULNERABLE: accepts alg:none because no algorithm restriction
def get_current_user(token: str):
    payload = jwt.decode(token, SECRET_KEY)  # PyJWT < 2.x default: accepts any alg
    return payload["user_id"]

# VULNERABLE: weak hardcoded secret
SECRET_KEY = "secret"
payload = jwt.decode(token, SECRET_KEY, algorithms=["HS256"])

# SECURE: algorithm restricted, strong secret from env
SECRET_KEY = os.environ["JWT_SECRET"]  # strong, random, from environment
def get_current_user(token: str):
    payload = jwt.decode(token, SECRET_KEY, algorithms=["HS256"])
    return payload["user_id"]

Node.js — jsonwebtoken

javascript
// VULNERABLE: jwt.decode() — no signature verification
function getUser(token) {
  const payload = jwt.decode(token);  // decode only, never verify
  return payload.userId;
}

// VULNERABLE: algorithms not restricted — susceptible to alg:none or RS256→HS256
function getUser(token) {
  const payload = jwt.verify(token, SECRET);  // no algorithms option
  return payload.userId;
}

// VULNERABLE: weak hardcoded secret
const SECRET = "password123";
jwt.verify(token, SECRET, { algorithms: ['HS256'] });

// SECURE: algorithm restricted, strong secret from env
const SECRET = process.env.JWT_SECRET;
function getUser(token) {
  const payload = jwt.verify(token, SECRET, { algorithms: ['HS256'] });
  return payload.userId;
}

Java — jjwt

java
// VULNERABLE: deprecated parser (accepts alg from header)
Jwts.parser().setSigningKey(key).parseClaimsJws(token);

// VULNERABLE: no expiry check — the library default may not enforce exp
Claims claims = Jwts.parserBuilder()
    .setSigningKey(key).build()
    .parseClaimsJws(token).getBody();
// claims.getExpiration() never checked

// SECURE: parserBuilder (does not trust header alg; uses key type)
Claims claims = Jwts.parserBuilder()
    .requireIssuer("myapp")
    .requireAudience("myapp-api")
    .setSigningKey(key)
    .build()
    .parseClaimsJws(token)
    .getBody();

Go — golang-jwt / dgrijalva/jwt-go

go
// VULNERABLE: accepts any algorithm including "none"
token, _ := jwt.Parse(tokenString, func(token *jwt.Token) (interface{}, error) {
    return []byte(secret), nil  // no algorithm check
})

// VULNERABLE: weak secret
var jwtKey = []byte("secret")

// SECURE: validate signing method before returning key
token, err := jwt.Parse(tokenString, func(token *jwt.Token) (interface{}, error) {
    if _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {
        return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"])
    }
    return jwtKey, nil
})

kid header SQL injection

python
# VULNERABLE: kid used in SQL query without sanitization
def get_signing_key(kid):
    result = db.execute(f"SELECT key FROM jwt_keys WHERE id = '{kid}'")
    return result.fetchone()[0]

token_header = jwt.get_unverified_header(token)
key = get_signing_key(token_header["kid"])  # attacker controls kid
jwt.decode(token, key, algorithms=["HS256"])

# SECURE: kid validated against allowlist or parameterized lookup
def get_signing_key(kid):
    result = db.execute("SELECT key FROM jwt_keys WHERE id = %s", (kid,))
    row = result.fetchone()
    if not row:
        raise ValueError("Unknown key id")
    return row[0]

Embedded JWK injection

javascript
// VULNERABLE: trusts the jwk embedded in the token header
const { publicKey } = getPublicKeyFromHeader(decoded.header);  // attacker-supplied
jwt.verify(token, publicKey);

// SECURE: only use keys from a pre-configured, trusted source
const trustedKey = loadKeyFromConfig();
jwt.verify(token, trustedKey, { algorithms: ['RS256'] });

Execution

This skill runs in two phases using subagents. Pass the contents of sast/architecture.md to both subagents as context.

Phase 1: Map the JWT Lifecycle

Launch a subagent with the following instructions:

Goal: Map how the application creates, transmits, and verifies JWTs. Identify every JWT issuance and verification site, the library used, the signing algorithm and key/secret configuration, and the claims that are used for authorization. Write results to sast/jwt-recon.md.

Context: You will be given the project's architecture summary. Use it to understand the tech stack, authentication layer, and middleware patterns.

What to search for:

1. JWT library imports — identify which JWT library is in use:

  • Python: import jwt, from jose import, from authlib import, import python_jose
  • Node.js: require('jsonwebtoken'), import jwt from 'jsonwebtoken', jose, @nestjs/jwt
  • Java: io.jsonwebtoken, com.auth0.jwt, nimbus-jose-jwt
  • Go: github.com/golang-jwt/jwt, github.com/dgrijalva/jwt-go, github.com/lestrrat-go/jwx
  • Ruby: jwt gem (require 'jwt')
  • PHP: firebase/php-jwt, lcobucci/jwt
  • C#: System.IdentityModel.Tokens.Jwt, Microsoft.AspNetCore.Authentication.JwtBearer

2. JWT signing / issuance sites — where tokens are created:

  • jwt.encode(...), jwt.sign(...), Jwts.builder().signWith(...), JWT.create().sign(...)
  • Note the algorithm used (HS256, RS256, etc.) and where the secret/key comes from (env var, config, hardcoded)

3. JWT verification / decoding sites — where tokens are consumed:

  • jwt.decode(...), jwt.verify(...), Jwts.parserBuilder()...parseClaimsJws(...), JWT::decode(...)
  • Note what options are passed: algorithms, options, verify_signature, verify_exp
  • Note if it's a raw decode (no verification) vs. a verify call

4. Token extraction — where the token is read from the incoming request:

  • Authorization header: request.headers.get("Authorization"), req.headers['authorization']
  • Cookie: request.cookies.get("token"), req.cookies.token
  • Query parameter: request.args.get("token"), req.query.token

5. Authorization middleware / decorators — centralized JWT checks:

  • @jwt_required, @login_required, requireAuth, JwtAuthGuard, [Authorize], middleware functions
  • Note which routes are protected and which are unprotected

6. Signing secret / key configuration:

  • Where the HMAC secret or RSA/EC key is defined and loaded (env var, config file, hardcoded string)
  • Whether it looks strong (long random string) or weak (short, common word)

7. Claim usage:

  • Which claims are extracted and used for authorization (user_id, role, permissions, sub)
  • Whether exp, iss, aud, nbf are checked

Output format — write to sast/jwt-recon.md:

markdown
# JWT Recon: [Project Name]

## Summary
JWT is [used / not used] in this codebase.
Library: [library name and version if visible]
Algorithm(s): [HS256 / RS256 / etc.]

## Issuance Sites

### 1. [Descriptive name — e.g., "Token generation in login endpoint"]
- **File**: `path/to/file.ext` (lines X-Y)
- **Function / endpoint**: [function name or route]
- **Algorithm**: [e.g., HS256]
- **Secret/key source**: [env var name / hardcoded string / config key]
- **Claims set**: [list of claims added to the payload]
- **Code snippet**:

[the signing call]


## Verification Sites

### 1. [Descriptive name — e.g., "Token verification in auth middleware"]
- **File**: `path/to/file.ext` (lines X-Y)
- **Function / middleware**: [function name]
- **Verification call**: [jwt.decode / jwt.verify / parseClaimsJws / etc.]
- **Algorithm restriction**: [algorithms=["HS256"] / no restriction / unknown]
- **Signature verification**: [enabled / disabled / unclear]
- **Claims validated**: [exp / iss / aud / none / unknown]
- **Token source**: [Authorization header / cookie / query param]
- **kid/jwk/jku used**: [yes — describe how / no]
- **Code snippet**:

[the verification call and surrounding context]


## Secret / Key Configuration
- **Secret source**: [env var / hardcoded / config file]
- **Apparent strength**: [strong (long random) / weak (short/common) / unknown]
- **Code snippet** (if hardcoded or suspicious):

[relevant code]


## Authorization Middleware Coverage
- **Protected routes**: [list or description]
- **Unprotected routes**: [list or "none observed"]

After Phase 1: Check for JWT Usage Before Proceeding

After Phase 1 completes, read sast/jwt-recon.md. If the summary states JWT is not used (no issuance or verification sites were found), skip Phase 2 entirely. Instead, write the following content to sast/jwt-results.md and stop:

markdown
# JWT Analysis Results

No JWT usage detected in this codebase.

Only proceed to Phase 2 if Phase 1 found at least one JWT verification site.

Phase 2: Analyze JWT Verification Sites for Vulnerabilities

Launch a second subagent after Phase 1 completes with the following instructions:

Goal: For each JWT verification site in sast/jwt-recon.md, determine whether it is exploitable. Check for algorithm confusion, missing signature verification, weak secrets, header injection attacks, and missing claim validation. Write final results to sast/jwt-results.md.

Context: You will be given the project's architecture summary and the Phase 1 recon output. Use both to understand the full token lifecycle before analyzing each site.

For each verification site, check the following:

Check 1 — Algorithm restriction

  • Is the allowed algorithm explicitly specified in the verification call?
  • If no algorithm restriction is present, can the token's alg header be set to none to skip signature verification?
  • If the server uses an asymmetric algorithm (RS256, ES256), does the verification code also accept HMAC algorithms (HS256)? If so, the server may be vulnerable to the RS256→HS256 confusion attack.

Check 2 — Signature verification enabled

  • Is the token passed through a verify/parse call that actually checks the signature, or only through a decode-only call?
  • Look for options like verify_signature: False, complete=False, or the use of jwt.decode() (Node.js) instead of jwt.verify()
  • Manual base64-decode of the payload without any signature check is always vulnerable

Check 3 — HMAC secret strength

  • Is the secret hardcoded in source code? If so, is it a common word or short string?
  • Is the secret loaded from an environment variable or config? Even then, note if the default or example value is weak
  • A secret shorter than 32 characters or composed of dictionary words is likely brute-forceable

Check 4 — Embedded JWK / JKU / X5U header injection

  • Does the verification code read the jwk field from the token header and use it to verify the same token?
  • Does the code fetch a key from a URL specified in the jku or x5u header without validating the URL against an allowlist?
  • If either is true, the verification is fully bypassable

Check 5 — kid header injection

  • Is the kid header value extracted from the token before verification and used to look up a key?
  • Is the kid value interpolated into a SQL query without parameterization? → SQL injection
  • Is the kid value used to construct a file path without sanitization? → path traversal / key substitution

Check 6 — Claim validation

  • Is exp (expiry) checked? If not, expired tokens are valid forever
  • Is iss (issuer) checked? If not, tokens from other issuers are accepted
  • Is aud (audience) checked? If not, tokens for other services are accepted
  • Are security-sensitive claims like role or permissions present but not validated against a server-side source?

Check 7 — Token revocation

  • Is there a token blacklist, revocation endpoint, or short-lived token + refresh-token pattern?
  • If tokens are long-lived (hours or more) with no revocation mechanism, stolen tokens remain valid

Classification:

  • Vulnerable: The weakness is clearly present with no effective mitigation — the attack path is directly exploitable.
  • Likely Vulnerable: The weakness is probably present but requires confirming a secondary condition (e.g., library version behavior, default option value).
  • Not Vulnerable: The implementation correctly addresses this check.
  • Needs Manual Review: Cannot determine the vulnerability status with confidence from static analysis alone.

Output format — write to sast/jwt-results.md:

markdown
# JWT Analysis Results: [Project Name]

## Executive Summary
- Verification sites analyzed: [N]
- Vulnerable: [N]
- Likely Vulnerable: [N]
- Not Vulnerable: [N]
- Needs Manual Review: [N]

## Findings

### [VULNERABLE] Descriptive name
- **File**: `path/to/file.ext` (lines X-Y)
- **Endpoint / function**: [route or function name]
- **Vulnerability class**: [e.g., "Missing signature verification" / "alg:none accepted" / "Weak HMAC secret" / "JWK header injection" / "kid SQL injection" / "Missing exp validation"]
- **Issue**: [Clear description of what is wrong]
- **Attack scenario**: [Step-by-step: what the attacker does, what token they craft or modify, what access they gain]
- **Impact**: [What an attacker can achieve — forge arbitrary identity, escalate privileges, access other users' data, etc.]
- **Remediation**: [Specific fix — add algorithms restriction, enable verify_signature, load secret from env, pin JWKS URL, parameterize kid lookup, add exp validation, etc.]
- **Dynamic Test**:

[Proof-of-concept using jwt_tool, hashcat, or curl. Show the exact command to reproduce the issue. Examples:

  • jwt_tool -X a (test alg:none)
  • jwt_tool -X s (test RS256→HS256 confusion)
  • hashcat -a 0 -m 16500 wordlist.txt (brute-force HMAC secret)
  • Manual: modify payload, set alg:none, send to endpoint]

### [LIKELY VULNERABLE] Descriptive name
- **File**: `path/to/file.ext` (lines X-Y)
- **Endpoint / function**: [route or function name]
- **Vulnerability class**: [class]
- **Issue**: [What appears to be wrong]
- **Uncertainty**: [What needs to be confirmed — e.g., "Library version determines default behavior"]
- **Remediation**: [Fix]
- **Dynamic Test**:

[payload or command to attempt exploitation]


### [NOT VULNERABLE] Descriptive name
- **File**: `path/to/file.ext` (lines X-Y)
- **Endpoint / function**: [route or function name]
- **Reason**: [e.g., "Algorithm restricted to HS256 with strong env-loaded secret; exp validated"]

### [NEEDS MANUAL REVIEW] Descriptive name
- **File**: `path/to/file.ext` (lines X-Y)
- **Endpoint / function**: [route or function name]
- **Uncertainty**: [Why the vulnerability status cannot be determined statically]
- **Suggestion**: [What to inspect manually — e.g., "Confirm what JWT library version is installed; older versions of PyJWT accept alg:none by default"]

Important Reminders

  • Read sast/architecture.md and pass its content to both subagents as context.
  • Phase 2 must run AFTER Phase 1 completes — it depends on the recon output.
  • Phase 1 is purely discovery: locate every JWT issuance, verification, and configuration site. Do not attempt to assess security in Phase 1 — that is Phase 2's job.
  • Phase 2 is purely analysis: for each verification site found in Phase 1, systematically check every vulnerability class. Do not search for new sites in Phase 2 — focus on what Phase 1 found.
  • If no JWT usage is found in Phase 1, skip Phase 2 entirely and write a "No JWT usage detected" result file.
  • The most critical checks are: signature verification disabled, algorithm not restricted (alg:none / RS256→HS256 confusion), and weak or hardcoded HMAC secret. These lead directly to full authentication bypass.
  • jwt.decode() in Node.js's jsonwebtoken library is a decode-only function — it never verifies the signature. Only jwt.verify() validates the signature. Confusing the two is a common and critical mistake.
  • In Python's PyJWT, versions before 2.0 accepted alg: none by default and did not require an algorithms parameter. If the codebase does not pin the version or restrict algorithms, flag it.
  • Algorithm confusion (RS256→HS256) requires: (a) the server uses RS256 with a key pair, (b) the public key is accessible, and (c) the verification code does not restrict the algorithm. All three must be present.
  • kid injection is often overlooked: always check how the key lookup is implemented when kid is present in the token header.
  • When in doubt, classify as "Needs Manual Review" rather than "Not Vulnerable". False negatives are worse than false positives in security assessment.

Câu hỏi thường gặp

Kỹ năng AI Sast Jwt làm được gì?

Detect insecure JWT (JSON Web Token) implementations in a codebase using a two-phase approach: first map all JWT issuance and verification sites to understand the token lifecycle and signing configuration, then check each verification site for exploitable weaknesses such as algorithm confusion, missing signature verification, weak secrets, header injection, and missing claim validation. Requires sast/architecture.md (run sast-analysis first). Outputs findings to sast/jwt-results.md. If no JWT usage is found in Phase 1, Phase 2 is skipped. Use when asked to find JWT, token forgery, or authen...

Vì sao nên dùng Sast Jwt trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Sast Jwt là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Sast Jwt trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/utkusen/sast-skills/tree/main/sast-files/.agents/skills/sast-jwt. TypingMind đọc tệp SKILL.md rồi cài đặt kỹ năng để bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Sast Jwt?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Sast Jwt với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Sast Jwt với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Sast Jwt có miễn phí không?

Có. Kỹ năng này được utkusen phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇