mandiant / idawasm

IDA Pro loader and processor modules for WebAssembly
Apache License 2.0
350 stars 55 forks source link

idawasm fails to decompile #1

Open ghost opened 5 years ago

ghost commented 5 years ago

idawasm dies with the following error message:

Possible file format: WebAssembly v1 executable (C:\Desktop Sync\ExeCrackers\Tools\IDA 7.0\loaders\wasm_loader.py)

  bytes   pages size description
--------- ----- ---- --------------------------------------------
   262144    32 8192 allocating memory for b-tree...
    65536     8 8192 allocating memory for virtual array...
   262144    32 8192 allocating memory for name pointers...
-----------------------------------------------------------------
   589824            total memory allocated

Loading file 'C:\Users\Undefined\Desktop\wasm-inno\build\index.wasm' into database...
Detected file format: WebAssembly v1 executable
Loading processor module C:\Desktop Sync\ExeCrackers\Tools\IDA 7.0\procs\wasm_proc.py for wasm...OK
Autoanalysis subsystem has been initialized.
  0. Creating a new segment  (00000000-00000008) ... ... OK
  1. Creating a new segment  (00000008-00000025) ... ... OK
  2. Creating a new segment  (00000025-000000A5) ... ... OK
  3. Creating a new segment  (000000A5-000000B9) ... ... OK
  4. Creating a new segment  (000000B9-000000C1) ... ... OK
DEBUG:idawasm.processor:missing global: 1
  5. Creating a new segment  (000000C1-000000CC) ... ... OK
  6. Creating a new segment  (000000CC-000000DA) ... ... OK
DEBUG:idawasm.processor:missing global: 0
  7. Creating a new segment  (000000DA-000009F4) ... ... OK
  8. Creating a new segment  (000009F4-00000A45) ... ... OK
Flushing buffers, please wait...INFO:idawasm.processor:saving wasm processor state.
ok
File 'C:\Users\Undefined\Desktop\wasm-inno\build\index.wasm' has been successfully loaded into the database.
INFO:idawasm.processor:new file: C:\Users\Undefined\Desktop\wasm-inno\build\index.wasm
INFO:idawasm.processor:parsing sections
INFO:idawasm.processor:parsing types
INFO:idawasm.processor:parsing globals
INFO:idawasm.processor:parsing functions
INFO:idawasm.processor:computing branch targets
ERROR:idawasm.processor:exception in notify_newfile
Traceback (most recent call last):
  File "build\bdist.win-amd64\egg\idawasm\processor.py", line 58, in wrapper
    return f(*args, **kwargs)
  File "build\bdist.win-amd64\egg\idawasm\processor.py", line 533, in notify_newfile
    self.load()
  File "build\bdist.win-amd64\egg\idawasm\processor.py", line 507, in load
    self.branch_targets = self._compute_branch_targets()
  File "build\bdist.win-amd64\egg\idawasm\processor.py", line 281, in _compute_branch_targets
    branch_targets.update(self._compute_function_branch_targets(pcode, body.code))
  File "build\bdist.win-amd64\egg\idawasm\processor.py", line 260, in _compute_function_branch_targets
    raise NotImplementedError('else')
NotImplementedError: else
IDA is analysing the input file...
You may start to explore the input file right now.
---------------------------------------------------------------------------------------
Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)] 
IDAPython v1.7.0 final (serial 0) (c) The IDAPython Team <idapython@googlegroups.com>
---------------------------------------------------------------------------------------
ERROR:idawasm.processor:exception in notify_ana
Traceback (most recent call last):
  File "build\bdist.win-amd64\egg\idawasm\processor.py", line 58, in wrapper
    return f(*args, **kwargs)
  File "build\bdist.win-amd64\egg\idawasm\processor.py", line 1181, in notify_ana
    insn.Op2.value = bc.imm.target_table
  File "C:\Desktop Sync\ExeCrackers\Tools\IDA 7.0\python\ida_ua.py", line 216, in __set_value__
    return _ida_ua.op_t___set_value__(self, *args)
TypeError: Expected an ea_t type
DEBUG:idawasm.processor:missing global: 1
ERROR:idawasm.processor:exception in notify_ana
Traceback (most recent call last):
  File "build\bdist.win-amd64\egg\idawasm\processor.py", line 58, in wrapper
    return f(*args, **kwargs)
  File "build\bdist.win-amd64\egg\idawasm\processor.py", line 1181, in notify_ana
    insn.Op2.value = bc.imm.target_table
  File "C:\Desktop Sync\ExeCrackers\Tools\IDA 7.0\python\ida_ua.py", line 216, in __set_value__
    return _ida_ua.op_t___set_value__(self, *args)
TypeError: Expected an ea_t type
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
DEBUG:idawasm.processor:missing global: 2
The initial autoanalysis has been finished.

Analyzed file was: index.zip

IDA: Version 7.0.170914 Windows x64 (32-bit address size)

Is there any chance that sooner or later it gets supported? Not even a single hello world application can be decompiled which was using the latest compiler. :|

williballenthin commented 5 years ago

hey @Unc3nZureD

thanks for pointing this out. looks like we need support for the else opcode. sharing the sample binary is very helpful, i appreciate that you attached it.

i'm traveling for nearly the next month, so unfortunately probably wont have a fix before december. will do this as soon as i can.

evandrix commented 5 years ago

i face the same error too :/

Arcanaeum commented 5 years ago

Same error here

bufsnake commented 5 years ago

INFO:idawasm.processor:parsing sections INFO:idawasm.processor:parsing types INFO:idawasm.processor:parsing globals INFO:idawasm.processor:parsing functions INFO:idawasm.processor:computing branch targets ERROR:idawasm.processor:exception in notify_newfile Traceback (most recent call last): File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 58, in wrapper return f(*args, **kwargs) File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 533, in notify_newfile self.load() File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 507, in load self.branch_targets = self._compute_branch_targets() File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 281, in _compute_branch_targets branch_targets.update(self._compute_function_branch_targets(pcode, body.code)) File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 260, in _compute_function_branch_targets raise NotImplementedError('else') NotImplementedError: else IDA is analysing the input file... You may start to explore the input file right now.

快速修补神器 Keypatch 2.2 加载成功 快速修补神器在使用 Keystone v0.9.1 版本 快速修补神器 快速修补快捷键 Ctrl-Alt-K 使用方法:菜单编辑(&E) | 快速修改神器| 修补 QQ384232750技术支持 永乐汉化2018版权所有,盗版必究。 更多访问永乐汉化后期资源网 www.ylhh.net


Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit (AMD64)] IDAPython v1.7.0 final (serial 0) (c) The IDAPython Team idapython@googlegroups.com

DEBUG:idawasm.processor:missing global: 23 DEBUG:idawasm.processor:missing global: 23 DEBUG:idawasm.processor:missing global: 23 DEBUG:idawasm.processor:missing global: 23 ERROR:idawasm.processor:exception in notify_ana Traceback (most recent call last): File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 58, in wrapper return f(*args, kwargs) File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 1181, in notify_ana insn.Op2.value = bc.imm.target_table File "C:\application\IDA_Pro_v7.0\python\ida_ua.py", line 216, in set_value return _ida_ua.optset_value(self, args) TypeError: Expected an ea_t type ERROR:idawasm.processor:exception in notify_ana Traceback (most recent call last): File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 58, in wrapper return f(args, kwargs) File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 1181, in notify_ana insn.Op2.value = bc.imm.target_table File "C:\application\IDA_Pro_v7.0\python\ida_ua.py", line 216, in set_value return _ida_ua.optset_value(self, args) TypeError: Expected an ea_t type ERROR:idawasm.processor:exception in notify_ana Traceback (most recent call last): File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 58, in wrapper return f(args, kwargs) File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 1181, in notify_ana insn.Op2.value = bc.imm.target_table File "C:\application\IDA_Pro_v7.0\python\ida_ua.py", line 216, in set_value return _ida_ua.optset_value(self, args) TypeError: Expected an ea_t type ERROR:idawasm.processor:exception in notify_ana Traceback (most recent call last): File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 58, in wrapper return f(args, kwargs) File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 1181, in notify_ana insn.Op2.value = bc.imm.target_table File "C:\application\IDA_Pro_v7.0\python\ida_ua.py", line 216, in set_value return _ida_ua.optset_value(self, args) TypeError: Expected an ea_t type ERROR:idawasm.processor:exception in notify_ana Traceback (most recent call last): File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 58, in wrapper return f(args, kwargs) File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 1181, in notify_ana insn.Op2.value = bc.imm.target_table File "C:\application\IDA_Pro_v7.0\python\ida_ua.py", line 216, in set_value return _ida_ua.optset_value(self, args) TypeError: Expected an ea_t type ERROR:idawasm.processor:exception in notify_ana Traceback (most recent call last): File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 58, in wrapper return f(args, kwargs) File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 1181, in notify_ana insn.Op2.value = bc.imm.target_table File "C:\application\IDA_Pro_v7.0\python\ida_ua.py", line 216, in set_value return _ida_ua.optset_value(self, args) TypeError: Expected an ea_t type ERROR:idawasm.processor:exception in notify_ana Traceback (most recent call last): File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 58, in wrapper return f(args, kwargs) File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 1181, in notify_ana insn.Op2.value = bc.imm.target_table File "C:\application\IDA_Pro_v7.0\python\ida_ua.py", line 216, in set_value return _ida_ua.optset_value(self, args) TypeError: Expected an ea_t type ERROR:idawasm.processor:exception in notify_ana Traceback (most recent call last): File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 58, in wrapper return f(args, kwargs) File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 1181, in notify_ana insn.Op2.value = bc.imm.target_table File "C:\application\IDA_Pro_v7.0\python\ida_ua.py", line 216, in set_value return _ida_ua.optset_value(self, args) TypeError: Expected an ea_t type ERROR:idawasm.processor:exception in notify_ana Traceback (most recent call last): File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 58, in wrapper return f(args, kwargs) File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 1181, in notify_ana insn.Op2.value = bc.imm.target_table File "C:\application\IDA_Pro_v7.0\python\ida_ua.py", line 216, in set_value return _ida_ua.optset_value(self, args) TypeError: Expected an ea_t type ERROR:idawasm.processor:exception in notify_ana Traceback (most recent call last): File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 58, in wrapper return f(args, kwargs) File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 1181, in notify_ana insn.Op2.value = bc.imm.target_table File "C:\application\IDA_Pro_v7.0\python\ida_ua.py", line 216, in set_value return _ida_ua.optset_value(self, args) TypeError: Expected an ea_t type ERROR:idawasm.processor:exception in notify_ana Traceback (most recent call last): File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 58, in wrapper return f(args, kwargs) File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 1181, in notify_ana insn.Op2.value = bc.imm.target_table File "C:\application\IDA_Pro_v7.0\python\ida_ua.py", line 216, in set_value return _ida_ua.optset_value(self, args) TypeError: Expected an ea_t type ERROR:idawasm.processor:exception in notify_ana Traceback (most recent call last): File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 58, in wrapper return f(args, kwargs) File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 1181, in notify_ana insn.Op2.value = bc.imm.target_table File "C:\application\IDA_Pro_v7.0\python\ida_ua.py", line 216, in set_value return _ida_ua.optset_value(self, args) TypeError: Expected an ea_t type ERROR:idawasm.processor:exception in notify_ana Traceback (most recent call last): File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 58, in wrapper return f(args, kwargs) File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 1181, in notify_ana insn.Op2.value = bc.imm.target_table File "C:\application\IDA_Pro_v7.0\python\ida_ua.py", line 216, in set_value return _ida_ua.optset_value(self, args) TypeError: Expected an ea_t type ERROR:idawasm.processor:exception in notify_ana Traceback (most recent call last): File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 58, in wrapper return f(args, kwargs) File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 1181, in notify_ana insn.Op2.value = bc.imm.target_table File "C:\application\IDA_Pro_v7.0\python\ida_ua.py", line 216, in set_value return _ida_ua.optset_value(self, args) TypeError: Expected an ea_t type ERROR:idawasm.processor:exception in notify_ana Traceback (most recent call last): File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 58, in wrapper return f(args, kwargs) File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 1181, in notify_ana insn.Op2.value = bc.imm.target_table File "C:\application\IDA_Pro_v7.0\python\ida_ua.py", line 216, in set_value return _ida_ua.optset_value(self, args) TypeError: Expected an ea_t type ERROR:idawasm.processor:exception in notify_ana Traceback (most recent call last): File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 58, in wrapper return f(args, kwargs) File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 1181, in notify_ana insn.Op2.value = bc.imm.target_table File "C:\application\IDA_Pro_v7.0\python\ida_ua.py", line 216, in set_value return _ida_ua.optset_value(self, args) TypeError: Expected an ea_t type ERROR:idawasm.processor:exception in notify_ana Traceback (most recent call last): File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 58, in wrapper return f(args, kwargs) File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 1120, in notify_ana bc = next(wasm.decode.decode_bytecode(buf)) File "build\bdist.win-amd64\egg\wasm\decode.py", line 22, in decodebytecode offs, imm, = opcode.imm_struct.from_raw(None, bytecode_wnd[1:]) File "build\bdist.win-amd64\egg\wasm\types.py", line 302, in from_raw data_len, val, data_type = cur_field.from_raw(data, raw[offs:]) File "build\bdist.win-amd64\egg\wasm\types.py", line 143, in from_raw length, item, element_type = self.field.from_raw(ctx, raw[offs:]) File "build\bdist.win-amd64\egg\wasm\types.py", line 72, in from_raw segment = byte2int(raw[offs]) IndexError: index out of bounds ERROR:idawasm.processor:exception in notify_ana Traceback (most recent call last): File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 58, in wrapper return f(*args, *kwargs) File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 1120, in notify_ana bc = next(wasm.decode.decode_bytecode(buf)) File "build\bdist.win-amd64\egg\wasm\decode.py", line 22, in decodebytecode offs, imm, = opcode.imm_struct.from_raw(None, bytecode_wnd[1:]) File "build\bdist.win-amd64\egg\wasm\types.py", line 302, in from_raw data_len, val, data_type = cur_field.from_raw(data, raw[offs:]) File "build\bdist.win-amd64\egg\wasm\types.py", line 143, in from_raw length, item, element_type = self.field.from_raw(ctx, raw[offs:]) File "build\bdist.win-amd64\egg\wasm\types.py", line 72, in from_raw segment = byte2int(raw[offs]) IndexError: index out of bounds ERROR:idawasm.processor:exception in notify_ana Traceback (most recent call last): File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 58, in wrapper return f(args, kwargs) File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 1181, in notify_ana insn.Op2.value = bc.imm.target_table File "C:\application\IDA_Pro_v7.0\python\ida_ua.py", line 216, in set_value return _ida_ua.optset_value(self, args) TypeError: Expected an ea_t type ERROR:idawasm.processor:exception in notify_ana Traceback (most recent call last): File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 58, in wrapper return f(args, kwargs) File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 1181, in notify_ana insn.Op2.value = bc.imm.target_table File "C:\application\IDA_Pro_v7.0\python\ida_ua.py", line 216, in set_value return _ida_ua.optset_value(self, args) TypeError: Expected an ea_t type ERROR:idawasm.processor:exception in notify_ana Traceback (most recent call last): File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 58, in wrapper return f(args, kwargs) File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 1120, in notify_ana bc = next(wasm.decode.decode_bytecode(buf)) File "build\bdist.win-amd64\egg\wasm\decode.py", line 22, in decodebytecode offs, imm, = opcode.imm_struct.from_raw(None, bytecode_wnd[1:]) File "build\bdist.win-amd64\egg\wasm\types.py", line 302, in from_raw data_len, val, data_type = cur_field.from_raw(data, raw[offs:]) File "build\bdist.win-amd64\egg\wasm\types.py", line 143, in from_raw length, item, element_type = self.field.from_raw(ctx, raw[offs:]) File "build\bdist.win-amd64\egg\wasm\types.py", line 72, in from_raw segment = byte2int(raw[offs]) IndexError: index out of bounds ERROR:idawasm.processor:exception in notify_ana Traceback (most recent call last): File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 58, in wrapper return f(*args, **kwargs) File "C:/application/IDA_Pro_v7.0/loaders\idawasm\processor.py", line 1120, in notify_ana bc = next(wasm.decode.decode_bytecode(buf)) File "build\bdist.win-amd64\egg\wasm\decode.py", line 22, in decodebytecode offs, imm, = opcode.imm_struct.from_raw(None, bytecode_wnd[1:]) File "build\bdist.win-amd64\egg\wasm\types.py", line 302, in from_raw data_len, val, data_type = cur_field.from_raw(data, raw[offs:]) File "build\bdist.win-amd64\egg\wasm\types.py", line 143, in from_raw length, item, element_type = self.field.from_raw(ctx, raw[offs:]) File "build\bdist.win-amd64\egg\wasm\types.py", line 72, in from_raw segment = byte2int(raw[offs]) IndexError: index out of bounds The initial autoanalysis has been finished.