error - 'SSL routines', 'state_machine', 'internal error'

Hi everyone!

I’m pretty sure some of you have encountered this annoying problem using impacket’s script to (try and) connect to the ms-sql-s service on the Archetype machine, whilst getting this nice message at the end saying:

python3 ARCHETYPE/sql_svc@ -windows-auth
Impacket v0.9.25.dev1+20220119.101925.12de27dc - Copyright 2021 SecureAuth Corporation

[*] Encryption required, switching to TLS
[-] [('SSL routines', 'state_machine', 'internal error')]

Hunting around for answers, I came across a couple of threads over at the impacket project page on GitHub which I’ll leave here, in case it solved the problem for you.
(Judging from the commands they’ve posted, they too are HTB friends, stuck on ARCHETYPE :stuck_out_tongue: )

(Closed) Issue 866 - OpenSSL.SSL.Error: [(‘SSL routines’, ‘state_machine’, ‘internal error’)]

(Open) Issue 856 - mssqlclient : ‘SSL routines’, ‘state_machine’, ‘internal error’

Now although this has worked for some, unfortunately for me (and quite a few others) the problem remains.

The proposed solution, in case it helps anyone, is to modify lines 663 and 911 in impacket/impacket/ file by doing the following:

ctx = SSL.Context(SSL.TLSv1_METHOD)

ctx = SSL.Context(SSL.TLSv1_2_METHOD)

Which, to keep it short and sweet, is basically bumping up TLSv1 (their default) to TLSv1.2 (which should be the working one).

Anyway, hopefully this will help a few out, although I’m actually hoping to see if someone has some feedback, pointers, or even a fix which would help me out a lot!

Goes to say that I installed the latest version of impacket today, following the instructions on GitHub. I’m running various versions of python (2.7, 3, 3.8 and 3.9) with failed results on the latest Linux Mint distro (I agree, maybe I should be on ParrotOS or even Kali for this).

Anyway, thanks and regards!


thanks it did the trick for me too !

An “internal error” message can indicate a wide variety of issues, and the steps to fix it will depend on the specific error and context. Here are some general steps you can take to try to fix an internal error:

Restart the program or system: Sometimes an internal error can be caused by a temporary issue that can be resolved by simply restarting the program or system.

Check for updates: An internal error could be caused by a bug in the software that has been fixed in a more recent version. Check for any available updates and install them if necessary.

Check system resources: An internal error could be caused by a lack of available system resources such as memory or CPU. Check the system resources and make sure that there is enough available for the program to run properly.

Check for conflicting software: An internal error could be caused by conflicts with other software running on the system. Try closing other programs and see if the error goes away.

Rachel Gomez

Did you ever get this to work? Running into the same issue unfortunately