本文へスキップ
Skillpedia
セキュリティ6.5k · #14056

crypto

できること

このスキルは、Webアプリのクッキーやトークンなどの弱い暗号化と署名を見つける作業をエージェントに案内します。認可された対象や練習用のチャレンジで作業するセキュリティテスター向けです。

使う場面

  • ✓アプリのログインのクッキーやトークンが暗号化されているように見え、改ざんできるかをテストしたいとき。
  • ✓チャレンジやセキュリティレビューで、ブロック暗号やHMACの問題が挙げられているとき。
  • ✓暗号の弱点を使う前に、それを確定させる構造的な方法が必要なとき。

スキルのリンク

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/crypto/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/crypto/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“当社のアプリの暗号化されたクッキーが、外部の人に改変または復号されないかを確認してもらえますか。”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントは、サーバーが改変されたデータを受け入れるか拒否するかを示す明確な信号を探し、その信号を使って、固定されたリクエストの上限内で弱点をテストします。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Web Crypto Exploitation

Exploits applications that misuse symmetric ciphers (CBC/ECB), MACs (HMAC, hash-length extension), or token signers (JWT). The decisive trick is almost always: find the oracle, prove the oracle is real, then iterate within a hard request budget. Without the proven oracle the attack burns the cycle.

Step 0 — Key Discovery (Do Before ANY Network Attack)

Check if the application key is hardcoded in source. CTF challenge apps frequently embed keys in source code. If you have filesystem access to the app, run this before any network probe:

# Find app source in the workspace
find /workspace -name "*.py" -o -name "*.js" -o -name "*.rb" -o -name "*.php" 2>/dev/null | head -20

# Grep for hardcoded keys
grep -rn 'AES_KEY\|SECRET_KEY\|key\s*=\s*[b'"'"'"'"'"'"'"'"']\|password\s*=' /workspace/*/app/ 2>/dev/null | head -20

# Also check environment files
cat /workspace/*/.env 2>/dev/null; cat /workspace/*/app/.env 2>/dev/null

If the key is found, decrypt offline immediately — no oracle, no network requests:

import base64
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.primitives import padding as crypto_padding

KEY = b'C' * 32  # replace with discovered key
cookie = "<base64-cookie-from-browser>"

raw = base64.b64decode(cookie)
iv, ct = raw[:16], raw[16:]
cipher = Cipher(algorithms.AES(KEY), modes.CBC(iv))
pt = cipher.decryptor().update(ct) + cipher.decryptor().finalize()
# Remove PKCS7 padding
unpadder = crypto_padding.PKCS7(128).unpadder()
plaintext = unpadder.update(pt) + unpadder.finalize()
print("plaintext:", plaintext)

Only proceed to the oracle-based attack below if no key is found in source.

Recognition Signals

Trigger this skill when ANY of the following are present:

  • Base64 cookie / token whose decoded length is a multiple of 16 (AES-CBC) or 8 (DES/3DES). Length boundaries are the giveaway: len(b64decode(token)) % 16 == 0 and not 32 or 48 → likely 1-2 blocks of CBC; % 16 == 0 with 32-64 bytes → IV+ciphertext pattern.
  • Distinct error responses for "invalid padding" vs "invalid auth/decryption". Status code, body, length, or even response time differences across the two failure modes ARE the oracle. If the two modes look identical, no oracle.
  • JWT in Authorization: Bearer <three-base64-segments-separated-by-dots>. Always inspect alg header (alg=none, alg=HS256 with public-key confusion, alg=RS256→HS256 substitution).
  • Repeated 16-byte ciphertext blocks within a single token — direct ECB tell. Decode base64, slice into 16-byte blocks, look for duplicates.
  • Server returns separate encrypted blob + tag/HMAC concatenated — candidate for HMAC bypass / hash-length extension if the MAC scheme is weak (e.g. MD5(secret || message)).
  • Challenge tag includes crypto, cipher, oracle, captcha, encrypted_captcha, padding, hmac_bypass, jwt, length_extension.

Confirm-Oracle Gate

STOP — before iterating any payload, prove the oracle is real. The single most common mis-allocation here is hammering thousands of padding-oracle requests against a server whose two error modes are actually identical. The gate is one in-file probe that issues exactly two requests and prints both responses side-by-side.

Layout detection (run before the gate): Decode the token and determine the IV/CT layout. AES-CBC tokens always use IV(16) || CT(16 * N) — the first 16 bytes are always the IV. Confirm:

import base64
raw = base64.b64decode("<TOKEN>")
print(f"total bytes: {len(raw)}, blocks: {len(raw)//16}")
# len==32 → IV(16) + 1 ciphertext block (16 bytes of plaintext)
# len==48 → IV(16) + 2 ciphertext blocks (32 bytes of plaintext)
# len==64 → IV(16) + 3 ciphertext blocks (48 bytes of plaintext)
# The IV is ALWAYS raw[:16]. Ciphertext is raw[16:].

Also identify the correct cookie/parameter name. Check the response headers from a GET request to confirm the cookie name:

curl -sv "$TARGET/" 2>&1 | grep -i 'set-cookie'

Use that exact cookie name (e.g. captcha, session, token) in every subsequent request.

timeout 60 python3 -u -c '
import base64, requests, sys
URL = "https://<TARGET>/decrypt"
TOKEN = "<base64-cookie-or-token-from-recon>"
ct = bytearray(base64.b64decode(TOKEN))
# Probe A: flip the LAST byte of the SECOND-TO-LAST block (corrupts plaintext padding of last block)
flipped = bytearray(ct)
flipped[-1
よくある質問

スキルはアプリの秘密鍵を必要としますか?

いいえ。ただし、まず鍵がソースコードに露出していないかを確認し、露出していればリクエストを送らずにオフラインで復号できるとスキルは述べています。

なぜリクエストの上限を設定するのですか?

テストが長く続いたり、対象を溢れさせたりしないようにするためです。

どの種類の暗号を扱いますか?

CBCやECBのブロック暗号、HMACのチェック、JWTの署名などのよくあるケースを扱います。

詳細

作者による元の説明

Web crypto exploitation — padding-oracle (Vaudenay), AES-CBC bit-flipping / IV manipulation, AES-ECB pattern attacks (cut-and-paste, prefix/suffix recovery), HMAC bypass, hash-length extension, JWT alg confusion. Covers detection signals, working in-file Python harnesses (concurrent.futures, timeout=5, python3 -u, bounded request budget), and the confirm-oracle gate that must fire before iteration.

repo: BitterSecurity/Decepticon

人気

GitHubのスター
6.5k
ランキング
#14056
ライセンス
Apache-2.0
更新日
2026/11/1

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル