fkie-cad / dewolf

A research decompiler implemented as a Binary Ninja plugin.
GNU Lesser General Public License v2.1
171 stars 9 forks source link

[AttributeError@constants.py:63] AttributeError: 'Symbol' object has no attribute 'initial_value' #269

Closed bugfinder-bot closed 1 year ago

bugfinder-bot commented 1 year ago

What happened?


  File "/opt/dewolf/decompiler/util/bugfinder/bugfinder.py", line 190, in iter_function_reports
    task_result = self.decompile(function, options)
  File "/opt/dewolf/decompile.py", line 50, in decompile
    task = self._frontend.create_task(function, task_options)
  File "/opt/dewolf/decompiler/frontend/binaryninja/frontend.py", line 143, in create_task
    raise e
  File "/opt/dewolf/decompiler/frontend/binaryninja/frontend.py", line 130, in create_task
    cfg = self._extract_cfg(function.function, options)
  File "/opt/dewolf/decompiler/frontend/binaryninja/frontend.py", line 162, in _extract_cfg
    return parser.parse(function)
  File "/opt/dewolf/decompiler/frontend/binaryninja/parser.py", line 34, in parse
    index_to_BasicBlock[basic_block.index] = BasicBlock(basic_block.index, instructions=list(self._lift_instructions(basic_block)))
  File "/opt/dewolf/decompiler/frontend/binaryninja/parser.py", line 77, in _lift_instructions
    if lifted_instruction := self._lifter.lift(instruction):
  File "/opt/dewolf/decompiler/frontend/binaryninja/lifter.py", line 28, in lift
    if pseudo_expression := handler(expression, **kwargs):
  File "/opt/dewolf/decompiler/frontend/binaryninja/handlers/assignments.py", line 51, in lift_assignment
    self._lifter.lift(assignment.src, parent=assignment),
  File "/opt/dewolf/decompiler/frontend/binaryninja/lifter.py", line 28, in lift
    if pseudo_expression := handler(expression, **kwargs):
  File "/opt/dewolf/decompiler/frontend/binaryninja/handlers/constants.py", line 57, in lift_constant_pointer
    return self._replace_global_variable_with_value(global_variable, variable, view)
  File "/opt/dewolf/decompiler/frontend/binaryninja/handlers/constants.py", line 63, in _replace_global_variable_with_value
    return StringSymbol(globalVariable.initial_value, variable.address, vartype=Pointer(Integer.char(), view.address_size * BYTE_SIZE))

Error class AttributeError@constants.py:63 contains 217 cases.

How to reproduce?

python decompile.py 75c4b2ec3f940bb90ef2b0d08994e624fc4cd731d1856f045de0673dedc75317 line6_midi_input_trigger --debug

sample: 75c4b2ec3f940bb90ef2b0d08994e624fc4cd731d1856f045de0673dedc75317 case: https://bugfinder.seclab-bonn.de/case/289/ dewolf commit: cf413ea8 Binaryninja version: 3.4.4271

NeoQuix commented 1 year ago

Problem: DataVariablen in binary with address 0 which is in a section colliding with caller_addr. Fixed by setting default value of caller_addr to something not numerical

NeoQuix commented 1 year ago

/cib

github-actions[bot] commented 1 year ago

Branch issue-269-_AttributeError_constants_py_63_AttributeError_Symbol_object_has_no_attribute_initial_value created!

NeoQuix commented 1 year ago

Ok now the best part, the variable should be a nullptr......