setuid bit on user + dynamically linked libraries


 
Thread Tools Search this Thread
Top Forums Programming setuid bit on user + dynamically linked libraries
# 1  
Old 10-07-2006
setuid bit on user + dynamically linked libraries

hi all,

i have a critical and specific problem with respect to set uid bit on user and the dll's

for a binary, (under the userid A)
it needs libraries from /usr/lib and informix libraries from $INFORMIXDIR/lib/esql

but this binary should be kicked off from id B,
hence s-bit on user is set for the binary

after setting the s-bit on the binary and the dynamic dependencies and shared objects are listed using ldd,
i could see only the libraries from default directory /usr/lib/ are listed and not from the INFORMIX library paths.

when searched in search engine about this, found that
due to security reasons for a binary for which set bit is set on the user or group the dynamic dependencies will not be included.

can you please provide me a pointer on how to handle this ?
# 2  
Old 10-07-2006
I don't quite understand what you are trying to say. Are you saying that on running ldd, you aren't seeing all the libraries that the program should be linked to?

If the binary has been linked with the libraries while compiling, then it should show up on running ldd.
# 3  
Old 10-07-2006
yes upon running ldd, all the libraries that are to be linked are not displayed...

here is the display

note below s-bit on user for bin is not set
Quote:
>ls -l bin
-rwxr-xr-x 1 u1 g1 201312 Oct 7 04:42 bin*
displaying the libraries linked below
Quote:
>ldd bin
libifgls.so => /informix/distr/infx.9.40.UC5/lib/esql/libifgls.so
libnsl.so.1 => /usr/lib/libnsl.so.1
libsocket.so.1 => /usr/lib/libsocket.so.1
libaio.so.1 => /usr/lib/libaio.so.1
libdl.so.1 => /usr/lib/libdl.so.1
libelf.so.1 => /usr/lib/libelf.so.1
libifglx.so => /informix/distr/infx.9.40.UC5/lib/esql/libifglx.so
lib4gsh.so => /informix/distr/infx.9.40.UC5/lib/tools/lib4gsh.so
libcurses.so.1 => /usr/lib/libcurses.so.1
libc.so.1 => /usr/lib/libc.so.1
libmp.so.2 => /usr/lib/libmp.so.2
note below s-bit on user for bin is now set
Quote:
>ls -l bin
-rwsr-xr-x 1 u1 g1 201312 Oct 7 04:42 bin*
displaying the libraries that are currently linked below
Quote:
>ldd bin
libifgls.so => File not found
libnsl.so.1 => /usr/lib/libnsl.so.1
libsocket.so.1 => /usr/lib/libsocket.so.1
libaio.so.1 => /usr/lib/libaio.so.1
libdl.so.1 => /usr/lib/libdl.so.1
libelf.so.1 => /usr/lib/libelf.so.1
libifglx.so => File not found
lib4gsh.so => File not found
libcurses.so.1 => /usr/lib/libcurses.so.1
libc.so.1 => /usr/lib/libc.so.1
libmp.so.2 => /usr/lib/libmp.so.2
hope i have made it clear now
# 4  
Old 10-07-2006
Knowing which OS you are using would be nice...I'm guessing Solaris? Do not rely on LD_LIBRARY_PATH to find stuff. When you run ld to produce bin you can specify what libraries to search. Do that and use absolute pathnames as you do. If that doesn't work, there are more complex arguments to ld that will nail a symbol to a particular library. I believe that one of these will probably work. The issue is allowing a malicious user the ability to change an environment variable to insert random code into the executable. Once you are no longer relying on an environment variable, I would expect it work. The options you need will be on your OS's ld man page.
# 5  
Old 10-08-2006
i missed out that

solaris 5.9

the issue is just not displaying the dynamic dependencies...
as ldd is not able to list them all with the s-bit set for the binary...

naturally am not able to run the binary also,
ld.so.1 linker fails to locate the necessary libs

the issue is ---> "without s-bit it works perfect.. when s-bit is set that it crashes"

on a truss for that binary.. there is a pipe error from ld.so.1 as displayed by the system call tracer

i dont know how using the other options of ldd would help me to locate the dependencies of the binary for which s-bit is set...

hope i have made my problem clear...
# 6  
Old 10-08-2006
ld built (different program than ldd) actually built your bin program just as it builds every executable. ld built it in a way that will not work when suid. You need to change the way ld builds your program. ld may be invoked automatically by the compiler. You may be able to control ld from you compilers command line. But I would use separate compile and link steps.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

What keeps me from abusing setuid(0) and programs with setuid bit set?

Just learning about the privilege escalation method provided by setuid. Correct me if I am wrong but what it does is change the uid of the current process to whatever uid I set. Right ? So what stops me from writing my own C program and calling setuid(0) within it and gaining root privileges ? ... (2 Replies)
Discussion started by: sreyan32
2 Replies

2. UNIX for Beginners Questions & Answers

How to make a dynamically linked executable file?

So I have a file called queens.cc and I need to do the following: Compile and make a .o file while specifying that the compiler is to search /student/214/include for system include files. Use g++, link and load .o file to make a dynamically linked executable file called queens and to also... (1 Reply)
Discussion started by: steezuschrist96
1 Replies

3. Linux

Please explain setuid bit clearly!

Dear all, I am newbie with linux, i dont understand any code. I have googled a long time. Please help me explain about setuid bit on linux (Centos 6) Here: 1/ I chmod u+s for /sbin/iptables but normal user still cannot perform command (ex: /sbin/iptables -L) 2/Someone says : setuid only... (6 Replies)
Discussion started by: all4cfa
6 Replies

4. UNIX for Dummies Questions & Answers

setuid & sticky bit

Can anyone explain me difference between setuid and sticky bit? and also between setuid and chown? (3 Replies)
Discussion started by: kkalyan
3 Replies

5. SCO

SCO linked libraries

How do i get the list of linked libraries in a built binaries on SCO UNIX. I appreciate your help (1 Reply)
Discussion started by: param_it
1 Replies

6. HP-UX

setuid bit - error

hi i have written small script which will login 2 two different users with su but if we run from normal user it prompts for password so i chnaged the owner of script to root and added setuid bit with chmod u+s <script_name> but when i run the script i get following message Warning:... (3 Replies)
Discussion started by: zedex
3 Replies

7. Programming

dynamically loaded libraries

how to get the list of all dynamically loaded libraries in memory ?thanks! (3 Replies)
Discussion started by: rainshadow
3 Replies

8. UNIX for Advanced & Expert Users

dynamically linked file

Hi friends, i have a dynamically linked file on my solaris system.this is script that runs regularly. How can i read the contents of that ? when i tried to say "vi filename " then it says executable and nothing is seen. Please help. thanks in advance Veera (5 Replies)
Discussion started by: sveera
5 Replies

9. Shell Programming and Scripting

dynamically linked file

Hi friends , how do i view a dynamically linked file in unix ? its there on other system and do i have to ftp it in ASCII format or binary ? and after the ftp how do i view it ? thanks in advance veeras (1 Reply)
Discussion started by: sveera
1 Replies

10. UNIX for Advanced & Expert Users

setuid sticky bit

I have a binary. It is having the following permissions rws rws rwx mqm:mqm runmqtrm The same program on another machine is rws rws rwx root: mqm runmqtrm This program is a setuid program. This is what my understanding is. Whatever user the program is started under, it will finally be... (0 Replies)
Discussion started by: bandaru
0 Replies
Login or Register to Ask a Question