┌──(kali㉿offsec)-[~/Desktop] └─$ sudo nmap -p- --min-rate=5000 -oG allports 10.10.10.73 [sudo] kali 的密码: Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-05-28 10:24 CST Warning: 10.10.10.73 giving up on port because retransmission cap hit (10). Nmap scan report for10.10.10.73 Host is up (0.36s 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 26.71 seconds
┌──(kali㉿offsec)-[~/Desktop] └─$ sudo nmap -p22,80 -sC -sV --min-rate=500010.10.10.73 Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-05-28 10:26 CST Nmap scan report for10.10.10.73 Host is up (0.64s latency).
PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 7.2p2 Ubuntu 4ubuntu2.4 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 204836:c0:0a:26:43:f8:ce:a8:2c:0d:19:21:10:a6:a8:e7 (RSA) | 256 cb:20:fd:ff:a8:80:f2:a2:4b:2b:bb:e1:76:98:d0:fb (ECDSA) |_ 256 c4:79:2b:b6:a9:b7:17:4c:07:40:f3:e5:7c:1a:e9:dd (ED25519) 80/tcp open http Apache httpd 2.4.18 ((Ubuntu)) | http-robots.txt: 1 disallowed entry |_/*.txt |_http-server-header: Apache/2.4.18 (Ubuntu) |_http-title: Falafel Lovers 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 40.84 seconds
From: Falafel Network Admin(admin@falafel.htb) Subject: URGENT!! MALICIOUS SITE TAKE OVER! Date: November 25, 2017 3:30:58 PM PDT To: lawyers@falafel.htb, devs@falafel.htb Delivery-Date: Tue, 25 Nov 2017 15:31:01 -0700 Mime-Version: 1.0 X-Spam-Status: score=3.7 tests=DNS_FROM_RFC_POST, HTML_00_10, HTML_MESSAGE, HTML_SHORT_LENGTH version=3.1.7 X-Spam-Level: *** From:Falafel Network Admin(admin@falafel.htb)Subject:URGENT!!恶意网站接管!日期:November 25,20173:30:58 PM PDT收件人:lawyers@falafel.htb,devs@falafel.htb交付日期:Tue,25 Nov 201715:31:01-0700 Mime-Version:1.0 X-Spam-Status:score=3.7 tests=DNS_FROM_RFC_POST,HTML_00_10,HTML_MESSAGE,HTML_SHORT_LENGTH version=3.1.7 X-Spam-Level:* A user named "chris" has informed me that he could log into MY account without knowing the password, then take FULL CONTROL of the website using the image upload feature. We got a cyber protection on the login form, and a senior php developer worked on filtering the URL of the upload, so I have no idea how he did it. 一个名为“克里斯”的用户告诉我,他可以登录到我的帐户不知道密码,然后采取完全控制的网站使用图像上传功能。我们在登录表单上设置了网络保护,一位高级php开发人员负责过滤上传的URL,所以我不知道他是怎么做到的。 Dear lawyers, please handle him. I believe Cyberlaw is on our side. Dear develpors, fix this broken site ASAP. 亲爱的律师,请处理他。我相信网络法律站在我们这边亲爱的开发人员,尽快修复这个破碎的网站。 ~admin
┌──(kali㉿offsec)-[~/Desktop] └─$ ls -la 总计 36 drwxr-xr-x 6 kali kali 40965月29日 00:24 . drwx------ 28 kali kali 40965月29日 00:24 .. -rw-r--r-- 1 kali kali 6025月28日 10:471.txt -rw-r--r-- 1 kali kali 335月29日 00:19 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.php.png -rw-r--r-- 1 root root 3345月28日 10:25 allports drwxr-xr-x 2 kali kali 40965月28日 00:43 htb-vpn drwxr-xr-x 3 kali kali 40965月28日 10:36 reports drwxr-xr-x 4 kali kali 40963月29日 16:50 .svn drwxr-xr-x 17 kali kali 40965月27日 06:51 tools
┌──(kali㉿offsec)-[~/Desktop] └─$ ssh moshe@10.10.10.73 The authenticity of host '10.10.10.73 (10.10.10.73)' can't be established. ED25519 key fingerprint is SHA256:HkqcmyRF5DsZuFTcQxQ4QcKq7eG+mQMn8MX9G5RkN5s. This key is not known by any other names. Are you sure you want to continueconnecting(yes/no/[fingerprint])? yes Warning: Permanently added '10.10.10.73' (ED25519) to the list of known hosts. moshe@10.10.10.73's password: Welcome to Ubuntu 18.04.6 LTS(GNU/Linux 4.15.0-213-generic x86_64)
Expanded Security Maintenance for Infrastructure is not enabled.
159 updates can be applied immediately. 51 of these updates are standard security updates. To see these additional updates run: apt list --upgradable
Enable ESM Infra to receive additional future security updates. See https://ubuntu.com/esm or run: sudo pro status
Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings
Last login: Fri Nov 24 10:02:35 2023 from 10.10.14.19 $ id uid=1001(moshe) gid=1001(moshe) groups=1001(moshe),4(adm),8(mail),9(news),22(voice),25(floppy),29(audio),44(video),60(games) $
18、至此获取到第一个flag信息
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
$ pwd /home/moshe $ ls -la total 32 drwx------ 4 moshe moshe 4096 Nov 242023 . drwxr-xr-x 4 root root 4096 Nov 272017 .. lrwxrwxrwx 1 root root 9 Sep 132022 .bash_history -> /dev/null -rw-r--r-- 1 moshe moshe 220 Sep 12015 .bash_logout -rw-r--r-- 1 moshe moshe 3803 Nov 272017 .bashrc drwx------ 2 moshe moshe 4096 Nov 272017 .cache drwx------ 3 moshe moshe 4096 Nov 242023 .gnupg -rw-r--r-- 1 moshe moshe 655 May 162017 .profile -r-------- 1 moshe moshe 33 May 2805:17 user.txt $ cat user.txt 9ee4e09cde5fa96b789f422415095c77 $
0x02 系统权限获取
19、在枚举时,发现了用户所在一个特殊的权限组里
1 2 3 4 5 6
$ id uid=1001(moshe) gid=1001(moshe) groups=1001(moshe),4(adm),8(mail),9(news),22(voice),25(floppy),29(audio),44(video),60(games) $ find / -type f -group video 2>/dev/null | grep -v /sys | grep -v /proc $ find / -type d -group video 2>/dev/null | grep -v /sys | grep -v /proc $ find / -type f \( -name "*.sh" -o -name "*.py" -o -name "*.pl" -o -name "*.rb" -o -name "*.php" \) -group video 2>/dev/null | grep -v /sys | grep -v /proc $
Expanded Security Maintenance for Infrastructure is not enabled.
159 updates can be applied immediately. 51 of these updates are standard security updates. To see these additional updates run: apt list --upgradable
Enable ESM Infra to receive additional future security updates. See https://ubuntu.com/esm or run: sudo pro status
Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings
Last login: Tue May 2805:13:402024 yossi@falafel:~$ id uid=1000(yossi) gid=1000(yossi) groups=1000(yossi),4(adm),6(disk),24(cdrom),30(dip),46(plugdev),117(lpadmin),118(sambashare) yossi@falafel:~$