maat
maat copied to clipboard
Maat: Sleigh raised a bad data exception: r0x00000002: Unable to resolve constructor
You can also see this question on stack exchange eth.
I'm running the maat symbolic executor on my Linux instance with the following code.
Command I ran to get my binary code:
gcc myFile.c -o myFile.out
myFile.c
#include <stdio.h>
int main(int argc, char** argv)
{
printf("Argument starts with: '%c'\n", argv[1][0]);
return 42;
}
Maat python code:
from maat import MaatEngine, ARCH, OS, BIN
m = MaatEngine(ARCH.X64, OS.LINUX)
m.load("./myFile.out", BIN.ELF64, args=[b"hello"], load_interp=False)
m.run()
However, running this is getting me the following error:
$ python3 symbolic.py
[Warning] Couldn't find library 'libc.so.6': skipping import
[Warning] Missing imported function: __cxa_finalize
[Info] Adding object './myFile.out' to virtual fs at '/./myFile.out'
[Error] Sleigh failed to decode instructions in basic block starting at 0x2. Raised the following error: "Sleigh raised a bad data exception: r0x00000002: Unable to resolve constructor"
[Error] Lifter error: MaatEngine::get_asm_inst(): failed to lift instructions
Am I doing something wrong?
Versions:
Python 3.10.6
gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Ubuntu 22.04.1 LTS
pymaat==0.6.9
Attempted to solve using information from the discussion here
Updated the code to:
from maat import MaatEngine, ARCH, OS, BIN
m = MaatEngine(ARCH.X64, OS.LINUX)
m.load("./myFile.out", BIN.ELF64, args=[b"hello"], libdirs=['/usr/lib/x86_64-linux-gnu', '/usr/lib64'], load_interp=False)m.run()
Got this new error:
[Warning] LoaderLIEF: unsupported X86 relocation type: 18 for symbol ''
[Warning] LoaderLIEF: unsupported X86 relocation type: 18 for symbol ''
[Warning] LoaderLIEF: unsupported X86 relocation type: 18 for symbol ''
[Warning] LoaderLIEF: unsupported X86 relocation type: 18 for symbol ''
[Warning] LoaderLIEF: unsupported X86 relocation type: 18 for symbol ''
[Warning] LoaderLIEF: unsupported X86 relocation type: 18 for symbol ''
[Warning] LoaderLIEF: unsupported X86 relocation type: 18 for symbol ''
[Warning] LoaderLIEF: unsupported X86 relocation type: 18 for symbol ''
[Warning] LoaderLIEF: unsupported X86 relocation type: 18 for symbol ''
[Warning] LoaderLIEF: unsupported X86 relocation type: 18 for symbol ''
[Warning] LoaderLIEF: unsupported X86 relocation type: 18 for symbol ''
[Warning] LoaderLIEF: unsupported X86 relocation type: 18 for symbol ''
[Warning] LoaderLIEF: unsupported X86 relocation type: 18 for symbol ''
[Warning] LoaderLIEF: unsupported X86 relocation type: 18 for symbol ''
[Warning] LoaderLIEF: unsupported X86 relocation type: 18 for symbol ''
[Warning] LoaderLIEF: unsupported X86 relocation type: 18 for symbol ''
[Warning] Missing imported data: _dl_argv (skipping relocation)
[Warning] Missing imported data: __libc_enable_secure (skipping relocation)
[Warning] Missing imported data: __libc_stack_end (skipping relocation)
[Warning] Missing imported data: _rtld_global_ro (skipping relocation)
[Warning] LoaderLIEF: unsupported X86 relocation type: 18 for symbol '__libc_dlerror_result'
[Warning] Missing imported data: _rtld_global (skipping relocation)
[Warning] Missing imported data: _rtld_global (skipping relocation)
[Info] Adding object './myFile.out' to virtual fs at '/./myFile.out'
[Error] MaatEngine::process_store(): Caught memory exception: Writing at address 0x0 in page that doesn't have W flag set
[Error] Unexpected error when processing IR instruction, aborting...
Anyone managed to find a solution for this?