angr / angr

A powerful and user-friendly binary analysis platform!
http://angr.io
BSD 2-Clause "Simplified" License
7.61k stars 1.09k forks source link

CLE crashes when trying to load FASM-compiled executables #48

Open ViktorMKa opened 8 years ago

ViktorMKa commented 8 years ago
>>> b=angr.Project('./garbage_bytes2.EXE')
ERROR   | 2015-12-15 16:57:25,594 | cle.loader | Loading error when loading /home/viktor/tool/angrtest/garbage_bytes2.EXE with backend Blob
Traceback (most recent call last): File "/home/viktor/.virtualenvs/angr3/local/lib/python2.7/site-packages/cle/loader.py", line 230, in load_object loaded = backend(path,compatible_with=compatible_with, filetype=filetype, is_main_bin=is_main_bin, **options)
  File "/home/viktor/.virtualenvs/angr3/local/lib/python2.7/site-packages/cle/backends/blob.py", line 25, in __init__raise CLEError("Must specify custom_arch when loading blob!")
CLEError: Must specify custom_arch when loading blob!
Traceback (most recent call last):    
  File "<stdin>", line 1, in <module>
  File "/home/viktor/.virtualenvs/angr3/local/lib/python2.7/site-packages/angr/project.py", line 98, in __init__
self.loader = cle.Loader(self.filename, **load_options)
File "/home/viktor/.virtualenvs/angr3/local/lib/python2.7/site-packages/cle/loader.py", line 88, in __init__
self._load_main_binary()
File "/home/viktor/.virtualenvs/angr3/local/lib/python2.7/site-packages/cle/loader.py", line 139, in _load_main_binary
self.main_bin = self.load_object(self._main_binary_path, self._main_opts, is_main_bin=True)
File "/home/viktor/.virtualenvs/angr3/local/lib/python2.7/site-packages/cle/loader.py", line 236, in load_object
raise CLEError("All backends failed loading %s!" % path)
cle.errors.CLEError: All backends failed loading /home/viktor/tools/angrtest/garbage_bytes2.EXE!

Not sure if this is my error or whether it is on angr/CLE. I made a fresh virtualenv to try and fix this. Didn't help.

garbage_bytes.txt

rhelmot commented 8 years ago

Could you provide the compiled binary? What's happening is that CLE can't tell what kind of file it is (all its magic number checks fail), and also the blob backend fails because you didn't specify the architecture it's for, so CLE can't load it.

ViktorMKa commented 8 years ago

garbage_bytes2.EXE.zip This is the file in question. I'm not sure about specifying the architecture, i only dabbled in assembler to produce some small testcase files.

zardus commented 8 years ago

rhelmot is the only one with a chance at solving this :-)

rhelmot commented 8 years ago

Alright so the answer here is that this is a MS-DOS executable, which is not currently supported by CLE. It wouldn't be too hard to write a loader for this format, since there's no metadata and it's basically a flat binary minus the header if I'm not mistaken.

ltfish commented 8 years ago

Do we support running 16-bit programs (or is that part open sourced)?

rhelmot commented 8 years ago

Ronny's stuff is in fact released, so there shouldn't be an issue here.

ltfish commented 8 years ago

Nice! I guess we are still lacking simulation for MS-DOS environments, but that's not a big issue.

ViktorMKa commented 8 years ago

It is honestly not a big priority to me. I've switched over to gcc for my assembler needs, which works just dandy since it produces ELF files. Still thank you for the explanations you provided.

trietptm commented 4 years ago

It would be nice to have angr CLE support for MS-DOS executable.