Information Disclosure
Table of Contents
- Information disclosure in error messages
- Information disclosure on debug page
- Information disclosure via backup files
- Authentication bypass via information disclosure
- Information disclosure in version control history
Information disclosure in error messages
Quick Solution
Go the one of the products page and change the productId parameter value to some random string.
Solution
- With Burp running, open one of the product pages.
- In Burp, go to "Proxy" > "HTTP history" and notice that the
GETrequest for product pages contains aproductIDparameter. Send theGET /product?productId=1request to Burp Repeater. Note that yourproductIdmight be different depending on which product page you loaded. - In Burp Repeater, change the value of the
productIdparameter to a non-integer data type, such as a string. Send the request.GET /product?productId="example" - The unexpected data type causes an exception, and a full stack trace is displayed in the response. This reveals that the lab is using Apache Struts 2 2.3.31.
- Go back to the lab, click "Submit solution", and enter 2 2.3.31 to solve the lab.
Information disclosure on debug page
Reference: https://portswigger.net/web-security/information-disclosure/exploiting/lab-infoleak-on-debug-page
Quick Solution
Find a comment that points to /cgi-bing/phpinfo.php. Go to the page and find the SECRET_KEY environment variable value.
Solution
- With Burp running, browse to the home page.
- Go to the "Target" > "Site Map" tab. Right-click on the top-level entry for the lab and select "Engagement tools" > "Find comments". Notice that the home page contains an HTML comment that contains a link called "Debug". This points to
/cgi-bin/phpinfo.php. - In the site map, right-click on the entry for
/cgi-bin/phpinfo.phpand select "Send to Repeater". - In Burp Repeater, send the request to retrieve the file. Notice that it reveals various debugging information, including the
SECRET_KEYenvironment variable. - Go back to the lab, click "Submit solution", and enter the
SECRET_KEYto solve the lab.
Information disclosure via backup files
Reference: https://portswigger.net/web-security/information-disclosure/exploiting/lab-infoleak-via-backup-files
Quick Solution
Browse to /robots.txt and discover that a /backup folder exists. Browse to /backup and then to the ProductTemplate.java.bak file which contains the hard-coded password.
Solution
- Browse to
/robots.txtand notice that it reveals the existence of a/backupdirectory. Browse to/backupto find the fileProductTemplate.java.bak. Alternatively, right-click on the lab in the site map and go to "Engagement tools" > "Discover content". Then, launch a content discovery session to discover the/backupdirectory and its contents. - Browse to
/backup/ProductTemplate.java.bakto access the source code. - In the source code, notice that the connection builder contains the hard-coded password for a Postgres database.
- Go back to the lab, click "Submit solution", and enter the database password to solve the lab.
Authentication bypass via information disclosure
Quick Solution
Browse to /admin and discover that it is not available to low-privileges users. Use the TRACE method to discover that the X-Custom-IP-Authorization header is appended to the response with your IP address. Change the value of this header to 127.0.0.1 and now you can access the /admin page.
Solution
- In Burp Repeater, browse to
GET /admin. The response discloses that the admin panel is only accessible if logged in as an administrator, or if requested from a local IP. - Send the request again, but this time use the
TRACEmethod:TRACE /admin - Study the response. Notice that the
X-Custom-IP-Authorizationheader, containing your IP address, was automatically appended to your request. This is used to determine whether or not the request came from thelocalhostIP address. - Go to "Proxy" > "Options", scroll down to the "Match and Replace" section, and click "Add". Leave the match condition blank, but in the "Replace" field, enter
X-Custom-IP-Authorization: 127.0.0.1. Burp Proxy will now add this header to every request you send. - Browse to the home page. Notice that you now have access to the admin panel, where you can delete Carlos.
Information disclosure in version control history
Quick Solution
Browse to /.git, download the folder with wget. Study the commits and discover that there is a commit called Remove admin password from config. Look at the diff and retrieve the hardcoded password.
Solution
- Open the lab and browse to
/.gitto reveal the lab's Git version control data. - Download a copy of this entire directory. For non-Windows users, the easiest way to do this is using the command
wget -r https://your-lab-id.web-security-academy.net/.git. Windows users will need to find an alternative method, or install a UNIX-like environment, such as Cygwin, in order to use this command. - Explore the downloaded directory using your local Git installation. Notice that there is a commit with the message "
Remove admin password from config". - Look closer at the diff for the changed
admin.conffile. Notice that the commit replaced the hard-coded admin password with an environment variableADMIN_PASSWORDinstead. However, the hard-coded password is still clearly visible in the diff. - Go back to the lab and log in to the administrator account using the leaked password.
- To solve the lab, open the admin interface and delete Carlos's account.