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

manticore cannot read wasm module that contains a function table import #1802

Closed
romits800 opened this issue Sep 18, 2020 · 0 comments · Fixed by #1803
Closed

manticore cannot read wasm module that contains a function table import #1802

romits800 opened this issue Sep 18, 2020 · 0 comments · Fixed by #1803
Labels

Comments

@romits800
Copy link
Contributor

Summary of the problem

Then trying to analyze a wasm module with an imported function table that is a result of the compilation with clang, I get an error.

Manticore version

Version: 0.3.4

Python version

Python 3.6.12

OS / Environment

Distributor ID: Ubuntu
Description: Ubuntu 16.04.7 LTS
Release: 16.04
Codename: xenial

Dependencies

alabaster==0.7.12
apipkg==1.5
appdirs==1.4.4
attrs==20.2.0
Babel==2.8.0
backcall==0.2.0
black==20.8b1
blake2b-py==0.1.3
blank==0.1.0
cached-property==1.5.1
capstone==4.0.1
certifi==2020.6.20
chardet==3.0.4
click==7.1.2
coverage==5.2.1
crytic-compile==0.1.9
cytoolz==0.10.1
dataclasses==0.7
decorator==4.4.2
docutils==0.16
eth-bloom==1.0.3
eth-hash==0.2.0
eth-keys==0.3.3
eth-typing==2.2.2
eth-utils==1.9.5
execnet==1.7.1
future==0.18.2
idna==2.10
imagesize==1.2.0
importlib-metadata==1.7.0
ipython==7.16.1
ipython-genutils==0.2.0
jedi==0.17.2
Jinja2==2.11.2
-e git+git@github.com:trailofbits/manticore.git@2eaf7c0#egg=manticore
MarkupSafe==1.1.1
more-itertools==8.5.0
mypy==0.770
mypy-extensions==0.4.3
packaging==20.4
parso==0.7.1
pathspec==0.8.0
pexpect==4.8.0
pickleshare==0.7.5
pkg-resources==0.0.0
pluggy==0.13.1
ply==3.11
prettytable==0.7.2
prompt-toolkit==3.0.7
ptyprocess==0.6.0
py==1.9.0
pyelftools==0.26
pyevmasm==0.2.3
Pygments==2.6.1
pyparsing==2.4.7
pysha3==1.0.2
pytest==5.3.0
pytest-cov==2.8.1
pytest-forked==1.3.0
pytest-xdist==1.30.0
pytz==2020.1
PyYAML==5.3.1
regex==2020.7.14
requests==2.24.0
rlp==1.2.0
sha3==0.2.1
six==1.15.0
snowballstemmer==2.0.0
Sphinx==3.2.1
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==1.0.3
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.4
toml==0.10.1
toolz==0.10.0
traitlets==4.3.3
typed-ast==1.4.1
typing-extensions==3.7.4.3
unicorn==1.0.2rc2
urllib3==1.25.10
wasm==1.2
wcwidth==0.2.5
z3-solver==4.8.9.0
zipp==3.1.0

Step to reproduce the behavior

The files are attached.

$ python script.py

Expected behavior

$ python script.py 
Solutions found!
getchar_res: Y --> Return 

Actual behavior

$ python script.py
Traceback (most recent call last):
  File "script.py", line 33, in <module>
    "if_check.wasm", env={"getchar": getchar, "__linear_memory": mem, "__indirect_function_table": tab}
  File "$PATH_TO_MANTICORE/manticore/wasm/manticore.py", line 39, in __init__
    super().__init__(initial_state, workspace_url=workspace_url, policy=policy, **kwargs)
  File "$PATH_TO_MANTICORE/manticore/core/manticore.py", line 372, in __init__
    self._put_state(initial_state)
  File "$PATH_TO_MANTICORE/manticore/core/manticore.py", line 595, in _put_state
    state_id = self._save(state, state_id=state.id)
  File "$PATH_TO_MANTICORE/manticore/utils/event.py", line 85, in newFunction
    result = func(self, *args, **kw)
  File "$PATH_TO_MANTICORE/manticore/core/manticore.py", line 547, in _save
    state._id = self._workspace.save_state(state, state_id=state_id)
  File "$PATH_TO_MANTICORE/manticore/core/workspace.py", line 491, in save_state
    self._store.save_state(state, f"{self._prefix}{state_id:08x}{self._suffix}")
  File "$PATH_TO_MANTICORE/manticore/core/workspace.py", line 171, in save_state
    self._serializer.serialize(state, f)
  File "$PATH_TO_MANTICORE/manticore/utils/helpers.py", line 116, in serialize
    else f,
  File "$PATH_TO_MANTICORE/manticore/utils/helpers.py", line 147, in pickle_dump
    return pickle.dump(obj, fp, protocol=pickle.HIGHEST_PROTOCOL)
_pickle.PicklingError: Can't pickle <class 'function'>: attribute lookup function on builtins failed

Any relevant logs

issue.tar.gz

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

Successfully merging a pull request may close this issue.

1 participant