阿里云被植入了挖矿程序, 请大佬帮个忙啊

2019-12-23 12:50:54 +08:00
 CoderLife

目前还不知道怎么引入的.

请各位大神帮忙解一下.

ps aux

postgres  9961  0.0  0.0   2236    72 ?        Ss   11:56   0:00 fE8fEp
postgres 11962  102 61.7 2432548 2396640 ?     Ssl  12:18  14:57 IS47Dj

阿里云报告

恶意进程(云查杀)-挖矿程序

该告警由如下引擎检测发现:
中控 IP:101.64.182.145
中控端口:443
进程路径:/tmp/363188e0133843515b9d6f1c487f017c (deleted)
命令行参数:IS47Dj

杀了还是会自启动

我的 ps aux

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.0  51724  2596 ?        Ss   Oct29  10:18 /usr/lib/systemd/systemd --switched-root --system --deserialize 22
root         2  0.0  0.0      0     0 ?        S    Oct29   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        S    Oct29   0:10 [ksoftirqd/0]
root         5  0.0  0.0      0     0 ?        S<   Oct29   0:00 [kworker/0:0H]
root         7  0.0  0.0      0     0 ?        S    Oct29   0:02 [migration/0]
root         8  0.0  0.0      0     0 ?        S    Oct29   0:00 [rcu_bh]
root         9  0.0  0.0      0     0 ?        R    Oct29  44:01 [rcu_sched]
root        10  0.0  0.0      0     0 ?        S<   Oct29   0:00 [lru-add-drain]
root        11  0.0  0.0      0     0 ?        S    Oct29   0:25 [watchdog/0]
root        12  0.0  0.0      0     0 ?        S    Oct29   3:51 [watchdog/1]
root        13  0.0  0.0      0     0 ?        S    Oct29   0:02 [migration/1]
root        14  0.0  0.0      0     0 ?        S    Oct29   0:11 [ksoftirqd/1]
root        16  0.0  0.0      0     0 ?        S<   Oct29   0:00 [kworker/1:0H]
root        18  0.0  0.0      0     0 ?        S    Oct29   0:00 [kdevtmpfs]
root        19  0.0  0.0      0     0 ?        S<   Oct29   0:00 [netns]
root        20  0.0  0.0      0     0 ?        S    Oct29   0:01 [khungtaskd]
root        21  0.0  0.0      0     0 ?        S<   Oct29   0:00 [writeback]
root        22  0.0  0.0      0     0 ?        S<   Oct29   0:00 [kintegrityd]
root        23  0.0  0.0      0     0 ?        S<   Oct29   0:00 [bioset]
root        24  0.0  0.0      0     0 ?        S<   Oct29   0:00 [bioset]
root        25  0.0  0.0      0     0 ?        S<   Oct29   0:00 [bioset]
root        26  0.0  0.0      0     0 ?        S<   Oct29   0:00 [kblockd]
root        27  0.0  0.0      0     0 ?        S<   Oct29   0:00 [md]
root        28  0.0  0.0      0     0 ?        S<   Oct29   0:00 [edac-poller]
root        29  0.0  0.0      0     0 ?        S<   Oct29   0:00 [watchdogd]
root        36  0.0  0.0      0     0 ?        S    Oct29   2:57 [kswapd0]
root        37  0.0  0.0      0     0 ?        SN   Oct29   0:00 [ksmd]
root        38  0.0  0.0      0     0 ?        SN   Oct29   0:13 [khugepaged]
root        39  0.0  0.0      0     0 ?        S<   Oct29   0:00 [crypto]
root        47  0.0  0.0      0     0 ?        S<   Oct29   0:00 [kthrotld]
root        49  0.0  0.0      0     0 ?        S<   Oct29   0:00 [kmpath_rdacd]
root        50  0.0  0.0      0     0 ?        S<   Oct29   0:00 [kaluad]
root        51  0.0  0.0      0     0 ?        S<   Oct29   0:00 [kpsmoused]
root        52  0.0  0.0      0     0 ?        S<   Oct29   0:00 [ipv6_addrconf]
root        65  0.0  0.0      0     0 ?        S<   Oct29   0:00 [deferwq]
root        97  0.0  0.0      0     0 ?        S    Oct29   0:05 [kauditd]
root       232  0.0  0.0      0     0 ?        S<   Oct29   0:00 [ata_sff]
root       254  0.0  0.0      0     0 ?        S    Oct29   0:00 [scsi_eh_0]
root       260  0.0  0.0      0     0 ?        S<   Oct29   0:00 [scsi_tmf_0]
root       263  0.0  0.0      0     0 ?        S    Oct29   0:00 [scsi_eh_1]
root       264  0.0  0.0      0     0 ?        S<   Oct29   0:00 [scsi_tmf_1]
root       305  0.0  0.0      0     0 ?        S<   Oct29   0:00 [ttm_swap]
root       317  0.0  0.0      0     0 ?        S<   Oct29   0:42 [kworker/0:1H]
root       323  0.0  0.0      0     0 ?        S<   Oct29   0:13 [kworker/1:1H]
root       328  0.0  0.0      0     0 ?        S    Oct29   1:45 [jbd2/vda1-8]
root       329  0.0  0.0      0     0 ?        S<   Oct29   0:00 [ext4-rsv-conver]
redis      375  0.1  0.1 310892  6812 ?        Ssl  Nov08  65:03 /usr/bin/redis-server 127.0.0.1:6379
root       397  0.0  0.8 149876 32136 ?        Ss   Oct29   1:38 /usr/lib/systemd/systemd-journald
root       421  0.0  0.0  44460   956 ?        Ss   Oct29   0:00 /usr/lib/systemd/systemd-udevd
root       474  0.0  0.0  55520   692 ?        S<sl Oct29   0:24 /sbin/auditd
root       577  0.0  0.0      0     0 ?        S<   Oct29   0:00 [nfit]
root       600  0.0  0.0  26612  1340 ?        Ss   Oct29   1:29 /usr/lib/systemd/systemd-logind
polkitd    606  0.0  0.2 612328  9220 ?        Ssl  Oct29   1:11 /usr/lib/polkit-1/polkitd --no-debug
dbus       607  0.0  0.0  58228  1260 ?        Ss   Oct29   3:11 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
chrony     619  0.0  0.0 117908  1160 ?        S    Oct29   0:18 /usr/sbin/chronyd
root       661  0.0  0.0  25904   204 ?        Ss   Oct29   0:00 /usr/sbin/atd -f
root       663  0.0  0.0 126316  1084 ?        Ss   Oct29   0:22 /usr/sbin/crond -n
root       673  0.0  0.0 110104   128 ttyS0    Ss+  Oct29   0:00 /sbin/agetty --keep-baud 115200,38400,9600 ttyS0 vt220
root       674  0.0  0.0 110104   132 tty1     Ss+  Oct29   0:00 /sbin/agetty --noclear tty1 linux
root       840  0.0  0.0 107464  1996 ?        Ss   Oct29   0:00 /sbin/dhclient -1 -q -lf /var/lib/dhclient/dhclient--eth0.lease -pf /var/run/dhclient-eth0.pid -H iZ8vb1nz5l71xucapbkndaZ eth0
root       901  0.0  0.3 573920 13260 ?        Ssl  Oct29   9:42 /usr/bin/python2 -Es /usr/sbin/tuned -l -P
root       905  0.0  0.3 451608 13688 ?        Ssl  Oct29   7:20 /usr/sbin/rsyslogd -n
root      1087  0.0  0.0      0     0 ?        R    10:35   0:01 [kworker/1:1]
root      1115  0.0  0.0 112864  1256 ?        Ss   Oct29   0:05 /usr/sbin/sshd -D
root      1413  0.0  0.1 122428  4668 ?        Ss   Oct29   0:00 nginx: master process nginx
root      5011  0.0  0.1 157260  5056 ?        Ss   11:23   0:00 sshd: root@pts/1
root      5013  0.0  0.0 115572  1280 pts/1    Ss+  11:23   0:00 -bash
root      7006  0.0  0.0  32528  2992 ?        S<sl Nov15  30:00 /usr/local/aegis/aegis_update/AliYunDunUpdate
root      9471  0.0  0.0      0     0 ?        S    11:50   0:00 [kworker/0:1]
root      9838  0.0  0.1 154652  4752 ?        Ss   11:55   0:00 sshd: root@pts/0
root      9841  0.0  0.0 115572  1252 pts/0    Ss+  11:55   0:00 -bash
postgres  9961  0.0  0.0   2236    72 ?        Ss   11:56   0:00 fE8fEp
postgres 10931  0.2  0.0  16008   104 ?        Ssl  12:08   0:05 tracepath
postgres 11962  102 61.7 2432548 2396640 ?     Ssl  12:18  20:12 IS47Dj
root     12097  0.0  0.0      0     0 ?        S    12:20   0:00 [kworker/1:2]
root     12500  0.0  0.1 154652  5568 ?        Ss   12:25   0:00 sshd: root@pts/2
root     12503  0.0  0.0 115572  2184 pts/2    Ss+  12:25   0:00 -bash
postgres 12782  0.0  0.3 396672 12344 ?        Ss   Dec10   1:18 /usr/pgsql-11/bin/postmaster -D /var/lib/pgsql/11/data/
postgres 12785  0.0  0.0 249468  1580 ?        Ss   Dec10   0:00 postgres: logger   
postgres 12787  0.0  0.6 396796 27100 ?        Ss   Dec10   0:05 postgres: checkpointer   
postgres 12788  0.0  0.1 396672  6728 ?        Ss   Dec10   0:15 postgres: background writer   
postgres 12789  0.0  0.1 396672  5608 ?        Ss   Dec10   0:38 postgres: walwriter   
postgres 12790  0.0  0.0 397224  2744 ?        Ss   Dec10   0:36 postgres: autovacuum launcher   
postgres 12791  0.0  0.0 251872  1872 ?        Ss   Dec10   1:16 postgres: stats collector   
postgres 12792  0.0  0.0 397088  2112 ?        Ss   Dec10   0:01 postgres: logical replication launcher   
root     13401  0.0  0.0      0     0 ?        S    Dec22   0:01 [kworker/u4:1]
root     14259  0.0  0.0      0     0 ?        S    12:35   0:00 [kworker/1:0]
root     14447  0.5  0.1 154652  5568 ?        Ss   12:38   0:00 sshd: root@pts/3
root     14450  0.0  0.0 115572  2104 pts/3    Ss   12:38   0:00 -bash
root     14470  0.0  0.0 155332  1816 pts/3    R+   12:38   0:00 ps aux
root     24612  0.0  0.0  41828  2596 ?        Ssl  Nov15  23:48 /usr/sbin/aliyun-service
root     26707  0.0  0.0      0     0 ?        S    09:00   0:00 [kworker/0:2]
root     26894  0.0  0.0      0     0 ?        S    01:21   0:00 [kworker/u4:0]
root     27890  3.2  0.3 137752 14064 ?        S<sl Dec21  96:39 /usr/local/aegis/aegis_client/aegis_10_75/AliYunDun
nginx    31630  0.0  0.1 123032  6340 ?        S    Dec21   0:22 nginx: worker process
nginx    31631  0.0  0.1 123304  6580 ?        S    Dec21   0:30 nginx: worker process
8565 次点击
所在节点    程序员
39 条回复
lucifer9
2019-12-23 14:48:30 +08:00
不想查杀不想重装的话
把挖矿程序要去连接的 IP 给 ban 了就行了吧
阿里云不是有防火墙
abccccabc
2019-12-23 14:54:10 +08:00
如果把 postgres 暂停掉会怎样呢?
sugars
2019-12-23 15:01:15 +08:00
试试在出方向禁用掉挖矿 ip ?
ESeanZ
2019-12-23 15:02:04 +08:00
@luozic +1
linnil
2019-12-23 15:10:21 +08:00
看到告警,我就觉得:还是不用这云服务比较好。。。
ThirdFlame
2019-12-23 15:14:21 +08:00
定时任务啊
npc0der
2019-12-23 15:49:59 +08:00
删除中毒用户 其根目录(或者改名) 删除用户
根据用户 uid 列出所有该用户下进程 然后 kill
IamUNICODE
2019-12-23 15:54:45 +08:00
怎么感觉最近隔几天就要出个这帖子,阿里云很容易被感染吗,还是你们都在上面安装 redis 而且不设置 auth ?
a62527776a
2019-12-23 15:56:11 +08:00
我前天也遇到了 备份了数据库之后重装了。。
早期配置比较随意 阿里云全端口开放 redis 没设密码 文件夹也放的比较乱

重新配置之后好多了 也是 redis 没设密码导致的
yukiloh
2019-12-23 15:58:14 +08:00
群里也看到腾讯云被肉了…
lvzhiqiang
2019-12-23 16:10:27 +08:00
重装吧,没有那么多精力就别折腾了~~
laibin6
2019-12-24 08:11:32 +08:00
之前遇到过,文件全部加了 attr,禁止删除。
文件名称和系统文件名类似,都在 etc 和 usr 目录,检查一下这两个文件夹下面的文件权限,不是 ls -al 哦
GoRoad
2019-12-24 08:51:02 +08:00
碰到过这情况,是通过 redis 入侵的,幸好我 redis 是 docker 装的,把那个容器直接干掉就没事了
CoderLife
2019-12-24 10:15:49 +08:00
@lucifer9 *云的报告还是很有用的
@abccccabc 与进程无关, 是通过 postgres 这个用户启动的
@sugars 各种禁了
@linnil 不用云服务器, 有可能你都不知道被挖矿了
@ThirdFlame 隐藏得很好, 定时任务里没有
@npc0der 根本没有目录的
@IamUNICODE 与云没有关系, 是自己引入的
@a62527776a @lvzhiqiang 重装的代价太夶了, 图片几十个 G
@yukiloh 最近矿涨价了?
@laibin6 哪天深入学习一下 redis 怎么入侵
@GoRoad 下次也用 docker 了
sinalvee
2019-12-24 10:48:47 +08:00
之前遇到过,参考了这篇文章
http://www.lfming.com/2019/06/13/%E4%B8%80%E6%AC%A1%E6%9C%8D%E5%8A%A1%E5%99%A8%E4%B8%AD%E6%8B%9B%E6%8C%96%E7%9F%BF%E7%97%85%E6%AF%92%E8%A7%A3%E5%86%B3%E8%BF%87%E7%A8%8B/

主要思路就是,根据他定时任务,拿到了执行的代码,相应的改动删掉,可能其他的地方也有,比如 /etc/bashrc,相关代码也删掉
linnil
2019-12-24 13:51:38 +08:00
之前没有仔细看你发出来的东西,只是看到又有中挖矿木马的替你感到可惜又。。。
其实这种挖矿木马工作方式大同小异,你上面已经提到自己去用心跟了一下 bash,这样可以解决掉 90%这样的木马。
我之前所说不用这种云服务商提供的服务是个人觉得他们管的太多。
之前爆的[redis 挖矿]( https://www.v2ex.com/t/537457)你可以参考一下,排查那些死灰复燃的地方,加留心关注应该就行了。
你这次中了,应该和`postgresql`有关。
abccccabc
2019-12-24 16:33:06 +08:00
最后你怎么处理的?????
CoderLife
2019-12-24 18:13:55 +08:00
@abccccabc 处理了, 看 append 哈
@sinalvee 看了一下有点类似
@linnil 目前只要阿里云不再报就可以认为解决了, 这玩意要占 cpu, 安全意识不能薄弱
laibin6
2019-12-24 20:54:54 +08:00
默认端口+弱密码,全网扫

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/631475

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX