It was discovered that when executing ldd
on a malicious file, it is possible to execute code because of the way libraries are loaded into the process memory. An attacker may trick a victim user into running ldd
on malicious files, thus executing code with their privileges.
Use objdump -p /path/to/program | grep NEEDED
instead of ldd
when you want to get the library dependencies of an untrusted executable. However this just returns the direct dependencies of the program, so it should be manually run against all the needed libraries to get the entire dependency tree as ldd
does.