Sinameki Sarp
Sinameki Sarp Half time student,full time CTF Player.

TryHackMe: Internal CTF Writeup

TryHackMe: Internal CTF Writeup

TryHackMe linux penetration testing challenge machine Internal boot2root walkthrough.

Discovery Part

Start with port scan with Nmap tool.

1
sudo nmap -sC -sV -p- -vv 10.10.116.99

Untitled

Server has “ssh” and “web” service. Go to web page.

Untitled

There is a default Apache2 page. Find directories with gobuster tool.

1
gobuster dir -u http://10.10.116.99/ --wordlist=/usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt  -x php,html,txt

Untitled

Go to wordpress directory.

Untitled

Modify “/etc/hosts” file to reflect internal.thm

1
nano /etc/hosts

Untitled

Untitled

It look like web page maden with Wordpress. Use “wpscan” tool for enumurate informations.

1
wpscan --url http://internal.thm/wordpress/ -e ap,u

Untitled

After scan proccess I try to find exploit “WP v5.4.2” but couldn’t find. Then I search any sensitive information in web page but nothing in there.

Untitled

There is one user (”admin”) try to find password with bruteforce.

1
wpscan --url http://internal.thm/wordpress/ -U admin -P /usr/share/wordlists/rockyou.txt  --password-attack wp-login

Untitled

Login wp-login with admin user and password.

Untitled

Untitled

Enumeration Part

Go to Apperance>Theme Editor

Untitled

Change one of the “Theme files” to reverse shell code.

Untitled

Listen your port with netcat tool and…

Untitled

Change shell to tty shell. First check which version of python in the system then run python code.

1
python -c 'import pty;pty.spawn("/bin/bash")'

Untitled

Find which users in the system. Go to /home directory and list files and directories in the directory.

Untitled

There is one user aubreanna however we don’t have a permission to access directory. Go to /opt directory.

Untitled

Read wp-save.txt file.

Untitled

Login aubreanna user with the credentials.

Untitled

Privilege Escalation Part

Read jenkins.txt file.

Untitled

We need to “SSH Port Forward” to access 172.17.0.2:8080

1
ssh -L 4545:172.17.0.2:8080 aubreanna@internal.thm

Untitled

Go to “http://localhost:4545/”.

Untitled

I try to find credentials but there is no credential info in the server.

Find credentials with bruteforce.

1
hydra -l admin -P /usr/share/wordlists/rockyou.txt localhost -s 4545 http-post-form "/j_acegi_security_check:j_username=admin&j_password=^PASS^&from=%2F&Submit=Sign+in:loginError"

Untitled

Login admin user.

Untitled

Select Manage Jenkins > Script Console.

Untitled

In this section you can execute Groovy script. Execute Groovy reverse shell code and list port with netcat.

Untitled

Untitled

Go to /opt directory and read note.txt file.

Untitled

Login root wtih the credentials.

Untitled

THANK YOU FOR READING 🙂

comments powered by Disqus