Skip to content

Instantly share code, notes, and snippets.

View tomaskrcka's full-sized avatar
:octocat:
Open for a cooperation, part-time, remotely

Tomas Krcka tomaskrcka

:octocat:
Open for a cooperation, part-time, remotely
  • Berlin, Germany
View GitHub Profile
@jblyberg
jblyberg / suid-wrapper.c
Created October 16, 2012 14:29
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] );