Starting Point foothold mssqlclient.py

Hello everyone,
I’m new at HTB and i have a problem with mssqlclient.py
When i’m running the command :
“sudo python3 mssqlclient.py ARCHETYPE\sql_svc@10.10.10.27 -windows-auth”

the command return this :

Impacket v0.9.20 - Copyright 2019 SecureAuth Corporation

Password:
[*] Encryption required, switching to TLS
[-] Missing required parameter ‘digestmod’.

i’ve tried to use the mssqlclient with python 3.7 and 2.7 but no one works

This is so sad i’m stuck in the tutorial :joy:

Thank you in advance for your answer.

1 Like

Try the same command but include the password in the login string
ARCHETYPE/sql_svc:‘thepassword’@host

The following command worked for me a couple of weeks ago when I did it:

python3 mssqlclient.py ARCHETYPE/sql_svc@10.10.10.27 -windows-auth

I am running the same version of impacket - v0.9.20, git commit number ending in a6620 (27th of March) and a Kali VM image that I downloaded last month from the Offensive Security website.

2 Likes

I am also running into this issue, I have located the password but mssqlclient wont accept the password.

kali@kali:~/impacket/examples$ mssqlclient.py ARCHETYPE\sql_svc@10.10.10.27 -windows-auth
Impacket v0.9.22.dev1+20200327.103853.7e505892 - Copyright 2020 SecureAuth Corporation

Password:
[*] Encryption required, switching to TLS
[-] ERROR(ARCHETYPE): Line 1: Login failed for user ‘ARCHETYPE\Guest’.

Hi @FaleFrost ,
probably your problem is the ‘'’, note @tasdonya 's command and compare it with yours

I’m having the problems with this step as well…

I enter the command as seen here: python3 mssqlclient.py ARCHETYPE/sql_svc@10.10.10.27 -windows-auth

Then it asks me for the password.

The password in the dtsConfig file shows “password=M3g4c0rp123”

However, when I type that in, I get the following error:

[*] Encryption required, switching to TLS
[-] Missing required parameter ‘digestmod’.

No idea what that means or how to work around it…

Can anyone help me out with this ^^^^??

I think in your first command the “/” was backwards (Ie;"").
It should be: python3 mssqlclient.py ARCHETYPE/sql_svc@10.10.10.27 -windows-auth .
For quantuntheory, the password should not have the word “password=” in it. Just the password itself.

I restarted my system and I still get the same error(s)

python3 mssqlclient.py ARCHETYPE/sql_svc@10.10.10.27 -windows-auth
Impacket v0.9.20 - Copyright 2019 SecureAuth Corporation

Password: M3g4c0rp123

[*] Encryption required, switching to TLS
[-] Missing required parameter ‘digestmod’.

@quantumtheory python3 mssqlclient.py was not working for my I can’t remember why, but I downloaded the tool from impacket’s github mentioned in the walk-through and run it /impacket/examples$ mssqlclient.py...

@irealmar That doesn’t work either. Whether I run the straight command or with sudo

examples$ mssqlclient.py ARCHETYPE/sql_svc@10.10.10.27 -windows-auth
bash: mssqlclient.py: command not found

There’s too many people having the same issue, and it makes no sense when others are successfully passing this step… so what is the difference between the 2 people?

I’m using the updated Kali Linux 2020 (updated/upgraded a couple days ago when I started hackthebox challenges)

I’ve tried Python 2 and 3 - same errors. If I enter the command without the “python” prefix, I get an error that says “mssqlclient.py: command not found”

tried all commands with and without sudo, same errors regardless.

It’s pretty frustrating. I understand part of “hacking” is figuring things out - but I’m completely lost on this. I’m doing the exact same things everyone who has passed this step has done, yet I’m getting errors that wont allow me to proceed.

Type your comment> @quantumtheory said:

@irealmar That doesn’t work either. Whether I run the straight command or with sudo

examples$ mssqlclient.py ARCHETYPE/sql_svc@10.10.10.27 -windows-auth
bash: mssqlclient.py: command not found

Try “python3 mssqlclient.py ARCHETYPE/sql_svc@10.10.10.27 -windows-auth”

@quantumtheory said:

I restarted my system and I still get the same error(s)

python3 mssqlclient.py ARCHETYPE/sql_svc@10.10.10.27 -windows-auth
Impacket v0.9.20 - Copyright 2019 SecureAuth Corporation

Password: M3g4c0rp123

[*] Encryption required, switching to TLS
[-] Missing required parameter ‘digestmod’.

you probably downloaded impacket, but didn’t install it. On kali 2020.1b there’s the ‘problem’ that pip isn’t installed, but pip3 is… so where it says in the github “pip install .”, do in stead “pip3 install .”… normally this should fix your problem.

Type your comment> @gnothiseauton said:

@quantumtheory said:

I restarted my system and I still get the same error(s)

python3 mssqlclient.py ARCHETYPE/sql_svc@10.10.10.27 -windows-auth
Impacket v0.9.20 - Copyright 2019 SecureAuth Corporation

Password: M3g4c0rp123

[*] Encryption required, switching to TLS
[-] Missing required parameter ‘digestmod’.

you probably downloaded impacket, but didn’t install it. On kali 2020.1b there’s the ‘problem’ that pip isn’t installed, but pip3 is… so where it says in the github “pip install .”, do in stead “pip3 install .”… normally this should fix your problem.

I have run python scripts before, therefore I was confident everything was installed correctly. However, I did have to install python3-pip…

With that said, I now get this error:
kali@kali:~/Downloads/Impacket$ sudo pip3 install setup.py
[sudo] password for kali:
ERROR: Could not find a version that satisfies the requirement setup.py (from versions: none)
ERROR: No matching distribution found for setup.py

So instead, I enter command “python3 setup.py install”

and it seems to have installed everything in /usr/local.bin… However it is still not working.

I enter the command “mssqlclient.py ARCHETYPE/sql_svc@10.10.10.27 -windows-auth”

I am then asked for the password. I type the password in, and nothing happens.
Just a solid cursor for a few minutes and then I get this:

Traceback (most recent call last):
File “/usr/local/bin/mssqlclient.py”, line 4, in
import(‘pkg_resources’).run_script(‘impacket==0.9.22.dev1’, ‘mssqlclient.py’)
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 666, in run_script
self.require(requires)[0].run_script(script_name, ns)
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 1462, in run_script
exec(code, namespace, namespace)
File “/usr/local/lib/python3.8/dist-packages/impacket-0.9.22.dev1-py3.8.egg/EGG-INFO/scripts/mssqlclient.py”, line 173, in
ms_sql.connect()
File “/usr/local/lib/python3.8/dist-packages/impacket-0.9.22.dev1-py3.8.egg/impacket/tds.py”, line 532, in connect
sock.connect(sa)
TimeoutError: [Errno 110] Connection timed out

With that said, I now get this error:
kali@kali:~/Downloads/Impacket$ sudo pip3 install setup.py
[sudo] password for kali:
ERROR: Could not find a version that satisfies the requirement setup.py (from versions: none)
ERROR: No matching distribution found for setup.py

So instead, I enter command “python3 setup.py install”

and it seems to have installed everything in /usr/local.bin… However it is still not working.

I enter the command “mssqlclient.py ARCHETYPE/sql_svc@10.10.10.27 -windows-auth”

I am then asked for the password. I type the password in, and nothing happens.
Just a solid cursor for a few minutes and then I get this:

I’ll leave you my installation notes of impacket on kali 2020.1b (if you already did parts of them, then just skip them):

** IMPACKET**
A collection of python classes for working with network protocols

INSTALL
• Needs: python pip
• “sudo apt install python3-venv python3-pip” - installs pip for python3
• go to ‘/opt’ folder
• (get git clone url from GitHub - fortra/impacket: Impacket is a collection of Python classes for working with network protocols.)
• “sudo git clone GitHub - fortra/impacket: Impacket is a collection of Python classes for working with network protocols.” - to clone
• “cd impacket” - to go into the directory
• “pip3 install .”

afterwards, go to the examples folder and rund the command “python3 mssqlclient.py ARCHETYPE/sql_svc@10.10.10.27 -windows-auth”

Also: keep in mind, you just want to connect to an mssql server, and mssqlclient is just one of many ways, if this tool doesn’t work, challenge yourself to find another tool that doesn’t work. Always good to have alternate tools for the same job.

Either way, follow the exact descriptions I left you and you should be good to go. If it doesn’t work, let me know and I’ll see what I can do. Best of luck!

Type your comment> @gnothiseauton said:

With that said, I now get this error:
kali@kali:~/Downloads/Impacket$ sudo pip3 install setup.py
[sudo] password for kali:
ERROR: Could not find a version that satisfies the requirement setup.py (from versions: none)
ERROR: No matching distribution found for setup.py

So instead, I enter command “python3 setup.py install”

and it seems to have installed everything in /usr/local.bin… However it is still not working.

I enter the command “mssqlclient.py ARCHETYPE/sql_svc@10.10.10.27 -windows-auth”

I am then asked for the password. I type the password in, and nothing happens.
Just a solid cursor for a few minutes and then I get this:

I’ll leave you my installation notes of impacket on kali 2020.1b (if you already did parts of them, then just skip them):

** IMPACKET**
A collection of python classes for working with network protocols
GitHub - fortra/impacket: Impacket is a collection of Python classes for working with network protocols.

INSTALL
• Needs: python pip
• “sudo apt install python3-venv python3-pip” - installs pip for python3
• go to ‘/opt’ folder
• (get git clone url from GitHub - fortra/impacket: Impacket is a collection of Python classes for working with network protocols.)
• “sudo git clone GitHub - fortra/impacket: Impacket is a collection of Python classes for working with network protocols.” - to clone
• “cd impacket” - to go into the directory
• “pip3 install .”

afterwards, go to the examples folder and rund the command “python3 mssqlclient.py ARCHETYPE/sql_svc@10.10.10.27 -windows-auth”

Also: keep in mind, you just want to connect to an mssql server, and mssqlclient is just one of many ways, if this tool doesn’t work, challenge yourself to find another tool that doesn’t work. Always good to have alternate tools for the same job.

Either way, follow the exact descriptions I left you and you should be good to go. If it doesn’t work, let me know and I’ll see what I can do. Best of luck!

Thank you for the detailed reply.

I did everything you said, everything downloaded/installed as intended. However, come to the last command “python3 mssqlclient.py ARCHETYPE/sql_svc@10.10.10.27 -windows-auth” - I still get the timed out error :-\

Traceback (most recent call last):
File “mssqlclient.py”, line 173, in
ms_sql.connect()
File “/home/kali/.local/lib/python3.8/site-packages/impacket/tds.py”, line 532, in connect
sock.connect(sa)
TimeoutError: [Errno 110] Connection timed out

Not familiar enough to determine why I would be timing out regarding those errors…

I can try to find a different tool, but at the same time would like to learn why this one doesn’t work for me

Thank you for the detailed reply.

I did everything you said, everything downloaded/installed as intended. However, come to the last command “python3 mssqlclient.py ARCHETYPE/sql_svc@10.10.10.27 -windows-auth” - I still get the timed out error :-\

Traceback (most recent call last):
File “mssqlclient.py”, line 173, in
ms_sql.connect()
File “/home/kali/.local/lib/python3.8/site-packages/impacket/tds.py”, line 532, in connect
sock.connect(sa)
TimeoutError: [Errno 110] Connection timed out

Not familiar enough to determine why I would be timing out regarding those errors…

I can try to find a different tool, but at the same time would like to learn why this one doesn’t work for me

It’s good to have the spirit to try to find why things don’t work.
If your install went well and you get a timeout, I’d try to ping the machine, so “ping 10.10.10.27”… it might be that your connection was lost, or that you didn’t start the VPN, or that it can’t connect or whatever.
Timeout is more likely to be a lower-layer problem than the software layer. Try to ping the machine, if you get a ping, try to nmap just the port you want to connect to, I believe it was port 445, no? (so “nmap -p445 10.10.10.27”). If either one fails, you have connection issues, not software issues.
If both work, you should be able to connect, can’t see why.

Try it and let me know. Best of luck.

I updated kali and redownloaded the .ovpn file - and now all seems to have worked…

A lot of people were getting stuck on this particular step - so thanks again for your detailed replies as it doesn’t only help me, but I know its going to help so many others.

Again - I greatly appreciate your time and efforts to clear this step up!

Thanks for taking the time to express your appreciation. Glad to hear you got it fixed! Go kick some ■■■ :slight_smile: