Web Application Analysispadding-oraclecryptographydecryptionencryptionweb-vulnerability

PadBuster

PadBuster is a Perl script for automating Padding Oracle Attacks. It enables decryption of arbitrary ciphertext, encryption of arbitrary plaintext, and vulnerability detection through automated response analysis.

Description

PadBuster is designed to exploit Padding Oracle vulnerabilities in web applications. These vulnerabilities occur when a server provides information about padding validity in encrypted data responses, allowing attackers to decrypt data block by block. The tool automates this process, making it efficient for security testing.

Use cases include testing web applications that use block ciphers like AES or DES with improper padding validation. Testers provide an encrypted sample from the target, and PadBuster systematically modifies it to reveal plaintext. It supports various encoding formats and handles authentication, cookies, and custom ciphertexts.

The tool is particularly valuable for penetration testing teams assessing cryptographic implementations in web services. By automating the labor-intensive oracle attack process, it helps identify critical flaws that could lead to sensitive data exposure.

How It Works

PadBuster performs Padding Oracle Attacks by exploiting servers that leak padding validity information. It uses the provided EncryptedSample and systematically alters blocks according to PKCS#5/PKCS#7 padding rules. For each byte position, it tries all possible values while maintaining valid padding in subsequent bytes, observing server responses to deduce correct plaintext bytes. The process repeats across blocks, using techniques like byte-at-a-time decryption and intermediate ciphertext manipulation. Supports multiple encodings (Base64, Hex, UrlToken, WebSafe Base64) and integrates with HTTP requests including authentication and cookies.

Installation

bash
sudo apt install padbuster

Flags

-auth [username:password]HTTP Basic Authentication
-bruteforcePerform brute force against the first block
-ciphertext [Bytes]CipherText for Intermediate Bytes (Hex-Encoded)
-cookies [HTTP Cookies]Cookies (name1=value1; name2=value2)
-encoding [0-4]Encoding Format of Sample (Default 0). 0=Base64, 1=Lower HEX, 2=Upper HEX, 3=.NET UrlToken, 4=WebSafe Base64
-encodedtext [Encoded String]Data to Encrypt (Encoded)

Examples

Display help information and usage syntax
padbuster -h
Test basic padding oracle vulnerability with Base64 encoded token (default encoding 0) using 16-byte block size
padbuster http://target.com/page?token=ABC123DEF456 16
Test vulnerability with lower hex encoded token using encoding format 1
padbuster http://target.com/page?token=ABC123DEF456 16 -encoding 1
Test vulnerability with HTTP Basic Authentication
padbuster http://target.com/page?token=ABC123DEF456 16 -auth user:pass
Test vulnerability including custom HTTP cookies
padbuster http://target.com/page?token=ABC123DEF456 16 -cookies session=abc123
Perform brute force attack against the first block
padbuster http://target.com/page?token=ABC123DEF456 16 -bruteforce
Encrypt arbitrary data using .NET UrlToken encoding (format 3)
padbuster http://target.com/page?token=ABC123DEF456 16 -encoding 3 -encodedtext SGVsbG8=
Updated 2026-04-16kali.org ↗