59 points · by 3np · 2y ago · 36 comments
ldd invokes the Windows loader on the file specified, then uses the Windows debugging interface to report DLLs loaded, and (for executables) to attempt to stop execution before the entrypoint. Thus, you should never use ldd on an untrusted file.
https://cygwin.com/cygwin-ug-net/ldd.htmlELF like libraries are supported, but not the way most things are expected to work, with XCOFF and export description files.
Symbian was another OS with similar model, but it wasn't a UNIX anyway, and PIPS was a compatible layer on top.
$ strace ./true
execve("./true", ["./true"], 0x7ffc9993be20 /* 40 vars */) = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=NULL} ---
+++ killed by SIGSEGV +++
(hexedited copy of /bin/true; something different might happen with a specially crafted file which has no other data in it besides the name of the interpreter?)strncpy had been touted the "safe strcpy alternative" for years.
objdump -x /path/to/binary | grep NEEDED