一直在寻找一款能够记录SSH密码的工具,subtty这款工具能够记录su,sudo,SSH,gpg, cryptmount等,非常强大,只要是一个交互的终端即可。
该工具作者是Julien Tinnes,感谢这位大神,这里也分享给大家。
在作者博客下载的只有编译好的二进制程序(回头找他要源码),这里简单说一下使用方法,这个程序不需要root权限,但是很快就有root了。
可以有四种方式调用程序来记录密码:
1.当你只有普通用户权限的时候,可以编辑~/.bashrc文件,添加如下代码:
if [ -z “$SUBTTY” ]; then exec ~/.subtty; fi
同时将该文件复制到~/.subtty,记录的密码都会记录在~/.subttlog
编辑完bashrc后要注意使配置立即生效,执行命令:
source ~/.bashrc
2.别名sudo
同样是编辑~/.bashrc文件:
alias su=”~/.subtty su
同样还是执行source ~/.bashrc
这里官网给的sudo,但是经测试su可以记录sudo和su的密码记录。
3.直接替换文件(要求权限且不建议这样做)
可以直接替换~/bin/sudo or /usr/local/bin/sudo之类的文件。
4.使用LD_PRELOAD
引用
By using LD_PRELOAD: subtty is also a shared library (it is a ET_DYN executable) that can be used to hook execv in order to run itself. This can be used to backdoor graphical programs such as gksu. In the current implementation it’ll need subtty to be available in ~/.subtty (I need to find a way to work around the missing implementation of dlinfo(RTLD_SELF, ..) in glibc).
这种方法大家可以自己测试。
Robot : 这是一个基于交互终端的中间人密码攻击技术,通用性很强。
转载请注明:jinglingshu的博客 » Subtty记录Linux密码的利器