qilingframework / qiling

A True Instrumentable Binary Emulation Framework

Home Page:https://qiling.io

Repository from Github https://github.comqilingframework/qilingRepository from Github https://github.comqilingframework/qiling

Socket fork application hangs, inside the Qiling.

rommarius opened this issue · comments

My socket application running on Linux uses an infinite while loop and forks a new process for each incoming connection. However, I'm facing a strange issue: I am unable to reach the jump comparison where the while loop starts, which prevents me from manipulating the register values to bypass the infinite loop.

ql = Qiling([self._args['elf_file'], self._host, self._port], '/', multithread=True, verbose=QL_VERBOSE.DEBUG)

for info_line in ql.mem.get_formatted_mapinfo():
    print(info_line)
            
ql.os.set_api('accept', self._api_accept, QL_INTERCEPT.ENTER)
ql.os.set_api('send',   self._api_send,   QL_INTERCEPT.EXIT)
ql.os.set_api('recv',   self._api_recv,   QL_INTERCEPT.ENTER)

ql.hook_address(self._bypass_infinite_socket_loop, 0x40151d) #0x401586
            
ql.run()

At address 0x40151d in ghidra, i found the following c line code:

client_size = sizeof(client_addr);
local_154 = 0x10;

It's the last address where i can get any output in my terminal. I need to reach the address 0x401586 too manipulate the register value to close the while loop.

Bildschirmfoto vom 2024-11-03 23-13-50

found the bug in my own c code sorry, :( but thx for the nice framework