【渗透】记录阿里云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等信息,只有流量流向信息。

最终方案

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

相关推荐
@HNUSTer35 分钟前
基于 GEE 的 LST 降尺度建模——利用 Sentinel-2 和 SRTM 提升 Landsat 热红外分辨率至 10 米
云计算·数据集·遥感大数据·gee·云平台·随机森林回归模型·多源遥感与随机森林回归
wzq11_6661 小时前
云计算运维学习day22——Ansible-Roles
运维·学习·云计算
翼龙云_cloud12 小时前
亚马逊云渠道代理商:VPC 教程 利用 EC2 自建 NAT 实例降低私有子网出网成本
网络·云计算·aws
yunlaodacom13 小时前
腾讯云国际版(云老大):TKE Service有Endpoint,为什么请求还是进不了Pod
云计算·腾讯云
Dawn-bit13 小时前
Linux网络进阶:TCP三次握手和四次挥手与TCP连接状态
linux·服务器·网络·tcp/ip·云计算·智能路由器
风流 少年19 小时前
Spring AI 2.0:阿里云百炼平台(智能体应用)
redis·spring·阿里云
UseLessQQ20 小时前
云计算k8s集群部署
java·kubernetes·云计算
翼龙云_cloud1 天前
阿里云国际版代理商:OSS自定义域名绑定与HTTPS配置排障教程
数据库·阿里云·https·云计算
sbjdhjd1 天前
CTF 技术复盘:从参数类型绕过到正则回溯 | Merry Christmas PHP CTF(gift.php & gift_plus.php)
安全·网络安全·云计算·php·ctf·红队·网络攻防
皮皮虾❀1 天前
阿里云代理商采购+超额返点一体化实战:从“单次采购无优惠“到“年度合作解锁最高35%专属返点“的成本优化方案
阿里云·云计算