258 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
-1
votes
1
answer
68
views
Enabling a setuid cpp program to run a command - "groups" shows the realuser groups instead of effective user
I am trying to write a cpp program that will act as "sudo" for a faceless account. Basically i want the command to be run AS the faceless account rather than as the user invoking the command....
1
vote
2
answers
104
views
PHP: posix_seteuid() and posix_setuid() not reflected in exec() or proc_open()?
When using exec() or proc_open() after posix_seteuid() or posix_setuid() I expected the resulting process to run as the UID I set inside the running script. This does not happen.
is this how it's ...
0
votes
0
answers
100
views
launch a child process with specific uid when the parent is root
I have a process which is running under sudo.
I'm need to launch a child process which has my uid and gid.
I'm currently playing a game where I change the parent euid and egid to my id's,
launch the ...
1
vote
1
answer
165
views
linux, setuid when user id does not exists
In gcc, as root user, I call setuid system call with invalid user id (3009). errno variable is 0 (successful).
When the program is running, in another session I execute ps command and I see the value ...
0
votes
1
answer
43
views
Lowering privileges of executed script
I'm writing an auditd plugin, which is executed as root user by auditd, and as per the man recommendation I'm looking to lower it's privileges.
I assumed just setting the scripts setuid would be ...
-1
votes
1
answer
185
views
Why the setuid program does not have the privilege to execute system()
I have the following program:
$ cat cat.c
#include <err.h>
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
char buf[32];
if(argc == 1) {
errx(1, &...
1
vote
1
answer
1k
views
How can I elevate the privileges of an executable using setuid on Mac?
I want to create a simple script to restart the Mac. The command requires root privileges, so I decided to create an executable with the setuid bit set and the owner being root.
For testing the setuid ...
3
votes
0
answers
890
views
How to prevent unextracable docker images because of insuffcient UID range?
I am build docker images for a node.js application in a Github Actions workflow and I publish them on Azure ACR.
When I try to pull the image from the ACR to my machine or the Azure App Service, on ...
1
vote
2
answers
604
views
setgid/setuid has no effect on compiled golang code 1.19
➜ go version
go version go1.19.6 linux/amd64
➜ uname -a
Linux dmitry-desktop 6.1.18-200.fc37.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Mar 11 16:09:14 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
I am ...
2
votes
1
answer
2k
views
Why is /proc/self/fd/N forbidden after setuid?
Consider running the following Python code as root:
import os
f=os.open("/etc/shadow", os.O_RDONLY)
os.setuid(65535)
os.open(f"/proc/self/fd/{f}", os.O_RDONLY)
Here is a one-liner ...
0
votes
1
answer
4k
views
How do I use setuid in Python?
I read this but I couldn't solve my problem. I don't know how do I use setuid
I have a small python app that runs python commands and bash command in linux machine. I want only this part below to run ...
user avatar
user19127009
0
votes
1
answer
107
views
Not understanding setuid
I created a VERY simple script:
//#escalate.c - a setuid utility so that we can call shutdown
//# and other things safely without needing root access. We
//# do need to:
//# gcc escalate.c -o ...
0
votes
1
answer
137
views
How to jump between users, including root, in a perlscript?
This question has been asked here in multiple forms. I am asking it again because all these questions had too many details. Hence the answers all boiled down to how to solve those specific problems ...
1
vote
1
answer
326
views
Is there a way to run seteuid() (as a non-root user) and temporarily change the euid to another non-root user without root/sudo privileges?
I'm trying to write a C program which is supposed to open a file which can only be read/written to by (non-root) User A. When run by users who are neither root nor User A, the program should allow the ...
0
votes
1
answer
912
views
Launch child process as root (python, setuid, MacOS)
How can I launch a child process that has root privileges?
I have a python program in MacOS that can do most of its operations as a normal user. But occasionally, triggered by some user interaction, ...