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 files5

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

history/probes-2026-11-07/suidprobe_v1.c

C · 3,774 bytes
/*
 * suidprobe_v1.c —— 以「su 客户端」身份连 magiskd,并打印自己的 exe 指纹
 *
 * 目的:闭合 docs/su-rejected.md 第 9 节留下的差值:
 *         daemon 期望 dev:ino = ?   vs   客户端 /proc/<pid>/exe 实际 dev:ino = ?
 *
 * 做法:
 *   1) stat("/proc/self/exe")   —— 内核给出的真实文件(跟随魔术链接)
 *   2) readlink("/proc/self/exe") —— 看它指向哪个路径
 *   3) stat(argv[0] 若能解析)   —— 与 (1) 对照,验证硬链是否真的同 inode
 *   4) connect 抽象 socket,发 pid/uid/code=3/argc=0,读回状态码
 *      status==0 放行;status==2 是 accept 阶段 DENY;其它见文档
 *
 * 只读观测,不改设备状态。argv[1] 可覆盖 code(默认 3 = SUPERUSER)。
 */
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/stat.h>
#include <sys/types.h>

static const char *SOCK_NAME = "d30138f2310a9fb9c54a3e0c21f58591";

static void show_stat(const char *tag, const char *path)
{
    struct stat sb;
    if (stat(path, &sb) == 0)
        printf("%s stat  %-28s OK   dev=%llu ino=%llu mode=%o nlink=%llu\n",
               tag, path,
               (unsigned long long)sb.st_dev, (unsigned long long)sb.st_ino,
               (unsigned)sb.st_mode, (unsigned long long)sb.st_nlink);
    else
        printf("%s stat  %-28s FAIL errno=%d %s\n", tag, path, errno, strerror(errno));
}

int main(int argc, char **argv)
{
    char exe[512];
    ssize_t n;
    struct sockaddr_un sa;
    socklen_t sl;
    int fd, rc;
    int code = 3;

    if (argc > 1)
        code = atoi(argv[1]);

    printf("=== 我是谁 ===\n");
    printf("[i] pid=%d uid=%d euid=%d argv[0]=%s\n",
           getpid(), getuid(), geteuid(), argc > 0 ? argv[0] : "(null)");

    n = readlink("/proc/self/exe", exe, sizeof(exe) - 1);
    if (n > 0) {
        exe[n] = '\0';
        printf("[i] readlink /proc/self/exe -> %s\n", exe);
    } else {
        printf("[i] readlink /proc/self/exe FAIL errno=%d %s\n", errno, strerror(errno));
    }

    show_stat("[A]", "/proc/self/exe");
    if (n > 0)
        show_stat("[B]", exe);
    if (argc > 0)
        show_stat("[C]", argv[0]);
    show_stat("[D]", "/sbin/magisk64");
    show_stat("[E]", "/sbin/su");

    memset(&sa, 0, sizeof(sa));
    sa.sun_family = AF_UNIX;
    sa.sun_path[0] = '\0';
    strncpy(sa.sun_path + 1, SOCK_NAME, sizeof(sa.sun_path) - 2);
    sl = (socklen_t)(offsetof(struct sockaddr_un, sun_path) + 1 + strlen(SOCK_NAME));

    printf("=== 连 magiskd ===\n");
    fd = socket(AF_UNIX, SOCK_STREAM, 0);
    if (fd < 0) {
        printf("[-] socket(): %s\n", strerror(errno));
        return 1;
    }
    if (connect(fd, (struct sockaddr *)&sa, sl) < 0) {
        printf("[-] connect(): errno=%d %s\n", errno, strerror(errno));
        close(fd);
        return 2;
    }
    printf("[+] connect OK, 发 code=%d\n", code);

    {
        int hdr[4];
        hdr[0] = getpid();
        hdr[1] = getuid();
        hdr[2] = code;
        hdr[3] = 0;
        rc = (int)write(fd, hdr, sizeof(hdr));
        if (rc < 0) {
            printf("[-] write(hdr): errno=%d %s\n", errno, strerror(errno));
            close(fd);
            return 3;
        }
    }

    {
        int st = -1;
        rc = (int)read(fd, &st, sizeof(st));
        if (rc <= 0)
            printf("[-] read(): rc=%d %s(对端直接关,accept 阶段 DENY 的典型表现)\n",
                   rc, rc < 0 ? strerror(errno) : "EOF");
        else
            printf("[=] status=%d %s\n", st,
                   st == 0 ? "(0=放行)" : (st == 1 ? "(1=在排队等授权)" : "(2=DENY)"));
    }

    close(fd);
    return 0;
}