Skip to content

Fixed impacket secretsdump.py KeyError #490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 21, 2025

Conversation

lap1nou
Copy link
Contributor

@lap1nou lap1nou commented Mar 31, 2025

Description

After issuing the command:

secretsdump.py SCCM.lab/sccm-account-da:'SCCM_D@-ftw_'@10.2.10.40

I was met with an error:

[*] Stopping service RemoteRegistry
Exception ignored in: <function Registry.__del__ at 0x7faef466bce0>
Traceback (most recent call last):
  File "/root/.local/share/pipx/venvs/impacket/lib/python3.11/site-packages/impacket/winregistry.py", line 185, in __del__
  File "/root/.local/share/pipx/venvs/impacket/lib/python3.11/site-packages/impacket/winregistry.py", line 182, in close
  File "/root/.local/share/pipx/venvs/impacket/lib/python3.11/site-packages/impacket/examples/secretsdump.py", line 360, in close
  File "/root/.local/share/pipx/venvs/impacket/lib/python3.11/site-packages/impacket/smbconnection.py", line 605, in closeFile
  File "/root/.local/share/pipx/venvs/impacket/lib/python3.11/site-packages/impacket/smb3.py", line 1356, in close
  File "/root/.local/share/pipx/venvs/impacket/lib/python3.11/site-packages/impacket/smb3.py", line 473, in sendSMB
  File "/root/.local/share/pipx/venvs/impacket/lib/python3.11/site-packages/impacket/smb3.py", line 442, in signSMB
  File "/root/.local/share/pipx/venvs/impacket/lib/python3.11/site-packages/impacket/crypto.py", line 150, in AES_CMAC
  File "/root/.pyenv/versions/3.11.11/lib/python3.11/site-packages/Cryptodome/Cipher/AES.py", line 228, in new
KeyError: 'Cryptodome.Cipher.AES'
Exception ignored in: <function Registry.__del__ at 0x7faef466bce0>
Traceback (most recent call last):
  File "/root/.local/share/pipx/venvs/impacket/lib/python3.11/site-packages/impacket/winregistry.py", line 185, in __del__
  File "/root/.local/share/pipx/venvs/impacket/lib/python3.11/site-packages/impacket/winregistry.py", line 182, in close
  File "/root/.local/share/pipx/venvs/impacket/lib/python3.11/site-packages/impacket/examples/secretsdump.py", line 360, in close
  File "/root/.local/share/pipx/venvs/impacket/lib/python3.11/site-packages/impacket/smbconnection.py", line 605, in closeFile
  File "/root/.local/share/pipx/venvs/impacket/lib/python3.11/site-packages/impacket/smb3.py", line 1356, in close
  File "/root/.local/share/pipx/venvs/impacket/lib/python3.11/site-packages/impacket/smb3.py", line 473, in sendSMB
  File "/root/.local/share/pipx/venvs/impacket/lib/python3.11/site-packages/impacket/smb3.py", line 442, in signSMB
  File "/root/.local/share/pipx/venvs/impacket/lib/python3.11/site-packages/impacket/crypto.py", line 150, in AES_CMAC
  File "/root/.pyenv/versions/3.11.11/lib/python3.11/site-packages/Cryptodome/Cipher/AES.py", line 228, in new
KeyError: 'Cryptodome.Cipher.AES'

It seems to be related to: fortra/impacket#1634

This PR aims to fix that, after injecting Pycryptodome the secretsdump now seems to work fine.

Related issues

N / A

Point of attention

N / A

@qu35t-code qu35t-code self-assigned this Mar 31, 2025
@qu35t-code qu35t-code added the bugfix It's a bird, it's a plane label Mar 31, 2025
@ShutdownRepo ShutdownRepo merged commit c51a20d into ThePorgs:dev Apr 21, 2025
40 of 42 checks passed
@ShutdownRepo ShutdownRepo mentioned this pull request Jun 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix It's a bird, it's a plane
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants