Skip to content
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

ImportError: ERROR: fail to load the dynamic library (ROP) #1064

Closed
bannsec opened this issue Nov 4, 2017 · 3 comments
Closed

ImportError: ERROR: fail to load the dynamic library (ROP) #1064

bannsec opened this issue Nov 4, 2017 · 3 comments

Comments

@bannsec
Copy link
Contributor

bannsec commented Nov 4, 2017

Getting the following error when trying to instantiate a ROP object on a base ELF class with the latest pwntools (3.10.0)

In [1]: rop = ROP(elf)
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-b73050b43606> in <module>()
----> 1 rop = ROP(elf)

/home/user/.virtualenvs/formatStringExploiter/local/lib/python2.7/site-packages/pwnlib/rop/rop.pyc in __init__(self, elfs, base, **kwargs)
    396             elfs(list): List of :class:`.ELF` objects for mining
    397         """
--> 398         import ropgadget
    399
    400         # Permit singular ROP(elf) vs ROP([elf])

/home/user/.virtualenvs/formatStringExploiter/local/lib/python2.7/site-packages/ropgadget/__init__.pyc in <module>()
     12
     13 import ropgadget.args
---> 14 import ropgadget.binary
     15 import ropgadget.core
     16 import ropgadget.gadgets

/home/user/.virtualenvs/formatStringExploiter/local/lib/python2.7/site-packages/ropgadget/binary.py in <module>()
     11 ##  (at your option) any later version.
     12
---> 13 from ropgadget.loaders.elf       import *
     14 from ropgadget.loaders.pe        import *
     15 from ropgadget.loaders.raw       import *

/home/user/.virtualenvs/formatStringExploiter/local/lib/python2.7/site-packages/ropgadget/loaders/__init__.py in <module>()
     11 ##  (at your option) any later version.
     12
---> 13 import ropgadget.loaders.elf
     14 import ropgadget.loaders.macho
     15 import ropgadget.loaders.pe

/home/user/.virtualenvs/formatStringExploiter/local/lib/python2.7/site-packages/ropgadget/loaders/elf.py in <module>()
     11 ##  (at your option) any later version.
     12
---> 13 from capstone   import *
     14 from ctypes     import *
     15 from struct     import unpack
/home/user/.virtualenvs/formatStringExploiter/local/lib/python2.7/site-packages/capstone/__init__.py in <module>()
    228             pass
    229     if _found == False:
--> 230         raise ImportError("ERROR: fail to load the dynamic library.")
    231
    232

ImportError: ERROR: fail to load the dynamic library.

Looking into the file, it appears that capstone is unable to find it's .so file. Having run into this before, I checked and found that pwntools is using capstone==3.0.4 on my install.

I resolved the issue manually on my install by doing pip install capstone==3.0.5rc2 as the 3.0.5 version appears to come with the .so file correctly.

@firmianay
Copy link

It seems that setup.py didn't specify capstone's version at installation time

@bannsec
Copy link
Contributor Author

bannsec commented Nov 27, 2017

Appears to be related to #971

@zachriggle
Copy link
Member

Yes, per #971, Capstone's default installation mechanism is broken.

I'd recommend installing Capstone manually. @bannsec said (on capstone-engine/capstone#916) that installing 3.0.5rc2 explicitly should fix the installation issue.

We do not require any specific version as we don't actually rely on any version's features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants