┌──(root㉿kakeru)-[~/tmp] └─# nmap -A 192.168.240.249 Starting Nmap 7.95 ( https://nmap.org ) at 2025-01-3119:26 CST Nmap scan report for 192.168.240.249 Host is up (0.0018s latency). Not shown:998 closed tcp ports (reset) PORT STATE SERVICE VERSION 80/tcp open http nginx 1.14.2 |_http-title: Site doesn't have a title (text/html). |_http-server-header: nginx/1.14.2 2222/tcp open ssh OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0) | ssh-hostkey: | 204867:63:a0:c9:8b:7a:f3:42:ac:49:ab:a6:a7:3f:fc:ee (RSA) | 2568c:ce:87:47:f8:b8:1a:1a:78:e5:b7:ce:74:d7:f5:db (ECDSA) |_ 25692:94:66:0b:92:d3:cf:7e:ff:e8:bf:3c:7b:41:b7:5a (ED25519) MAC Address:76:50:9A:7A:10:0F (Unknown) Device type: general purpose|router Running: Linux 4.X|5.X, MikroTik RouterOS 7.X OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5 cpe:/o:mikrotik:routeros:7 cpe:/o:linux:linux_kernel:5.6.3 OS details: Linux 4.15-5.19, OpenWrt 21.02 (Linux 5.4), MikroTik RouterOS 7.2-7.5 (Linux 5.6.3) Network Distance:1 hop Service Info:OS: Linux; CPE: cpe:/o:linux:linux_kernel
TRACEROUTE HOP RTT ADDRESS 11.77 ms 192.168.240.249
OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done:1 IP address (1 host up) scanned in8.53 seconds
就开放了web和ssh 我们就去访问一下web有什么信息
web探测
web界面的内容:
1 2 3 4 5 6 7 8 9
┌──(root㉿kakeru)-[~/tmp] └─# curl 192.168.240.249 <h1>I love cats!</h1> <imgsrc="cat-original.jpg"alt="Cat original"width="400"height="400"> <br>
<h1>But I prefer this one because seems different</h1>
┌──(root㉿kakeru)-[~/tmp] └─# ssh markus@192.168.240.249 -p 2222 The authenticity of host '[192.168.240.249]:2222 ([192.168.240.249]:2222)' can't be established. ED25519 key fingerprint is SHA256:+Vy+50OqnmO0eOU2nhxE0uNjMjXrtpHTmrYtml4yF3s. This keyisnot known by any other names. Are you sure you want tocontinue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '[192.168.240.249]:2222' (ED25519) to the list of known hosts. markus@192.168.240.249's password: Linux twisted 4.19.0-9-amd64 #1 SMP Debian 4.19.118-2+deb10u1 (2020-06-07) x86_64
The programs included with the Debian GNU/Linux system are free software; the exact distribution terms foreach program are described in the individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. markus@twisted:~$
成功拿到shell
提权
这个用户没有sudo命令权限 也没有可以利用的suid 这个用户下有一个note.txt
1 2 3 4
markus@twisted:~$ cat note.txt Hi bonita, I have saved your id_rsa here: /var/cache/apt/id_rsa Nobody can find it.
bonita@twisted:~$ file beroot beroot: setuid, setgid ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=fecfbde059505a54f66d3229cc9ebb78f997a7ba, not stripped bonita@twisted:~$ ./beroot Enter the code:
下载到本地用ida查看 看到code密码是5880 然后就可以拿到root的shell
1 2 3 4 5 6 7 8 9 10 11 12
bonita@twisted:~$ ./beroot Enter the code: 5880 root@twisted:~# ls beroot user.txt root@twisted:~# cdd /root bash:cdd: command not found root@twisted:~# cd /root root@twisted:/root# ls root.txt root@twisted:/root# cat root.txt HMVwhereismycat