KrbRelayUp - 不强制执行 LDAP 签名(默认设置)的 Windows 域环境中的通用无修复本地权限升级

admin 2024年10月16日21:50:55评论33 views字数 4086阅读13分37秒阅读模式
KrbRelayUp - 不强制执行 LDAP 签名(默认设置)的 Windows 域环境中的通用无修复本地权限升级
KrbRelayUp - 不强制执行 LDAP 签名(默认设置)的 Windows 域环境中的通用无修复本地权限升级(建议直接阅读原文,原文中有其它文章参考提供分析和研究),这是一个简单的封装,用于简化以下攻击原理的滥用:
  1. (可选)创建新的机器账户(New-MachineAccount)
  2. 本地机器账户身份验证欺骗(KrbRelay)
  3. Kerberos中继到LDAP(KrbRelay)
  4. 添加RBCD特权并获取本地机器的特权ST(Rubeus)
  5. 使用该ST对本地服务管理器进行身份验证,并创建NT/SYSTEM下的新服务(SCMUACBypass)
这实际上是在Windows域环境中的普遍无修复本地权限提升,其中未强制执行LDAP签名(默认设置)。
更新:这里有一篇由@an0n_r0撰写的优秀文章,介绍如何手动执行此攻击(使用原始工具:PowerMad/SharpMad、KrbRelay、Rubeus和SCMUACBypass)
更新 - 影子凭据支持
我添加了一些功能来支持使用影子凭据进行此攻击。请注意,这消除了添加(或拥有)另一个机器账户的需求。
注意:此攻击方法绕过了“受保护用户”(或“帐户是敏感的,无法委派”)的缓解措施,因为它滥用了S4U2Self。
  1. 本地机器账户身份验证欺骗(KrbRelay)
  2. Kerberos中继到LDAP(KrbRelay)
  3. 生成新的KeyCredential并将其添加到本地机器账户的“msDS-KeyCredentialLink”属性中(Whisker和KrbRelay)
  4. 使用该KeyCredential通过PKInit获得本地机器账户的TGT(Rubeus)
  5. 使用TGT通过S4U2Self和TGSSUB获取本地机器的特权ST(Rubeus)
  6. 使用该ST对本地服务管理器进行身份验证,并创建NT/SYSTEM下的新服务(SCMUACBypass)
更新:这是@icyguider撰写的优秀文章,介绍如何手动执行此攻击的ShadowCred方法(使用原始工具:KrbRelay、Rubeus和SCMUACBypass),以及使用NimCrypt2打包各种工具并通过一些防御机制来规避检测。
更新 - ADCS Web Enrollment支持
我增加了对将机器KRB auth中继到ADCS Web Enrollment(而不是LDAP)的支持。这消除了域中强制执行LDAP签名的要求,因为此攻击不会中继到LDAP。
注意:此攻击方法绕过了“受保护用户”(或“帐户是敏感的,无法委派”)的缓解措施,因为它滥用了S4U2Self。
  1. 本地机器账户身份验证欺骗(KrbRelay)
  2. Kerberos中继到ADCS(HTTP)(KrbRelay和ADCSPwn)
  3. 代表本地机器账户生成证书请求,将其提交给ADCS Web Enrollment,并最终检索本地机器账户的证书(ADCSPwn)
  4. 使用该证书通过PKInit获得本地机器账户的TGT(Rubeus)
  5. 使用TGT通过S4U2Self和TGSSUB获取本地机器的特权ST(Rubeus)
  6. 使用该ST对本地服务管理器进行身份验证,并创建NT/SYSTEM下的新服务(SCMUACBypass)
用法
KrbRelayUp - Relaying you to SYSTEMFULL: Perform full attack chain. Options are identical to RELAY. Tool must be on disk.RELAY: First phase of the attack. Will Coerce Kerberos auth from local machine account, relay it to LDAP and create a control primitive over the local machine using RBCD or SHADOWCRED.Usage: KrbRelayUp.exe relay -d FQDN -cn COMPUTERNAME [-c] [-cp PASSWORD | -ch NTHASH]    -m   (--Method)                   Abuse method to use in after a successful relay to LDAP <rbcd/shadowcred> (default=rbcd)    -p   (--Port)                     Port for Com Server (default=12345)    -cls (--Clsid)                    CLSID to use for coercing Kerberos auth from local machine account (default=90f18417-f0f1-484e-9d3c-59dceee5dbd8)    # RBCD Method:    -c   (--CreateNewComputerAccount) Create new computer account for RBCD. Will use the current authenticated user.    -cn  (--ComputerName)             Name of attacker owned computer account for RBCD. (default=KRBRELAYUP$)    -cp  (--ComputerPassword)         Password of computer account for RBCD. (default=RANDOM [if -c is enabled])    # SHADOWCRED Method:    -f   (--ForceShadowCred)          Clear the msDS-KeyCredentialLink attribute of the attacked computer account before adding our new shadow credentials. (Optional)    # ADCS Method:    -ca  (--CAEndpoint)               CA endpoint FQDN (default = same as DC)    -https                            Connect to CA endpoint over secure HTTPS instead of HTTP)    -cet (--CertificateTemplate)      Certificate template to request for (default=Machine)SPAWN: Second phase of the attack. Will use the appropriate control primitive to obtain a Kerberos Service Ticket and will use it to create a new service running as SYSTEM.Usage: KrbRelayUp.exe spawn -d FQDN -cn COMPUTERNAME [-cp PASSWORD | -ch NTHASH] <-i USERTOIMPERSONATE>    -m   (--Method)                   Abuse method used in RELAY phase <rbcd/shadowcred> (default=rbcd)    -i   (--Impersonate)              User to impersonate. should be a local administrator in the target computer. (default=Administrator)    -s   (--ServiceName)              Name of the service to be created. (default=KrbSCM)    -sc  (--ServiceCommand)           Service command [binPath]. (default = spawn cmd.exe as SYSTEM)    # RBCD Method:    -cn  (--ComputerName)             Name of attacker owned computer account for RBCD. (default=KRBRELAYUP$)    -cp  (--ComputerPassword)         Password of computer account for RBCD. (either -cp or -ch must be specified)    -ch  (--ComputerPasswordHash)     Password NT hash of computer account for RBCD. (either -cp or -ch must be specified)    # SHADOWCRED | ADCS Method:    -ce  (--Certificate)              Base64 encoded certificate or path to certificate file    -cep (--CertificatePassword)      Certificate password (if applicable)KRBSCM: Will use the currently loaded Kerberos Service Ticket to create a new service running as SYSTEM.Usage: KrbRelayUp.exe krbscm <-s SERVICENAME> <-sc SERVICECOMMANDLINE>    -s  (--ServiceName)              Name of the service to be created. (default=KrbSCM)    -sc (--ServiceCommand)           Service command [binPath]. (default = spawn cmd.exe as SYSTEM)General Options:    -d  (--Domain)                   FQDN of domain. (Optional)    -dc (--DomainController)         FQDN of domain controller. (Optional)    -ssl                             Use LDAP over SSL. (Optional)    -n                               Use CreateNetOnly (needs to be on disk) instead of PTT when importing ST (enabled if using FULL mode)    -v  (--Verbose)                  Show verbose output. (Optional)

KrbRelayUp - 不强制执行 LDAP 签名(默认设置)的 Windows 域环境中的通用无修复本地权限升级

KrbRelayUp - 不强制执行 LDAP 签名(默认设置)的 Windows 域环境中的通用无修复本地权限升级

KrbRelayUp - 不强制执行 LDAP 签名(默认设置)的 Windows 域环境中的通用无修复本地权限升级

原文始发于微信公众号(Ots安全):KrbRelayUp - 不强制执行 LDAP 签名(默认设置)的 Windows 域环境中的通用无修复本地权限升级

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2024年10月16日21:50:55
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   KrbRelayUp - 不强制执行 LDAP 签名(默认设置)的 Windows 域环境中的通用无修复本地权限升级https://cn-sec.com/archives/1887687.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息