ELF binary has inconsistency detected by ld.so: dl-call-libc-early-init.c: 37: Assertion `sym != NULL' failed

49 Views Asked by At

I'm encountering an issue while trying to run a binary file using both SPWN or Pwntools. Here's the context:

SPWN Logs:

[*] Binary: baskin
[*] Libc:   libc-2.27.so
[*] Loader: ld-linux-x86-64.so.2

[*] file baskin
ELF 64-bit LSB executable
x86-64
dynamically linked
not stripped
[*] checksec baskin
RELRO:    Partial RELRO
Stack:    No canary found
NX:       NX enabled
PIE:      No PIE (0x400000)
Libc version: 2.27

[+] Trying to unstrip libc
[*] Libc unstripped

-- ldd of the original binary
        linux-vdso.so.1 (0x00007fffec961000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fba54613000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fba54843000)

-- ldd of the patched binary
        linux-vdso.so.1 (0x00007ffdd1f1c000)
        libc.so.6 => ./debug_dir/libc.so.6 (0x00007f648de00000)
        ./debug_dir/ld-linux.so.2 => /lib64/ld-linux-x86-64.so.2 (0x00007f648e343000)

Pwntools Code:

from pwn import *

p = process('baskin', env={'LD_PRELOAD':'./libc-2.27.so'})
libc = ELF('./libc-2.27.so')

p.interactive()

Error Encountered:

Inconsistency detected by ld.so: dl-call-libc-early-init.c: 37: _dl_call_libc_early_init: Assertion `sym != NULL' failed!

It seems like both SPWN and Pwntools are unable to run the binary file baskin with the specified libc version (libc-2.27.so). Despite attempting to unstrip the libc in SPWN, the error persists.

I've checked the environment variables and paths, but I couldn't identify any obvious issues. Any insights or suggestions on how to resolve this inconsistency would be greatly appreciated.

1

There are 1 best solutions below

0
user123125 On

Never mind, the loader ld-linux-x86-64.so.2 was the cause of the problem, for reasons which I do not know. The problem was fixed by removing the loader and letting spwn download the loader instead.