KCTF{wpuser_wp@user123}The attacker's ultimate goal was to access our database. During the post-exploitation phase, they managed to extract database credentials from the compromised system. We are provided with a pcap3.pcapng file and need to find the exposed database username and password.
Flag Format: KCTF{username_password}
Initial Analysis:
We started by analyzing the pcap3.pcapng file. Since standard tools like tshark or tcpdump might not be necessary for text-based extraction, we used the strings command to look for readable text within the packet capture.
Searching for Sensitive Files:
Knowing that the attacker extracted database credentials, we looked for common configuration files. For a PHP/WordPress environment (which was hinted at by the presence of wp-admin in the strings output), the database configuration is typically stored in wp-config.php.
We ran the following command to search for the file content:
strings pcap3.pcapng | grep -A 100 "cat wp-config.php"
Extracting Credentials:
The output revealed that the attacker executed cat wp-config.php, and the file's content was sent back in cleartext (likely over an unencrypted HTTP connection or a simple shell).
We found the following lines in the exposed wp-config.php:
// ** Database settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpress_db' );
/** Database username */
define( 'DB_USER', 'wpuser' );
/** Database password */
define( 'DB_PASSWORD', 'wp@user123' );
Constructing the Flag:
From the extracted data:
wpuserwp@user123Combining these into the requested format KCTF{username_password}:
Flag: KCTF{wpuser_wp@user123}