Added option --tls-certKey to supply cert private key#20
Open
jobarasoined wants to merge 1 commit intoNeffIsBack:masterfrom
Open
Added option --tls-certKey to supply cert private key#20jobarasoined wants to merge 1 commit intoNeffIsBack:masterfrom
jobarasoined wants to merge 1 commit intoNeffIsBack:masterfrom
Conversation
jobarasoined
commented
May 1, 2026
| self.logger.warning("Private key BEGIN in the certfile is not secure separate the two and keep the private key safe") | ||
| else: | ||
| self.logger.error("No private key found. Supply it using --tls-certKey") | ||
| # To perform TLS server authentication (decrypt/session key ops, prove ownership) the server needs the corresponding private key. The cert alone cannot do that. |
Author
There was a problem hiding this comment.
this is why i exit after no private key is found immediately
jobarasoined
commented
May 1, 2026
| advanced.add_argument("--WSUS-Server", metavar="", dest="wsusHost", help="IP or DNS name of the WSUS Server.") | ||
| advanced.add_argument("--WSUS-Port", metavar="", dest="wsusPort", type=int, help="Port of the WSUS Server. (DEFAULT: 8530 for HTTP, 8531 for HTTPS)") | ||
| advanced.add_argument("--tls-cert", metavar="", dest="tlsCert", help="Path to a TLS certificate that is valid for the WSUS Server. Turns on HTTPS mode.") | ||
| advanced.add_argument("--tls-certKey", metavar="", dest="tlsCertKey", help="Path to a TLS certificate private key that is valid for the WSUS Server. Turns on HTTPS mode.") |
Author
There was a problem hiding this comment.
I decided to break kebab-case for camel case, I felt --tls-cert-key already have too many dashs
Owner
Thanks for the PR and no worries! |
Author
That is totally fine and understandable—no problem at all. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello Neff,
sorry for the delay
What changed:
This PR adds support for providing a TLS certificate private key as a separate file via the
--tls-certKeyarg.see issue #19 for more details
Key features:
--tls-certKeyis not provided, the code automatically checks if the certificate file contains an embedded private key (legacy format)How to test (simple test):
Generate a self-signed certificate and private key :
openssl genrsa -out private_key.pem 2048 openssl req -x509 -new -key private_key.pem -out certificate.pem -days 365 -nodes -subj "/"sudo wsuks --serve-only --tls-cert certificate.pem --tls-certKey private_key.pem # use -I to specify the correct interfaceHow to test against ESC17 LAB:
attack flow (template vulnerable for ESC17 --> CSR generation --> Submit CSR to CA --> Retrieve cert.pem --> (optional) Convert to PFX --> Extract cert.pem + private_key.pem --> Run wsuks with --tls-cert and --tls-certKey )
1) Obtain CSR via enrolled user
2) Submit CSR to CA and retrieve certificate
from compromised windows machine as user with enrollment right to ESC17
download the cert.pem to your machine and use it with the generated private key or convert it to pfx to save it and use later.
back to our attacker machine.
3) Convert certificate + key into PFX (step 3 and 4 are optional. once you get cert.pem you can jump to step 5)
4) Extract cert.pem and private_key.pem from PFX
5) Run wsuks with TLS cert and key
note* in this scenario i have control over dns and was able to add machines account to domain so i pointed wsus.domain.local to machine i control
note** the private_key.pem you generated with
openssl genrsa -out private_key.pem 2048is the same privatekey thats get extracted withopenssl pkcs12 -in certificate.pfx -nocerts -out private_key.pem -nodes -passin pass:YOUR_PFX_PASSWORD