process fails if setuid bit is set


 
Thread Tools Search this Thread
Operating Systems Linux Red Hat process fails if setuid bit is set
# 1  
Old 12-01-2010
process fails if setuid bit is set

Hi,

OS : Linux

I have an executable (P1) owned by user say "abcd" and the setuid bit is set. And there is another executable (P2) which brings up the process (P1).

When the setuid bit is set, the process P1 is failing, if the setuid bit is not set there is no issue.

I was wondering if there is anything to do with the invoking process P2. P2 is owned by another user say "defg" and permissions are -r-xr-xr-w.

I found a thread something similar, not sure whether compiling and linking needs to be done separately.
setuid bit on user + dynamically linked libraries

Any suggestions would be of great help.

Thanks,
Ahamed
# 2  
Old 12-01-2010
Set uid / grpid exec() turns of LD_LIBRARY_PATH so the program cannot be attacked by a bogus dynamic lib. Either it must be statically linked or compiled with lib path in -R.
# 3  
Old 12-01-2010
what do you mean failing? please post the error. also provide details of what system your running on.
# 4  
Old 01-27-2011
Hi frank,

By failing what I meant is, the process is not comping up. It tries to initiate but then dies after few seconds when the suid bit is set.

I am running MontaVista Linux.


regards,
Ahamed.
# 5  
Old 01-27-2011
I think it turns off several critical env vars so it cannot be hacked, so even if it runs, children that expect an env may not.
# 6  
Old 02-15-2011
Thank you for all the response. The issue was the env variable LD_LIBRARY_PATH.

Quoting from internet

For security reasons, LD_LIBRARY_PATH is ignored at runtime for executables that have their setuid or setgid bit set. This severely limits the usefulness of LD_LIBRARY_PATH.

The exit error code which I was getting : 127 unable to open shared object. When I did an strace I could see that, it was searching for the depedendent libraries on /usr/lib and not the ones present in LD_LIBRARY_PATH. So for testing I created a link from the actual library path to /usr/lib and it worked. Smilie

regards,
Ahamed.
# 7  
Old 02-16-2011
Either that, or compile static libs, or use -R option to embed link paths.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Java 32 bit installation fails on an AIX platform

Hello. It is my first to deal with Java installation on an AIX platform. I am now trying to install Java 32bit using installp command. However, it throws back the message that the installation media cannot be found. I need to install Java 32bit to proceed with an installation of Oracle JD... (0 Replies)
Discussion started by: EJ2019
0 Replies

2. 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

3. Shell Programming and Scripting

Setuid not working in Linux as script fails to write to file.

Hi, I have the following 3 test files to test setuid bit which if it works I would like to implement in our application. However setuid doesnot seem to be having any impact on my test below.Following are the 3 files of interest in /tmp/ folder. $ ls -ltr *env* -rw------- 1 g332008 users 6... (23 Replies)
Discussion started by: waavman
23 Replies

4. Programming

c program to set the m-bit to n-bit

I have a 32bit number and without using for loop,I want to set mbit to n bit. Say m bit may be 2nd or 5th or 9th or 10th.n bit may be 22nd or 27or 11th bit. I assume m<n. Please help me.Thanks acdc (6 Replies)
Discussion started by: acdc
6 Replies

5. 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

6. 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

7. UNIX for Dummies Questions & Answers

How can we set the Sticky bit in the umask itself

How can we set the Sticky bit in the umask itself. Please help me :confused: (3 Replies)
Discussion started by: geniman2004
3 Replies

8. 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

9. Programming

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... (5 Replies)
Discussion started by: matrixmadhan
5 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