skelsec/pypykatz

Kali Linux error LibraryNotFoundError: Error detecting the version of libcrypto

chikamobina opened this issue · 10 comments

└─$ pypykatz
Traceback (most recent call last):
File "/usr/local/bin/pypykatz", line 33, in
sys.exit(load_entry_point('pypykatz==0.6.9', 'console_scripts', 'pypykatz')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pypykatz-0.6.9-py3.11.egg/pypykatz/main.py", line 17, in main
File "/usr/local/lib/python3.11/dist-packages/pypykatz-0.6.9-py3.11.egg/pypykatz/kerberos/cmdhelper.py", line 19, in
File "/usr/local/lib/python3.11/dist-packages/pypykatz-0.6.9-py3.11.egg/pypykatz/kerberos/kerberos.py", line 7, in
File "/home/kali/.local/lib/python3.11/site-packages/minikerberos/security.py", line 11, in
from minikerberos.aioclient import AIOKerberosClient
File "/home/kali/.local/lib/python3.11/site-packages/minikerberos/aioclient.py", line 31, in
from minikerberos.common.creds import KerberosCredential
File "/home/kali/.local/lib/python3.11/site-packages/minikerberos/common/creds.py", line 24, in
from oscrypto.asymmetric import rsa_pkcs1v15_sign, load_private_key
File "/usr/local/lib/python3.11/dist-packages/oscrypto-1.3.0-py3.11.egg/oscrypto/asymmetric.py", line 19, in
from ._asymmetric import _unwrap_private_key_info
File "/usr/local/lib/python3.11/dist-packages/oscrypto-1.3.0-py3.11.egg/oscrypto/_asymmetric.py", line 27, in
from .kdf import pbkdf1, pbkdf2, pkcs12_kdf
File "/usr/local/lib/python3.11/dist-packages/oscrypto-1.3.0-py3.11.egg/oscrypto/kdf.py", line 9, in
from .util import rand_bytes
File "/usr/local/lib/python3.11/dist-packages/oscrypto-1.3.0-py3.11.egg/oscrypto/util.py", line 14, in
from ._openssl.util import rand_bytes
File "/usr/local/lib/python3.11/dist-packages/oscrypto-1.3.0-py3.11.egg/oscrypto/_openssl/util.py", line 6, in
from ._libcrypto import libcrypto, libcrypto_version_info, handle_openssl_error
File "/usr/local/lib/python3.11/dist-packages/oscrypto-1.3.0-py3.11.egg/oscrypto/_openssl/_libcrypto.py", line 9, in
from ._libcrypto_cffi import (
File "/usr/local/lib/python3.11/dist-packages/oscrypto-1.3.0-py3.11.egg/oscrypto/_openssl/_libcrypto_cffi.py", line 44, in
raise LibraryNotFoundError('Error detecting the version of libcrypto')
oscrypto.errors.LibraryNotFoundError: Error detecting the version of libcrypto

What doesn’t work for me is the version installed via apt, not the version installed via pip, nothing at all. Please help me solve this problem.

The issue you're seeing is that oscrypto has some weird error on Kali. To fix it you can update oscrypto by downloading it from github here and install it.

Installed it, now it gives this error. I installed all the dependencies.

Traceback (most recent call last):
File "/usr/local/bin/pypykatz", line 33, in
sys.exit(load_entry_point('pypykatz==0.6.9', 'console_scripts', 'pypykatz')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pypykatz-0.6.9-py3.11.egg/pypykatz/main.py", line 17, in main
File "/usr/local/lib/python3.11/dist-packages/pypykatz-0.6.9-py3.11.egg/pypykatz/kerberos/cmdhelper.py", line 19, in
File "/usr/local/lib/python3.11/dist-packages/pypykatz-0.6.9-py3.11.egg/pypykatz/kerberos/kerberos.py", line 7, in
ImportError: cannot import name 'krb5userenum' from 'minikerberos.security' (/home/kali/.local/lib/python3.11/site-packages/minikerberos/security.py)

Can you please tell me? How to solve this now? Thanks a lot

It seems to me that everyone who uses Kali is now faced with this, because all my friends have the same thing. Same errors

#117 If this doesn't help, I tried setting 0.3.5

This worked for me, first uninstall: python -m pip uninstall oscrypto -y, then install this version: python -m pip install --force-reinstall https://github.com/wbond/oscrypto/archive/d5f3437ed24257895ae1edd9e503cfb352e635a8.zip

This worked for me, first uninstall: python -m pip uninstall oscrypto -y, then install this version: python -m pip install --force-reinstall https://github.com/wbond/oscrypto/archive/d5f3437ed24257895ae1edd9e503cfb352e635a8.zip

Traceback (most recent call last):
File "/usr/local/bin/pypykatz", line 33, in
sys.exit(load_entry_point('pypykatz==0.6.9', 'console_scripts', 'pypykatz')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pypykatz-0.6.9-py3.11.egg/pypykatz/main.py", line 17, in main
File "/usr/local/lib/python3.11/dist-packages/pypykatz-0.6.9-py3.11.egg/pypykatz/kerberos/cmdhelper.py", line 19, in
File "/usr/local/lib/python3.11/dist-packages/pypykatz-0.6.9-py3.11.egg/pypykatz/kerberos/kerberos.py", line 7, in
ImportError: cannot import name 'krb5userenum' from 'minikerberos.security' (/home/kali/.local/lib/python3.11/site-packages/minikerberos/security.py)

I fixed it, for some reason I had 2 versions of minikerberos. I installed the latest one and removed the old one.

S-071 commented

This issue should probably be reopened since it still exists in the currently released version of oscrypto (1.3.0): wbond/oscrypto#78

This will continue to break pypykatz installs relying on the oscrypto pypi package for anyone using an openssl version where the major/minor/patch versions contain multiple digits, such as 3.0.10. There is currently no estimate for when this will be fixed upstream.

This is an issue of the minikerberos dependency, also from @skelsec. The oscrypto maintainer is dragging his feet a bit (completely understandable for a hobby project), but would it be feasible to switch to the better maintained cryptography package? Note that this is already a dependency of 2nd degree because of asysocks, so it would be quite elegant to get rid of oscrypto. Lots of packages are depending on minikerberos which are now effectively broken.

It would already help if the oscrypt imports would be moved to the function where they are needed so that downstream projects who don't need the PKINIT object won't be affected by this.