For the complete documentation index, see llms.txt. This page is also available as Markdown.

🆕Using Certificates

Using Certificates authentication with NetExec

PKINIT (default)

By default, nxc authenticates with the certificate through PKINIT: it asks the KDC for a TGT with the certificate, saves it to a ccache, then performs a regular Kerberos login with that ticket (from ccache). It works on every protocol, but requires the KDC to support PKINIT: the Domain Controller must hold a certificate with the KDC Authentication EKU (1.3.6.1.5.2.3.5), issued by a CA present in the NTAuth store.

nxc smb 192.168.0.1 --pfx-cert user.pfx -u user 
nxc smb 192.168.0.1 --pfx-cert user.pfx --pfx-pass password -u user 
nxc smb 192.168.0.1 --pfx-base64 user.pfx -u user 
nxc smb 192.168.0.1 --pem-cert user.pem --pem-key key.pem -u user 
PKINIT authentication with a PFX certificate over SMB and LDAP

When authenticating with a certificate, nxc saves the TGT to a ccache file in ~/.nxc/logs/. You can reuse this ccache to authenticate with Kerberos in other tools (KRB5CCNAME=<file>.ccache).

If the KDC cannot be resolved from the domain name, specify the Domain Controller IP with --kdcHost.

UnPAC the hash (SMB only)

The login itself is done with Kerberos, so the NT hash of the account is no longer retrieved by default. With --unpac, nxc additionally performs a U2U request with the PKINIT TGT and extracts the NT hash of the account from the PAC_CREDENTIAL_INFO structure of the PAC. The hash is displayed and stored in the nxc database.

Recovering the NT hash of the account with --unpac

References

Schannel (LDAP only)

When the Domain Controller has no such certificate, PKINIT is unavailable and the authentication fails with KDC_ERR_PADATA_TYPE_NOSUPP. With --schannel, the certificate is presented directly in the TLS handshake and the bind is done with a SASL EXTERNAL bind: Kerberos is never involved, so it still works in that case.

PKINIT fails on a DC without KDC certificate, while Schannel authenticates over LDAP and LDAPS

The account is resolved by the Domain Controller from the certificate mapping, so no username is needed: nxc retrieves the mapped account with an LDAP whoami and displays it (AZOX.CORP\Administrateur from certificate). Any -u value is ignored.

Last updated

Was this helpful?