CPTS labs - 21 Command injections
Command Injections
Exploitation
Try adding any of the injection operators after the ip in IP field. What did the error message say (in English)?
Inject directly on the website and there is some frontend side sanitization.
Results: Please match the requested format.
Review the HTML source code of the page to find where the front-end input validation is happening. On which line number is it?
Results: 17
Try using the remaining three injection operators (new-line, &, |), and see how each works and how the output differs. Which of them only shows the output of the injected command?
Results: |
Filter Evasion
Try all other injection operators to see if any of them is not blacklisted. Which of (new-line, &, |) is not blacklisted by the web application?
Results: new-line
Use what you learned in this section to execute the command 'ls -la'. What is the size of the 'index.php' file?
Results: 1613
Use what you learned in this section to find name of the user in the '/home' folder. What user did you find?
Use what you learned in this section find the content of flag.txt in the home folder of the user you previously found.
Results: HTB{b451c_f1l73r5_w0n7_570p_m3}
Find the output of the following command using one of the techniques you learned in this section: find /usr/share/ | grep root | grep mysql | tail -n 1
Results: /usr/share/mysql/debian_create_root_user.sql
Skills Assessment
You are contracted to perform a penetration test for a company, and through your pentest, you stumble upon an interesting file manager web application. As file managers tend to execute system commands, you are interested in testing for command injection vulnerabilities.
Use the various techniques presented in this module to detect a command injection vulnerability and then exploit it, evading any filters in place.
Authenticate to with user "guest" and password "guest". What is the content of '/flag.txt'?
Move feature:
Results: HTB{c0mm4nd3r_1nj3c70r}
Last update: 2025-01-26 Created: January 26, 2025 19:15:53