【渗透】记录阿里云CentOS被渗透攻击

文章目录

发现

流量异常,出现大流量,网络贷带宽占满情况

排查

安装Nethogs

1.1 Nethogs介绍

NetHogs是一个开源的命令行工具(类似于Linux的top命令),用来按进程或程序实时统计网络带宽使用率。

NetHogs是一个小型的net top工具,不像大多数工具那样拖慢每个协议或者是每个子网的速度而是按照进程进行带宽分组。NetHogs不需要依赖载入某个特殊的内核模块。如果发生了网络阻塞你可以启动NetHogs立即看到哪个PID造成的这种状况。这样就很容易找出哪个程序跑飞了然后突然占用你的带宽。

1.2 Nethogs安装

安装依赖包

shell 复制代码
[root@rs-server ~]# yum install libpcap libpcap-devel -y
[root@rs-server ~]# yum -y install epel-release

安装nethogs

powershell 复制代码
[root@rs-server ~]# cat /etc/redhat-release 
CentOS Linux release 7.4.1708 (Core) 
[root@rs-server ~]# uname -r
3.10.0-693.el7.x86_64
[root@rs-server ~]# yum install nethogs -y
shell 复制代码
[root@rs-server ~]# nethogs -help
usage: nethogs [-V] [-h] [-b] [-d seconds] [-v mode] [-c count] [-t] [-p] [-s] [device [device [device ...]]]
-V : prints version.
-h : prints this help.
-b : bughunt mode - implies tracemode.
-d : delay for update refresh rate in seconds. default is 1.
-v : view mode (0 = KB/s, 1 = total KB, 2 = total B, 3 = total MB). default is 0.
-c : number of updates. default is 0 (unlimited).
-t : tracemode.
-p : sniff in promiscious mode (not recommended).
-s : sort output by sent column.
-a : monitor all devices, even loopback/stopped ones.
device : device(s) to monitor. default is all interfaces up and running excluding loopback
shell 复制代码
When nethogs is running, press:
q: quit
s: sort by SENT traffic
r: sort by RECEIVE traffic
m: switch between total (KB, B, MB) and KB/s mode
输入命令nethogs -help出现帮助信息,表明安装成功,非常的简单快速。

1.3 Nethogs命令介绍

以下是NetHogs的一些交互命令(键盘快捷键)

shell 复制代码
m : 修改单位

r : 按流量排序

s : 按发送流量排序

q : 退出命令提示符

参数介绍:

-V : 显示版本信息,注意是大写字母V.  

-v:切换显示单位,默认是默认是KB/s(0表示 KB/s,1表示KB,2表示B,3表示MB)

-c:检测次数(后面直接跟数字)

-a:检测所有的设备

-d : 延迟更新刷新速率,以秒为单位。默认值为 1.  

-t : 跟踪模式.  

-b : bug 狩猎模式 --- --- 意味着跟踪模式.  

-p : 混合模式(不推荐).  

device: 要监视的设备名称. 默认为 eth0  

1.4 Nethogs实践

shell 复制代码
[root@rs-server ~]# nethogs 
Ethernet link detected
               Ethernet link detected
Waiting for first packet to arrive (see sourceforge.net bug 1019381)
NetHogs version 0.8.5

PID   USER     PROGRAM           DEV     SENT    RECEIVED 
1023  root    sshd: root@pts/0   ens33   0.166    0.059 KB/sec
?     root    unknown TCP                0.000    0.000 KB/sec

TOTAL                                    0.166    0.059 KB/sec

直接使用nethogs命令的显示界面如上

shell 复制代码
[root@rs-server ~]# nethogs -d 2 -v 3 -c 5 -a
Ethernet link detected
Ethernet link detected
Ethernet link detected
Waiting for first packet to arrive (see sourceforge.net bug 1019381)
NetHogs version 0.8.5

PID    USER       PROGRAM           DEV      SENT     RECEIVED 
1023   root    sshd: root@pts/0     ens33   0.001     0.000 MB
?      root     unknown TCP                 0.000     0.000 MB

TOTAL                                       0.001     0.000 MB

查询情况

使用nethogs

这是重装后正常查询情况

受到攻击现象:出现持续流量向外,ip通过查询,流量流向为例如德国,美国等外网ip,并且每次使用nethogs查询流量信息都会出现流量打向不同外网ip ,并且该进程使用ps命令无法查询,且没有PID、User等信息,只有流量流向信息。

最终方案

重新格式化系统安装新系统,建立快照方便回滚

相关推荐
特长腿特长3 小时前
centos、ubantu系列机的用户和用户组的结构是什么?具体怎么配置?用户组权限怎么使用?这篇文章持续更新,帮助你复习linux的基础知识
linux·运维·centos
无级程序员3 小时前
centos7 安装 llvm-toolset-7-clang出错的问题解决
linux·centos
byoass7 小时前
csdn_upload_005
网络·安全·云计算
祖传F879 小时前
quickbi数据集数据查询时间字段显示正确,仪表板不显示
数据库·sql·阿里云
小夏子_riotous10 小时前
openstack的使用——9. 密钥管理服务Barbican
linux·运维·服务器·系统架构·centos·云计算·openstack
Aray123414 小时前
论秒杀场景及其技术解决方案
云计算
二宝哥14 小时前
Failed connect to mirrorlist.centos.org:80; Connection refused
linux·运维·centos
腾讯蓝鲸智云18 小时前
提升研发效能:DevOps平台高效权限配置与同步方案
运维·服务器·人工智能·云计算·devops
黑牛儿18 小时前
从旧版到 v0.20.5:Ollama 升级避坑全流程(附命令复制即用)
ai·云计算
刘~浪地球1 天前
架构设计--事件驱动架构设计与实现(05)
云原生·系统架构·云计算