Closed vanhauser-thc closed 1 year ago
Thanks for reporting this!
I bumped up a new revision (2.0.6) with changes made with #55, which fixes this, so feel free to update accordingly. Will also make document changes to recommend AFL++ 😄
@ex0dus-0x I now get a different error :-) Looks like the python packaging went wrong?
# pip3 install -U fuzzable
[...]
Successfully installed fuzzable-2.0.6
# fuzzable create-harness ./lib.so --symbol_name=sub_403489
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /usr/local/lib/python3.11/dist-packages/fuzzable/__main__.py:327 in │
│ create_harness │
│ │
│ 324 │ │
│ 325 │ log.info(f"Running harness generation for `{target}` on symbol `{s │
│ 326 │ shared_obj = generate.transform_elf_to_so(target, binary, symbol_n │
│ ❱ 327 │ generate.generate_harness(shared_obj, symbol_name, output=out_harn │
│ 328 │ │
│ 329 │ log.info("Done!") │
│ 330 │
│ │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ binary = <lief.ELF.Binary object at 0x7fffeaa06f30> │ │
│ │ lief = <module 'lief' from │ │
│ │ '/usr/local/lib/python3.11/dist-packages/lief.cpython-311… │ │
│ │ out_harness = None │ │
│ │ out_so_name = None │ │
│ │ shared_obj = PosixPath('lib.so') │ │
│ │ symbol_name = 'sub_403489' │ │
│ │ target = PosixPath('lib.so') │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /usr/local/lib/python3.11/dist-packages/fuzzable/generate.py:39 in │
│ generate_harness │
│ │
│ 36 │ │ template_path = harness_path │
│ 37 │ │
│ 38 │ log.debug("Reading harness template") │
│ ❱ 39 │ with open(template_path, "r", encoding="utf-8") as template_file: │
│ 40 │ │ template = template_file.read() │
│ 41 │ │
│ 42 │ log.debug("Replacing parameters in template") │
│ │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ abspath = 'lib.so' │ │
│ │ function_name = 'sub_403489' │ │
│ │ harness_path = None │ │
│ │ name = 'lib' │ │
│ │ output = None │ │
│ │ params = None │ │
│ │ return_type = None │ │
│ │ target_path = PosixPath('lib.so') │ │
│ │ template_path = PosixPath('/usr/local/lib/python3.11/dist-packages/temp… │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
FileNotFoundError: [Errno 2] No such file or directory:
'/usr/local/lib/python3.11/dist-packages/templates/linux_closed_source_harness.c
pp'
When I copy the cpp over to the location it then works.
but then the harness does not compile:
my-intercept_sub_403489_harness.cpp:44:9: error: expected unqualified-id
typedef {return_type} (*sub_403489)({type_args});
^
my-intercept_sub_403489_harness.cpp:44:25: error: C++ requires a type specifier for all declarations
typedef {return_type} (*sub_403489)({type_args});
^
my-intercept_sub_403489_harness.cpp:44:38: error: use of undeclared identifier 'type_args'
typedef {return_type} (*sub_403489)({type_args});
^
my-intercept_sub_403489_harness.cpp:100:36: error: use of undeclared identifier 'target'
printf("%s=%p\n", TARGET_NAME, target);
I get this error on different Linux installations with different target libraries:
also, please update the README.md to use afl++ qemu_mode, not the outdated and really underperforming vanilla afl one ...