Skip to content
Tori-TechPublic

About

Source code and setup instructions for an SSH CTF

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

In order to replicate the CTF environment, you must have XAMPP and SSH installed. You will also need a password configured for your root user. However, even if those conditions have been met, you will still need to do some configuration. The steps you should take (assuming you are running Linux) are outlined below:

  1. Create a new user. This user will run the web server that hosts the webapp with RCE vulnerabilities. Let's call this user developer.

  2. Give developer ownership of the /opt/lampp/htdocs folder with this command:

sudo chown -R developer:developer /opt/lampp/htdocs

  1. Configure LAMPP to run as the developer user by opening /opt/lampp/etc/httpd.conf and modifying the User directive:

User developer

Group developer

  1. Verify the command was successful:

ls -ld /opt/lampp/htdocs

You should see developer instead of root.

  1. Download the webapp source code (it is just one file: index.php) and place it directly inside the /opt/lampp/htdocs folder.

  2. Run LAMPP with this command:

sudo /opt/lampp/lampp start

  1. Navigate to 127.0.0.1 to verify the server is working and you can view the webpage.

  2. Assuming you already have a password set for your root user, download the TODO.txt file from the repository and replace the placeholder with your actual root password. (This is how the user will instigate privilege escalation)

  3. Also download the user.txt file with the flag inside it. Both this and the TODO.txt files should be located in /home/developer/.

  4. Log into your root account and place the root.txt file in /root directory.

  5. Run these commands to ensure root.txt is only readable by the root user.

sudo chown root:root /root/root.txt

sudo chmod 600 /root/root.txt

  1. Verify the command succeeded with: ls -l /root/root.txt

The output should look something like:

-rw------- 1 root root 32 Month Day Timestamp root.txt

  1. The environment setup is now complete; you may begin the CTF by starting LAMPP with: sudo /opt/lampp/lampp start.

Note: If you find yourself stuck or are simply curious to see the solution, you can view the write-up on my blog here.

About

Source code and setup instructions for an SSH CTF

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages