Can't the user which is executing the program access the not permissible files if the SETUID is set?
0
votes
1
answer
73
views
I have two users first being
ace
and the second being ej
ace has a file in its home directory, which is a shell script, with the following permission set ( setuid i have used )
-rwsr--r-x 1 ace ace 15 Jan 20 05:18 /home/ace/myshellscript
the content of script is very simple, listed following
echo "whoami
"
cat ./testPrevEsc
but if I try to read another file owned by the the ace
(testPrevEsc) which I think i can do by just passing cat filename
in the $1, i think i should be able to do it, irrespective of permission that is set for others, as long as the owner can read it, but I can't why ?
My understanding of setuid says, that the program or shell executes as its being executed by owner, instead of executing user ( ej in my case), so why cant I read the file and still getting whomai as ej
instead of ace
? on the other hand doing sudo whoami
works fine it give you root, not the user you are running, I think I'm missing something here.
Asked by Yanjan. Kaf.
(129 rep)
Jan 20, 2024, 12:32 AM
Last activity: Jan 20, 2024, 12:55 PM
Last activity: Jan 20, 2024, 12:55 PM