目前还不知道怎么引入的.
请各位大神帮忙解一下.
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
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: stas 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
进程异常行为-可疑编码命令待处理 备注处理 该告警由如下引擎检测发现: 用户名:postgres 命令行:sh -c echo ZXhlYy......p9CngK |base64 -d|bash
解开, 发现里面有一个访问这些列表:
tor2web.io onion.to onion.mn onion.in.net 4tor.ml d2web.org onion.glass civiclink.network tor2web.su onion.ly onion.pet onion.ws
这些域名已加入hosts 再看效果
问题已初步解决 没有重装系统, 因为重装太麻烦, 东西太多.
大概说一下步骤:
想了想原因, 可能引入的原因:
多谢各位大佬的关注.
![]() | 1 msg7086 2019-12-23 12:58:39 +08:00 重装啊,难道你打算查杀? |
![]() | 3 cyannnna 2019-12-23 13:12:48 +08:00 没快照或者备份么? |
4 luozic 2019-12-23 13:14:39 +08:00 看到 redis 很有可能是通过 redis 开放端口入侵的。 |
![]() | 5 MadHouse 2019-12-23 13:17:38 +08:00 via Android 直接 kill 不行吗 |
6 CoderLife OP |
7 sambawy 2019-12-23 13:21:47 +08:00 crontab -l 看下有没有定时任务 |
9 amaranthf 2019-12-23 13:26:13 +08:00 看一下 pstree ? |
10 CoderLife OP systemd─┬─AliYunDun───24*[{AliYunDun}] ├─AliYunDunUpdate───3*[{AliYunDunUpdate}] ├─2*[agetty] ├─aliyun-service───2*[{aliyun-service}] ├─atd ├─auditd───{auditd} ├─chronyd ├─crond ├─dbus-daemon ├─dhclient ├─nginx───2*[nginx] ├─node─┬─3*[node───9*[{node}]] │ └─5*[{node}] ├─polkitd───6*[{polkitd}] ├─postmaster───14*[postmaster] ├─redis-server───2*[{redis-server}] ├─rsyslogd───2*[{rsyslogd}] ├─sshd─┬─5*[sshd───bash] │ └─sshd───bash───pstree ├─systemd-journal ├─systemd-logind ├─systemd-udevd └─tuned───4*[{tuned}] @amaranthf 看看呢 |
11 amaranthf 2019-12-23 13:32:00 +08:00 看不出来……不想重装又杀不掉的话,限制一下那个进程的 cpu 占用吧 |
13 mikeguan 2019-12-23 13:37:02 +08:00 via Android 看进程启动用户是 postgre,估计和 pgsql 有关了 先通过 PID 一步一步查下具体执行文件吧,可以搜索下有关 pgsql 挖矿,可能使用的手法都是一样的 |
14 CoderLife OP @mikeguan 已经把 postgres 改为 nologin 了, pid 往上查就是 systemd 了, 痕迹太少了, 且找不到这个执行的文件 |
![]() | 15 ragnaroks 2019-12-23 13:41:27 +08:00 再开一台一样的机器,对比下已运行进程二进制的 hash,替换常见二进制是惯用手法 |
![]() | 19 beautwill 2019-12-23 13:50:16 +08:00 不是你的程序的问题,是通过阿里云盾调用过来的,很可能是 AK 泄露了,检查下云助手是否存在 api 调用。 |
![]() | 20 RadishWind 2019-12-23 14:11:25 +08:00 在 proc 目录能还原出正在运行的可执行文件,然后设置 iptables 和安全组,ban 掉 C&C 服务器的 ip |
![]() | 21 lucifer9 2019-12-23 14:48:30 +08:00 不想查杀不想重装的话 把挖矿程序要去连接的 IP 给 ban 了就行了吧 阿里云不是有防火墙 |
![]() | 22 abccccabc 2019-12-23 14:54:10 +08:00 如果把 postgres 暂停掉会怎样呢? |
![]() | 23 sugars PRO 试试在出方向禁用掉挖矿 ip ? |
25 linnil 2019-12-23 15:10:21 +08:00 看到告警,我就觉得:还是不用这云服务比较好。。。 |
26 ThirdFlame 2019-12-23 15:14:21 +08:00 定时任务啊 |
27 npc0der 2019-12-23 15:49:59 +08:00 删除中毒用户 其根目录(或者改名) 删除用户 根据用户 uid 列出所有该用户下进程 然后 kill |
![]() | 28 IamUNICODE 2019-12-23 15:54:45 +08:00 怎么感觉最近隔几天就要出个这帖子,阿里云很容易被感染吗,还是你们都在上面安装 redis 而且不设置 auth ? |
![]() | 29 a62527776a 2019-12-23 15:56:11 +08:00 我前天也遇到了 备份了数据库之后重装了。。 早期配置比较随意 阿里云全端口开放 redis 没设密码 文件夹也放的比较乱 重新配置之后好多了 也是 redis 没设密码导致的 |
30 yukiloh 2019-12-23 15:58:14 +08:00 via Android 群里也看到腾讯云被肉了… |
![]() | 31 lvzhiqiang 2019-12-23 16:10:27 +08:00 重装吧,没有那么多精力就别折腾了~~ |
32 laibin6 2019-12-24 08:11:32 +08:00 via iPhone 之前遇到过,文件全部加了 attr,禁止删除。 文件名称和系统文件名类似,都在 etc 和 usr 目录,检查一下这两个文件夹下面的文件权限,不是 ls -al 哦 |
![]() | 33 GoRoad 2019-12-24 08:51:02 +08:00 碰到过这情况,是通过 redis 入侵的,幸好我 redis 是 docker 装的,把那个容器直接干掉就没事了 |
34 CoderLife OP @lucifer9 *云的报告还是很有用的 @abccccabc 与进程无关, 是通过 postgres 这个用户启动的 @sugars 各种禁了 @linnil 不用云服务器, 有可能你都不知道被挖矿了 @ThirdFlame 隐藏得很好, 定时任务里没有 @npc0der 根本没有目录的 @IamUNICODE 与云没有关系, 是自己引入的 @a62527776a @lvzhiqiang 重装的代价太了, 图片几十个 G @yukiloh 最近矿涨价了? @laibin6 哪天深入学习一下 redis 怎么入侵 @GoRoad 下次也用 docker 了 |
35 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,相关代码也删掉 |
36 linnil 2019-12-24 13:51:38 +08:00 之前没有仔细看你发出来的东西,只是看到又有中挖矿木马的替你感到可惜又。。。 其实这种挖矿木马工作方式大同小异,你上面已经提到自己去用心跟了一下 bash,这样可以解决掉 90%这样的木马。 我之前所说不用这种云服务商提供的服务是个人觉得他们管的太多。 之前爆的[redis 挖矿]( t/537457)你可以参考一下,排查那些死灰复燃的地方,加留心关注应该就行了。 你这次中了,应该和`postgresql`有关。 |
![]() | 37 abccccabc 2019-12-24 16:33:06 +08:00 最后你怎么处理的????? |
38 CoderLife OP |
39 laibin6 2019-12-24 20:54:54 +08:00 via iPhone 默认端口+弱密码,全网扫 |