AlmondOffSec / PassTheCert

Proof-of-Concept tool to authenticate to an LDAP/S server with a certificate through Schannel
Apache License 2.0
555 stars 71 forks source link

Support for Shadow Crdential certificate ? #18

Closed Dramelac closed 10 months ago

Dramelac commented 11 months ago

If an account is compromised with pywhisker.py during a shadow cred attack, a self-signed certificate is registered in LDAP, enabling PKINIT authentication under normal circumstances. However, if the DC returns the error KDC_ERR_PADATA_TYPE_NOSUPP, would it still be possible to connect to LDAPS using this certificate?

python3 passthecert.py -action whoami -crt shadow_cred.crt -key shadow_cred.key -domain lab.local -dc-host "dc.lab.local" -debug       
Impacket v0.11.0 - Copyright 2023 Fortra

[+] Impacket Library Installation Path: /opt/my-resources/tools/PassTheCert/Python/venv/lib/python3.11/site-packages/impacket
[+] The new computer will be added in CN=Computers,dc=lab,dc=local
Traceback (most recent call last):
  File "/opt/my-resources/tools/PassTheCert/Python/passthecert.py", line 685, in <module>
    manage.whoami()
  File "/opt/my-resources/tools/PassTheCert/Python/passthecert.py", line 453, in whoami
    raise Exception('whoami command failed, certificate seems not trusted by the Active Directory')
Exception: whoami command failed, certificate seems not trusted by the Active Directory
whoami command failed, certificate seems not trusted by the Active Directory

Thank you !

ThePirateWhoSmellsOfSunflowers commented 10 months ago

Hello!

Yes you are right, certificates set with shadow cred attack cannot be used to do authentication with schannel.

:sunflower:

enj5oy commented 8 months ago

Hello!

Yes you are right, certificates set with shadow cred attack cannot be used to do authentication with schannel.

🌻 @ThePirateWhoSmellsOfSunflowers Hello, could you please provide an explanation for why authentication with the certificate from PyWhisker is not successful?

ThePirateWhoSmellsOfSunflowers commented 8 months ago

Hello @enj5oy! I wrote a comment in #20, maybe it answers your question.

:sunflower: