Shared Object Manipulation
A shared object is a compiled binary file that contains code and data that can be shared among multiple programs. In Unix-like operating systems, shared objects are typically represented by files with the .so
(shared object) extension. They allow programs to utilize common libraries, reducing redundancy and saving memory, as multiple programs can load the same shared object into memory at runtime.
Some Binaries or programs might have custom object/libraries associated with them. If we have access to manipulate the custom object used by such program, we can get escalate privilege.
Example
lets say there is a library with suid bit set.
Viewing the shared object required for specific binary
Using ldd
we can view the shaed object required.
from the output we can see, dbs binary's non standard library thisislibrary.so
Using readelf
tool we can look at the path for the shared libraries.
From the output, we can say custom library is imported from /dollarboysushil
directory
If we have write access to this directory, then we can add malicious library in this directory.
Compiling this malicious library
Now when we run the dbs binary, we will get shell as root.
Last updated