ndsudo set uid/gid/egid to 0 before executing command (#18093)
* ndsudo set uid to 0 before executing command * set gid and egid to 0 too
Ilya Mashchenko committed
Jul 9, 2024 at 14:29 UTC
406719dc74708915d583bf325837cd65267012d5
1 file changed
+4
src/collectors/plugins.d/ndsudo.c
+4
@@ -421,6 +421,10 @@ int main(int argc, char *argv[]) {
421
exit(0);
422
}
423
else {
424
+ setuid(0);
425
+ setgid(0);
426
+ setegid(0);
427
+
428
char *clean_env[] = {NULL};
429
execve(filename, params, clean_env);
430
perror("execve"); // execve only returns on error