Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A very small C wrapper for running shell scripts suid. Pretty dangerous, but handy.
#include <unistd.h>
#include <errno.h>
main( int argc, char ** argv, char ** envp )
if( setgid(getegid()) ) perror( "setgid" );
if( setuid(geteuid()) ) perror( "setuid" );
envp = 0; /* blocks IFS attack on non-bash shells */
system( "/path/to/bash/script", argv, envp );
perror( argv[0] );
return errno;

This comment has been minimized.

Copy link

stychos commented Sep 19, 2019

how do you compile this? system() accepts only single argument

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.