Clicker

Recon

chevron-rightnmap_scan.loghashtag
Open 10.129.98.184:22
Open 10.129.98.184:80
Open 10.129.98.184:111
Open 10.129.98.184:2049
Open 10.129.98.184:35999
Open 10.129.98.184:43277
Open 10.129.98.184:46649
Open 10.129.98.184:57199
[~] Starting Script(s)
[>] Running script "nmap -vvv -p {{port}} {{ip}} -vvv -sV -sC -Pn" on ip 10.129.98.184

PORT      STATE SERVICE  REASON  VERSION
22/tcp    open  ssh      syn-ack OpenSSH 8.9p1 Ubuntu 3ubuntu0.4 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   256 89:d7:39:34:58:a0:ea:a1:db:c1:3d:14:ec:5d:5a:92 (ECDSA)
| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBO8nDXVOrF/vxCNHYMVULY8wShEwVH5Hy3Bs9s9o/WCwsV52AV5K8pMvcQ9E7JzxrXkUOgIV4I+8hI0iNLGXTVY=
|   256 b4:da:8d:af:65:9c:bb:f0:71:d5:13:50:ed:d8:11:30 (ED25519)
|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAjDCjag/Rh72Z4zXCLADSXbGjSPTH8LtkbgATATvbzv
80/tcp    open  http     syn-ack Apache httpd 2.4.52 ((Ubuntu))
|_http-title: Did not follow redirect to http://clicker.htb/
| http-methods: 
|_  Supported Methods: GET HEAD POST OPTIONS
|_http-server-header: Apache/2.4.52 (Ubuntu)
111/tcp   open  rpcbind  syn-ack 2-4 (RPC #100000)
| rpcinfo: 
|   program version    port/proto  service
|   100000  2,3,4        111/tcp   rpcbind
|   100000  2,3,4        111/udp   rpcbind
|   100000  3,4          111/tcp6  rpcbind
|   100000  3,4          111/udp6  rpcbind
|   100003  3,4         2049/tcp   nfs
|   100003  3,4         2049/tcp6  nfs
|   100005  1,2,3      33253/tcp6  mountd
|   100005  1,2,3      46179/udp   mountd
|   100005  1,2,3      57199/tcp   mountd
|   100005  1,2,3      59152/udp6  mountd
|   100021  1,3,4      44929/tcp6  nlockmgr
|   100021  1,3,4      45075/udp   nlockmgr
|   100021  1,3,4      46649/tcp   nlockmgr
|   100021  1,3,4      47592/udp6  nlockmgr
|   100024  1          35999/tcp   status
|   100024  1          38005/udp   status
|   100024  1          44633/tcp6  status
|   100024  1          58652/udp6  status
|   100227  3           2049/tcp   nfs_acl
|_  100227  3           2049/tcp6  nfs_acl
2049/tcp  open  nfs      syn-ack 3-4 (RPC #100003)
35999/tcp open  status   syn-ack 1 (RPC #100024)
43277/tcp open  mountd   syn-ack 1-3 (RPC #100005)
46649/tcp open  nlockmgr syn-ack 1-4 (RPC #100021)
57199/tcp open  mountd   syn-ack 1-3 (RPC #100005)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

HTTP (80) (Enum)

Writeup.png

We are able to register, then login, then play some clicker and lastly save our progress. Level up function doesn't trigger any kind of request, so it can be modified anytime I think.

Writeup-1.png

NFS

https://book.hacktricks.xyz/network-services-pentesting/nfs-service-pentestingarrow-up-right

The backup contains website source code and there seems to be SQLi in the get_top_players, because all other queries use prepared statements.

Writeup-2.png

I had sqlmap in the background and SQLi might be possible in other places with level as it seems.

Writeup-3.png

HTTP (80)

Source Analysis

First we need to become admin to access the other endpoints. Registration doesn't allow special characters in username, it shouldn't exist otherwise we are good to go.

Diagnostics is access with token, we have it in hashed format but md5hashing or crackstation was not successful.

In db_utils save_profle functions looks funky.

It's used in save_game

SQLi

The code is never checking if role could be inside value, hence we can inject role from there and get proper SQL query.

Writeup-4.png

Actually we need to be inside key, because value get's quoted and can't be used.

Writeup-5.png

The odd thing is permission assignment in authenticate.php is that it only gives permissions whenever you login, so right now live query update will not be seen and we are still User. Log out and in to refresh permissions.

Administrator

Writeup-6.png

export.php doesn't check for invalid formats, so we can request to save PHP. If not txt or json, then it's HTML which is what PHP needs. We can see it displaying nickname, clicks, level. We registered with username, but nickname is something new and there's also no restriction on it.

It works

Writeup-7.png

Get reverse shell

Reverse Shell (www-data)

Enumerate the database with credentials from source code.

No hits with hashes.

Writeup-8.png

Since Im on pwncat-csarrow-up-right I can use enumerate command, SUID programs caught my eye.

Note: To enumerate for SUID programs just find / -perm -4000 2>/dev/null

I wasn't make sense of it, but it's probably running mysql with some external scripts. Ghidra will know more, or just dogboltarrow-up-right because binary is really small.

The binary also has a README

But there's a 5th option, which is to use other *.sql files as long as we don't provide first argument in range of 0-4 and then second argument file we want to read.

For some reason /etc/hostname isn't readable

There's max length limit somewhere, but basically

SSH (22)

User.txt

Privilege Escalation

diagnostic.php returns:

xml_pp - xml pretty-printer

Path 1

Sudo resets env for every binary env_reset, but for this shell script we have SETENV meaning we keep the env variables when running it. One of the linux exploits is LD_PRELOAD which is used to load functions, creating malicious library is easy.

https://book.hacktricks.xyz/linux-hardening/privilege-escalation#ld_preload-and-ld_library_patharrow-up-right

Path 2

Shellscript uses curl to download the data from webserver, curl has special env variable called HTTP_PROXY which just adds proxy to command. We can become proxy, edit response and essentially acting as MiTM.

For burp to catch requests make sure to include tun0 in interfaces.

Path 3

Exim - 'perl_startup' Local Privilege Escalation (Metasploit)arrow-up-right

Root.txt

Last updated