Skip to content

Instantly share code, notes, and snippets.

@userlandkernel
Created September 13, 2021 10:35
Show Gist options
  • Save userlandkernel/5a83ed2b410ef5e0a5a00d9b17e02da1 to your computer and use it in GitHub Desktop.
Save userlandkernel/5a83ed2b410ef5e0a5a00d9b17e02da1 to your computer and use it in GitHub Desktop.
AHDJAKDHKJAHDA

AHDJAKDHKJAHDA

A walkthrough

The first flag

  1. Lookup the network for your virtual machine's NAT adapter with the ifconfig command.
  2. Perform a host scan with the most common ports on the network (ex: nmap -v -sN 10.0.0.1/24 -F).
  3. Note a webserver running on port 80, ssh on port 22, mysql on port 3306 and an unknown service on port 25565.
  4. Make a request to the webservice and notice it is an instance of phpBB, a discussion forum application.
  5. Notice the board's name is minecraft.
  6. Check the version numbers and search the web for it, no vulnerabilities exist by default in this version.
  7. Read the messages on the forum, enumerate (find out) that there is a user called webadmin who has administrative privileges.
  8. Discover the bad access control vulnerability by weak password policy and find out the password of webadmin is webadmin.
  9. Use your administrative privileges to identify (enumerate) other users on the platform.
  10. Check the mysql server on port 3306, try to enumerate the users or to login with a default password (this fails), check the version for vulnerabilities (no public exploits found).
  11. Check the unknown service on port 25565 by searching the web for the service associated with the port: minecraft.
  12. Connect to the minecraft service using a cracked client, notice the message: You are not whitelisted on this server.
  13. Look up about minecraft and whitelists, notice that cracked servers have the vulnerability that anyone can set a username and login (bad access control).
  14. Identify a player from the previously enumerated users on the forum, set the username in the client and log in to the service.
  15. Check your privileges by issuing the /op command: Notice you are an operator.
  16. Check out the server version information with /version: notice it is the latest version of paper, a custom minecraft server.
  17. Identify the plugins on the server with /plugins: look up their usage in the commandline.
  18. Look at the functionality of the plugins, try to figure out which of them could potentionally hold a vulnerability and notice it is the ImageMaps plugin as it deals with files and downloads.
  19. Find out that the checks on the content type are too weak to block other file types as only the extension is checked, but not the magic of the file.
  20. Discover a path traversal vulnerability in the name of the image in the imagemaps download command.
  21. Learn about the directory structure of this plugin (from bukkit documentation) and exploit the server by downloading a malicious plugin with the path traversal into the plugins directory.
  22. With the connect-back shell or other backdoor you uploaded, read the flag from flag.txt in the Minecraft directory.

The second flag

  1. From the backdoor, enumerate users and privileges.
  2. Discover a backup.sh file and a minutely cron-job that backups the minecraft data.
  3. Notice that this backup.sh has group write permissions and that the group is minecraft but that the executor is almighty.
  4. Modify the backup.sh script to gain code execution as almighty.
  5. Read the flag from almighty's home directory.

The first CWE-ID

As the vulnerability is a path traversal vulnerability, the following CWE-ID is associated with it: CWE-22.
See https://cwe.mitre.org/data/definitions/22.html.

The second CWE-ID

Because the permissions on the script file are incorrectly set, the following CWE-ID is associated with this vulnerability.
CWE-732.
See https://cwe.mitre.org/data/definitions/732.html

To sum up

  • Unknown environments with the latest versions of software do not always mean that the environment is secure.
  • Enumeration and research are an important part of penetration testing and make the difference between a human audit and a software scan.
  • Privileges on Linux are easily misconfigured, generic scans can help identify misconfigurations.
  • CWE-ID's are helpful to standardize vulnerabilities and to aid in giving advice to corporations you audit for.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment