Exploit database

GH-ced46422045980b66bac7722582b6d48

wjnkac/cve-2019-2215-vivo-y66i

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2019-2215

37 sources

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

Repository files9
wjnkac/cve-2019-2215-vivo-y66iRevision 54b4fa98e759

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

main/src/tools/kptools/probe_x.c

C · 1,001 bytes
/* probe_x.c —— 验证 su 路径伪装:access / stat 在授权与未授权 uid 下的表现
 * 用法:probe_x <path>            当前 uid
 *      probe_x -d <uid> <path>   先 setuid 再测(需 root 启动)
 */
#define _GNU_SOURCE
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/stat.h>

int main(int argc, char **argv)
{
	const char *path;
	if (argc >= 4 && !strcmp(argv[1], "-d")) {
		uid_t u = (uid_t)atoi(argv[2]);
		if (setuid(u) != 0) { perror("setuid"); return 3; }
		argv += 2;
	}
	if (argc < 2) return 2;
	path = argv[1];
	printf("  uid=%d path=%s\n", getuid(), path);

	errno = 0;
	int a = access(path, X_OK);
	printf("    access(X_OK) = %d errno=%d(%s)\n", a, a ? errno : 0,
	       a ? strerror(errno) : "OK");

	struct stat st;
	memset(&st, 0, sizeof(st));
	errno = 0;
	int s = stat(path, &st);
	printf("    stat()       = %d errno=%d(%s)\n", s, s ? errno : 0,
	       s ? strerror(errno) : "OK");
	return 0;
}