Escalate Linux
Scanning
Nmap
➜ ~ sudo nmap -A -p- -T4 Esclinux.vuln
Starting Nmap 7.91 ( https://nmap.org ) at 2021-08-12 10:27 EDT
Nmap scan report for Esclinux.vuln (172.16.129.139)
Host is up (0.0011s latency).
Not shown: 65526 closed ports
PORT STATE SERVICE VERSION
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
111/tcp open rpcbind 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 2049/udp nfs
| 100003 3 2049/udp6 nfs
| 100003 3,4 2049/tcp nfs
| 100003 3,4 2049/tcp6 nfs
| 100005 1,2,3 34511/udp mountd
| 100005 1,2,3 50751/tcp mountd
| 100005 1,2,3 55807/tcp6 mountd
| 100005 1,2,3 57755/udp6 mountd
| 100021 1,3,4 38135/tcp nlockmgr
| 100021 1,3,4 38777/tcp6 nlockmgr
| 100021 1,3,4 54049/udp nlockmgr
| 100021 1,3,4 60507/udp6 nlockmgr
| 100227 3 2049/tcp nfs_acl
| 100227 3 2049/tcp6 nfs_acl
| 100227 3 2049/udp nfs_acl
|_ 100227 3 2049/udp6 nfs_acl
139/tcp open netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP)
445/tcp open netbios-ssn Samba smbd 4.7.6-Ubuntu (workgroup: WORKGROUP)
2049/tcp open nfs_acl 3 (RPC #100227)
38135/tcp open nlockmgr 1-4 (RPC #100021)
41879/tcp open mountd 1-3 (RPC #100005)
50079/tcp open mountd 1-3 (RPC #100005)
50751/tcp open mountd 1-3 (RPC #100005)
MAC Address: 00:0C:29:9F:EB:8D (VMware)
Device type: general purpose
Running: Linux 3.X|4.X
OS CPE: cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4
OS details: Linux 3.2 - 4.9
Network Distance: 1 hop
Service Info: Host: LINUX
​
Host script results:
|_clock-skew: mean: 1h19m59s, deviation: 2h18m33s, median: 0s
|_nbstat: NetBIOS name: LINUX, NetBIOS user: <unknown>, NetBIOS MAC: <unknown> (unknown)
| smb-os-discovery:
| OS: Windows 6.1 (Samba 4.7.6-Ubuntu)
| Computer name: osboxes
| NetBIOS computer name: LINUX\x00
| Domain name: \x00
| FQDN: osboxes
|_ System time: 2021-08-12T10:27:39-04:00
| smb-security-mode:
| account_used: guest
| authentication_level: user
| challenge_response: supported
|_ message_signing: disabled (dangerous, but default)
| smb2-security-mode:
| 2.02:
|_ Message signing enabled but not required
| smb2-time:
| date: 2021-08-12T14:27:39
|_ start_date: N/A
​
TRACEROUTE
HOP RTT ADDRESS
1 1.07 ms Esclinux.vuln (172.16.129.139)
​
OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 15.98 secondsEnumeration
port 80 is opened let's take a look web server default page ...
Wappalyzer

Check directory
/shell.php directory

let pass this var with ifconfig command

it works ... this vulnerability called command injection
Exploiting
sending reverse shell
set listening port
GET request
We get SHELL
spawn shell
Privilege Escalation
you can run Linux Privilege Escalation Awesome Script - LinPEAS for fast enumeration
here we go for manual way ...
#01 SUID rights Exploit
execute this command find / -perm -u=s -type f 2>/dev/null searching for "sticky bits"

run the shell

#02 Cracking the root password "PATH Variable"
as we notice that running /home/user5/script
trigger ls command
let's abuse this remember this exploit run because sticky bit -run as root-

copy root shadow to attacker machine in text file called shadow
using john the ripper to crack password
password is 12345

#03 Root shell by exploiting SUDO rights of user1
if all password hard to crack we can change
Credentials : user1:12345

sudo -l to list privilege of user
wait !! user1 can sudo all things with no password

#04 Reverse Root shell by exploiting crontab
cat /etc/crontab to see scheduled tasks

remember we have root access 3 ways above
lets create reverse shell
#05 Exploiting SUDO rights of vi editor
We changed the password of all the users to 12345 using the same methodology as above and switched between users to check for more exploits. We found that user8 has a sudo permission for vi editors.

run sudo vi
enter this in vi


Last updated