impacket icon indicating copy to clipboard operation
impacket copied to clipboard

KeyError: 'Cryptodome.Cipher.AES'

Open fsacer opened this issue 2 years ago • 2 comments

Configuration

impacket version: 0.12.0 Python version: 3.9 Target OS: Parrot OS

Debug Output With Command String

i.e.
secretsdump.py domain/user@ip -outputfile test

[*] Cleaning up... 
[*] Stopping service RemoteRegistry
[-] SCMR SessionError: code: 0x41b - ERROR_DEPENDENT_SERVICES_RUNNING - A stop control has been sent to a service that other running services are dependent on.
[*] Cleaning up... 
[*] Stopping service RemoteRegistry
Exception ignored in: <function Registry.__del__ at 0x7fa9a60e4f70>
Traceback (most recent call last):
  File "/opt/impacket-fortra/impacket/env-fi/lib/python3.9/site-packages/impacket-0.12.0.dev1+20231015.203043.419e6f24-py3.9.egg/impacket/winregistry.py", line 182, in __del__
  File "/opt/impacket-fortra/impacket/env-fi/lib/python3.9/site-packages/impacket-0.12.0.dev1+20231015.203043.419e6f24-py3.9.egg/impacket/winregistry.py", line 179, in close
  File "/opt/impacket-fortra/impacket/env-fi/lib/python3.9/site-packages/impacket-0.12.0.dev1+20231015.203043.419e6f24-py3.9.egg/impacket/examples/secretsdump.py", line 358, in close
  File "/opt/impacket-fortra/impacket/env-fi/lib/python3.9/site-packages/impacket-0.12.0.dev1+20231015.203043.419e6f24-py3.9.egg/impacket/smbconnection.py", line 603, in closeFile
  File "/opt/impacket-fortra/impacket/env-fi/lib/python3.9/site-packages/impacket-0.12.0.dev1+20231015.203043.419e6f24-py3.9.egg/impacket/smb3.py", line 1305, in close
  File "/opt/impacket-fortra/impacket/env-fi/lib/python3.9/site-packages/impacket-0.12.0.dev1+20231015.203043.419e6f24-py3.9.egg/impacket/smb3.py", line 443, in sendSMB
  File "/opt/impacket-fortra/impacket/env-fi/lib/python3.9/site-packages/pycryptodomex-3.19.0-py3.9-linux-x86_64.egg/Cryptodome/Cipher/AES.py", line 228, in new
KeyError: 'Cryptodome.Cipher.AES'
Exception ignored in: <function Registry.__del__ at 0x7fa9a60e4f70>
Traceback (most recent call last):
  File "/opt/impacket-fortra/impacket/env-fi/lib/python3.9/site-packages/impacket-0.12.0.dev1+20231015.203043.419e6f24-py3.9.egg/impacket/winregistry.py", line 182, in __del__
  File "/opt/impacket-fortra/impacket/env-fi/lib/python3.9/site-packages/impacket-0.12.0.dev1+20231015.203043.419e6f24-py3.9.egg/impacket/winregistry.py", line 179, in close
  File "/opt/impacket-fortra/impacket/env-fi/lib/python3.9/site-packages/impacket-0.12.0.dev1+20231015.203043.419e6f24-py3.9.egg/impacket/examples/secretsdump.py", line 358, in close
  File "/opt/impacket-fortra/impacket/env-fi/lib/python3.9/site-packages/impacket-0.12.0.dev1+20231015.203043.419e6f24-py3.9.egg/impacket/smbconnection.py", line 603, in closeFile
  File "/opt/impacket-fortra/impacket/env-fi/lib/python3.9/site-packages/impacket-0.12.0.dev1+20231015.203043.419e6f24-py3.9.egg/impacket/smb3.py", line 1305, in close
  File "/opt/impacket-fortra/impacket/env-fi/lib/python3.9/site-packages/impacket-0.12.0.dev1+20231015.203043.419e6f24-py3.9.egg/impacket/smb3.py", line 443, in sendSMB
  File "/opt/impacket-fortra/impacket/env-fi/lib/python3.9/site-packages/pycryptodomex-3.19.0-py3.9-linux-x86_64.egg/Cryptodome/Cipher/AES.py", line 228, in new
KeyError: 'Cryptodome.Cipher.AES'

PCAP

/

Additional context

Unexpected stack trace with the fresh install in the venv. The target machine was a domain controller with Windows 2016.

fsacer avatar Oct 18 '23 07:10 fsacer

Just throwing my 2c in here too, I also have had this error. But with a slightly different setup.

impacket version: 0.11.0 Python version: 3.11 User OS: Windows 10 Target OS: Windows Server 2012 R2 DC

Debug output with command string

secretsdump.py domain/user@ip >> c:(Location)

Exception ignored in: <function Registry.__del__ at 0x000002606C888F40>
Traceback (most recent call last):
  File "UserDir\AppData\Local\Programs\Python\Python311\Lib\site-packages\impacket\winregistry.py", line 182, in __del__
  File "UserDir\AppData\Local\Programs\Python\Python311\Lib\site-packages\impacket\winregistry.py", line 179, in close
  File "UserDir\AppData\Local\Programs\Python\Python311\Lib\site-packages\impacket\examples\secretsdump.py", line 358, in close
  File "UserDir\AppData\Local\Programs\Python\Python311\Lib\site-packages\impacket\smbconnection.py", line 603, in closeFile
  File "UserDir\AppData\Local\Programs\Python\Python311\Lib\site-packages\impacket\smb3.py", line 1305, in close
  File "UserDir\AppData\Local\Programs\Python\Python311\Lib\site-packages\impacket\smb3.py", line 423, in sendSMB
  File "UserDir\AppData\Local\Programs\Python\Python311\Lib\site-packages\impacket\smb3.py", line 392, in signSMB
  File "UserDir\AppData\Local\Programs\Python\Python311\Lib\site-packages\impacket\crypto.py", line 148, in AES_CMAC
  File "UserDir\AppData\Local\Programs\Python\Python311\Lib\site-packages\Cryptodome\Cipher\AES.py", line 228, in new
KeyError: 'Cryptodome.Cipher.AES'
Exception ignored in: <function Registry.__del__ at 0x000002606C888F40>
Traceback (most recent call last):
  File "UserDir\AppData\Local\Programs\Python\Python311\Lib\site-packages\impacket\winregistry.py", line 182, in __del__
  File "UserDir\AppData\Local\Programs\Python\Python311\Lib\site-packages\impacket\winregistry.py", line 179, in close
  File "UserDir\AppData\Local\Programs\Python\Python311\Lib\site-packages\impacket\examples\secretsdump.py", line 358, in close
  File "UserDir\AppData\Local\Programs\Python\Python311\Lib\site-packages\impacket\smbconnection.py", line 603, in closeFile
  File "UserDir\AppData\Local\Programs\Python\Python311\Lib\site-packages\impacket\smb3.py", line 1305, in close
  File "UserDir\AppData\Local\Programs\Python\Python311\Lib\site-packages\impacket\smb3.py", line 423, in sendSMB
  File "UserDir\AppData\Local\Programs\Python\Python311\Lib\site-packages\impacket\smb3.py", line 392, in signSMB
  File "UserDir\AppData\Local\Programs\Python\Python311\Lib\site-packages\impacket\crypto.py", line 148, in AES_CMAC
  File "UserDir\AppData\Local\Programs\Python\Python311\Lib\site-packages\Cryptodome\Cipher\AES.py", line 228, in new
KeyError: 'Cryptodome.Cipher.AES'

FX1-7 avatar Mar 21 '24 17:03 FX1-7

What fixed it more me was:

Source your venv: source ~/.local/pipx/venvs/impacket/bin/activate

And then (re)-install pycryptodome: pip install --force-reinstall pycryptodome

YugoCode avatar May 16 '24 10:05 YugoCode