-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Windows/Crypto rework: CertTree, Kerberos PKINIT, Netlogon's Kerberos secure channel, better NTLM variants #4879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4879 +/- ##
==========================================
- Coverage 80.86% 80.81% -0.05%
==========================================
Files 368 368
Lines 90271 90636 +365
==========================================
+ Hits 72996 73250 +254
- Misses 17275 17386 +111
🚀 New features to boost your workflow:
|
e7169e7 to
c583fe1
Compare
c583fe1 to
144df4e
Compare
076eb9b to
20d4fb2
Compare
20d4fb2 to
5915554
Compare
704eb05 to
064221d
Compare
5a6678e to
7ea2540
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR significantly refactors Scapy's Windows cryptography infrastructure with major improvements to certificate handling, Kerberos PKINIT support, and DCE/RPC functionality.
Key Changes:
- Replaces the
Chainhelper class with a more sophisticatedCertTreeclass that properly organizes certificates in a tree structure with ROOT CA verification - Implements PKINIT (Public Key Cryptography for Initial Authentication in Kerberos) with Diffie-Hellman key exchange
- Adds support for loading Kerberos credentials from KRB5CCNAME environment variable and ccache files
- Introduces NTLM variant support (WindowsNT, Windows2000, Windows2003+) for backward compatibility
- Implements CMS (Cryptographic Message Syntax) signing and verification
- Adds Kerberos secure channel support in MS-NRPC (Netlogon)
- Improves DCE/RPC context management and binding
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| scapy/layers/tls/cert.py | Major refactor: adds CertTree, CertList, CMS_Engine classes; improves certificate verification |
| scapy/layers/x509.py | Enhanced X509_AlgorithmIdentifier with proper RFC compliance and MultipleTypeField handling |
| scapy/layers/kerberos.py | PKINIT implementation, octetstring2key, enhanced KerberosSSP with TGT support |
| scapy/layers/ntlm.py | NTLM_VARIANT system for supporting different Windows versions |
| scapy/layers/spnego.py | KRB5CCNAME support, ccache loading, improved from_cli_arguments |
| scapy/modules/ticketer.py | Enhanced ssp() method to distinguish TGT/ST, added iter_tickets() |
| scapy/layers/msrpce/rpcclient.py | Better context management, endpoint resolution, impersonation level support |
| scapy/layers/msrpce/msnrpc.py | Kerberos secure channel in Netlogon |
| scapy/libs/rfc3961.py | RFC4556 octetstring2key implementation |
| test files | Comprehensive test coverage for new features |
Comments suppressed due to low confidence (2)
scapy/layers/smbclient.py:695
- This expression mutates a default value.
use_ioctl=kwargs.pop("use_ioctl", True),
scapy/layers/smbclient.py:696
- This expression mutates a default value.
timeout=kwargs.pop("timeout", 3),
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
08b201f to
7a63383
Compare
7a63383 to
ed7f1f1
Compare
This is a pretty big PR that changes many aspects related to the cryptography of Windows protocols. This is removes the Chain helper class, which was pretty much useless and replaces it with better alternatives. This PR:
SPNEGOSSPto make the code easier to read, in addition to enforcing MIC rules (safer). The initial code tried to use a common function for both client and server which was unreadable.scapy/layers/tls/cert.pyadd add documentationCertTreeclass that serves as a certificate store (think like Windows), and properly links certificates against their issuer, to a list of root CAsgetchain()allows to find a chain of certificates towards oneverify()says if a certificate can be verified against the storeSPNEGO.from_cli_argumentsX509_AlgorithmIdentifierTicketerusingssp()