byt3bl33d3r / CrackMapExec

A swiss army knife for pentesting networks
BSD 2-Clause "Simplified" License
8.37k stars 1.64k forks source link

Broken in Kali Linux 2022.1 #541

Closed leebaird closed 2 years ago

leebaird commented 2 years ago

Describe the bug Tool is broken in the latest version of Kali Linux 2022.1.

To Reproduce root@kali:~# crackmapexec [] First time use detected [] Creating home directory structure [] Creating default workspace [] Initializing LDAP protocol database [] Initializing SSH protocol database [] Initializing SMB protocol database [] Initializing MSSQL protocol database [] Initializing WINRM protocol database [] Copying default configuration file [] Generating SSL certificate Traceback (most recent call last): File "/usr/bin/crackmapexec", line 8, in sys.exit(main()) File "/usr/lib/python3/dist-packages/cme/crackmapexec.py", line 114, in main args = gen_cli_args() File "/usr/lib/python3/dist-packages/cme/cli.py", line 71, in gen_cli_args protocol_object = p_loader.load_protocol(protocols[protocol]['path']) File "/usr/lib/python3/dist-packages/cme/loaders/protocol_loader.py", line 12, in load_protocol protocol = imp.load_source('protocol', protocol_path) File "/usr/lib/python3.9/imp.py", line 169, in load_source module = _exec(spec, sys.modules[name]) File "", line 613, in _exec File "", line 850, in exec_module File "", line 228, in _call_with_frames_removed File "/usr/lib/python3/dist-packages/cme/protocols/ldap.py", line 12, in from cme.protocols.ldap.kerberos import KerberosAttacks File "/usr/lib/python3/dist-packages/cme/protocols/ldap/kerberos.py", line 6, in from impacket.krb5.asn1 import TGS_REP, AS_REQ, KERB_PA_PAC_REQUEST, KRB_ERROR, AS_REP, seq_set, seq_set_iter File "/usr/local/lib/python3.9/dist-packages/impacket/krb5/asn1.py", line 36, in import constants ModuleNotFoundError: No module named 'constants'

root@kali:~# pip3 install constants
Collecting constants Downloading constants-0.6.0.tar.gz (5.1 kB) Preparing metadata (setup.py) ... done Building wheels for collected packages: constants Building wheel for constants (setup.py) ... done Created wheel for constants: filename=constants-0.6.0-py3-none-any.whl size=5473 sha256=4571e2fdd861dfd802d54d3b03ed32d149267ba120244bc64b20602b3f8eeaa2 Stored in directory: /root/.cache/pip/wheels/2c/f8/73/4eea26e0f7d0d170a29e16568c6d2d09bbbbdd169a42637afe Successfully built constants Installing collected packages: constants Successfully installed constants-0.6.0 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

root@kali:~# updatedb

root@kali:~# crackmapexec Traceback (most recent call last): File "/usr/bin/crackmapexec", line 8, in sys.exit(main()) File "/usr/lib/python3/dist-packages/cme/crackmapexec.py", line 114, in main args = gen_cli_args() File "/usr/lib/python3/dist-packages/cme/cli.py", line 71, in gen_cli_args protocol_object = p_loader.load_protocol(protocols[protocol]['path']) File "/usr/lib/python3/dist-packages/cme/loaders/protocol_loader.py", line 12, in load_protocol protocol = imp.load_source('protocol', protocol_path) File "/usr/lib/python3.9/imp.py", line 169, in load_source module = _exec(spec, sys.modules[name]) File "", line 613, in _exec File "", line 850, in exec_module File "", line 228, in _call_with_frames_removed File "/usr/lib/python3/dist-packages/cme/protocols/ldap.py", line 12, in from cme.protocols.ldap.kerberos import KerberosAttacks File "/usr/lib/python3/dist-packages/cme/protocols/ldap/kerberos.py", line 6, in from impacket.krb5.asn1 import TGS_REP, AS_REQ, KERB_PA_PAC_REQUEST, KRB_ERROR, AS_REP, seq_set, seq_set_iter File "/usr/local/lib/python3.9/dist-packages/impacket/krb5/asn1.py", line 173, in class Ticket(univ.Sequence): File "/usr/local/lib/python3.9/dist-packages/impacket/krb5/asn1.py", line 174, in Ticket tagSet = _application_tag(constants.ApplicationTagNumbers.Ticket.value) AttributeError: module 'constants' has no attribute 'ApplicationTagNumbers'

Crackmapexec info

L1ghtn1ng commented 2 years ago

I have opened a bug for the missing python module on the kali gitlab for it as that is a packaging issue

mpgn commented 2 years ago

You sure your kali is not broken ? It's working fine on my side

leebaird commented 2 years ago

I just spun up a clean VM and tested and it works. Must have been a conflict/permission issue with another tool. Closing.

sbrun commented 2 years ago

Hello, I'm one of the package maintainers in Kali. I confirmed it was an issue with the user installation: the module impacket used by crackmapexec was installed in /usr/local. In Kali we don't install impacket in /usr/local but it /usr/lib. But the Python searches first in /usr/local/lib/python3 before searching in /usr/lib/python3/dist-packages. Removing the Python module impacket from /usr/local would have fixed the issue.