II - Active Reconnaissance

Directory Enumeration

After the passive reconnaiscance I usually do some directory and file bruteforcing. My goto tool for this now is ffufarrow-up-right. FFuf (Fuzz Faster U Fool) is a fast web fuzzer written in Go.

ffuf -w raft-large-directories.txt \
-o ffuf-directories-app.json \
-u https://app.bountypay.h1ctf.com/FUZZ/ \
-t 10 \
-replay-proxy http://127.0.0.1:8080

ffuf output:

________________________________________________

 :: Method           : GET
 :: URL              : https://app.bountypay.h1ctf.com/FUZZ/
 :: Output file      : ffuf-directories-app.json
 :: File format      : json
 :: Follow redirects : false
 :: Calibration      : false
 :: ReplayProxy      : http://127.0.0.1:8080
 :: Timeout          : 10
 :: Threads          : 10
 :: Matcher          : Response status: 200,204,301,302,307,401,403
________________________________________________

images                  [Status: 403, Size: 178, Words: 5, Lines: 8]
js                      [Status: 403, Size: 178, Words: 5, Lines: 8]
css                     [Status: 403, Size: 178, Words: 5, Lines: 8]
logout                  [Status: 302, Size: 0, Words: 1, Lines: 1]
cgit                    [Status: 403, Size: 170, Words: 5, Lines: 7]
:: Progress: [62275/62275] :: Job [1/1] :: 80 req/sec :: Duration: [0:12:54] :: Errors: 3 ::

There is one entry that looks interesting cgit, which might indicate that we are in the presence of a misconfigured NGINX web server with a .git folder that is publicly available. Let's see if we can access the config file. This request was made inside Burp but I'll use HTTPiearrow-up-right output for the writeup since it will make the report easier to read:

Bingo ! The config file gives us the URL of the repositoryarrow-up-right.

Souce code analysis

https://github.com/bounty-pay-code/

The GitHub accountarrow-up-right has only one repository with one filearrow-up-right and one commitarrow-up-right. We can see that the PHP file is logging request data into a file named bp_web_trace.log.

Let's see if the file is available on the server.

We can easily decode the base64 encoded data, I'm either using Hackvertorarrow-up-right inside of Burp or CyberChefarrow-up-right for this kind of thing:

The most interesting one is the third where we can see a username, password and 2FA challenge answer. If we try to login using the credentials found in the log file we get asked for a 10 characters password sent to the user's phone:

BountyPay - Login 2FA

The code found in the log file is invalid and bruteforcing the code is usually not the way to go in CTFs.

Bypassing 2FA

Let's analyze the request being sent when submitting the challlenge answer:

We can see that there is an extra parameter named challenge . The value appears to be an MD5 hash. The hash is different after each login request. After a bit of trial and error we can guess that the challenge should be an MD5 hash of the challenge_answer. When this is the case we can successfully login ! 🥳

BountyPay | Dashboard
circle-info

We can note that the challenge parameter has been omitted in the log file, probably to make this step a little bit harder.

Last updated