Skip to content

MS-NEGOEX Phase 3 Implementation#2213

Draft
ThatTotallyRealMyth wants to merge 7 commits into
fortra:masterfrom
ThatTotallyRealMyth:negoex-module-phase-three
Draft

MS-NEGOEX Phase 3 Implementation#2213
ThatTotallyRealMyth wants to merge 7 commits into
fortra:masterfrom
ThatTotallyRealMyth:negoex-module-phase-three

Conversation

@ThatTotallyRealMyth

@ThatTotallyRealMyth ThatTotallyRealMyth commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Hey Hey, opening this PR to begin tracking work on the phase 3 of the ms-negoex implementation. So far the helper functions have been implemented, the proposed testcases from PR1/2 have been integrated and they all pass:

┌──(kali㉿kali)-[~/personalprojects/impacket-contributions]
└─$ python3 test_spnego_negoex.py -v   
test_malformed_negoex_payload_raises_clear_error_when_selected (__main__.SPNEGONegoExTests.test_malformed_negoex_payload_raises_clear_error_when_selected) ... ok
test_neg_token_init_detects_negoex_offered (__main__.SPNEGONegoExTests.test_neg_token_init_detects_negoex_offered) ... ok
test_neg_token_init_does_not_parse_ntlm_as_negoex (__main__.SPNEGONegoExTests.test_neg_token_init_does_not_parse_ntlm_as_negoex) ... ok
test_neg_token_init_parses_negoex_mech_token_messages (__main__.SPNEGONegoExTests.test_neg_token_init_parses_negoex_mech_token_messages) ... ok
test_neg_token_resp_detects_negoex_selected (__main__.SPNEGONegoExTests.test_neg_token_resp_detects_negoex_selected) ... ok
test_neg_token_resp_does_not_parse_ntlm_response_as_negoex (__main__.SPNEGONegoExTests.test_neg_token_resp_does_not_parse_ntlm_response_as_negoex) ... ok
test_neg_token_resp_parses_negoex_response_token_messages (__main__.SPNEGONegoExTests.test_neg_token_resp_parses_negoex_response_token_messages) ... ok

----------------------------------------------------------------------
Ran 7 tests in 0.002s

OK
                                                                                                                                                  

I wasnt sure how to handle as I noticed in the provided test cases you have a function called getNegoExMessages() but you didnt mention it in #2195 so I assumed that since you gave it to me in a proposed testcase that you wanted it. Happy to remove it as well if it was not intended

Added the getNegoExMessages() function to both the init and response classes
Raise NotImplementedError in smb3.py if NEGOEX is selected instead of parsing as NTLM messages
Raise LDAPSessionError for unsupported NEGOEX/PKU2U authentication instead of parsing it as a type2 NTLM message. 

Unsure as to using LDAPSessionError or using the NotImplementedError like in smb3.py
@ThatTotallyRealMyth

Copy link
Copy Markdown
Contributor Author

Hey @anadrianmanrique you mentioned smb and ldap for updating to handle NEGOEX but you never mentioned DCERPC. Should I add the same the same thing in kerberosv5.py, here

################################################################################
# DCE RPC Helpers
################################################################################
def getKerberosType3(cipher, sessionKey, auth_data):
    negTokenResp = SPNEGO_NegTokenResp(auth_data)

Or should I leave that out?

@anadrianmanrique anadrianmanrique self-assigned this Jun 24, 2026
@anadrianmanrique anadrianmanrique added the medium Medium priority item label Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

medium Medium priority item

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants