首页 > 解决方案 > WinExec shellcode

问题描述

谁能帮我实现一个 winexec 来执行命令或使用 x86 asm 启动 cmd.exe ?

下面是我如何使用 msvcrt.system 生成 cmd.exe 的示例!我想对winexec做同样的事情。

00446001   68 65786500      PUSH 657865 // exe
00446006   8BDC             MOV EBX,ESP
00446008   68 636D642E      PUSH 2E646D63 // cmd.
0044600D   8BCC             MOV ECX,ESP
00446010   53               PUSH EBX
00446011   51               PUSH ECX
00446012   E8 B0337E77      CALL msvcrt.system
00446017   90               NOP

标签: assemblyshellcode

解决方案


您可以尝试这两种变体中的一种(其中一种已被注释)

;mov eax,1
;push eax
;call there
;db "notepad.exe c:\windows\system32\drivers\etc\hosts",0
;there:
;call WinExec

push  "sts"
push  "oh\c"
push  "te\s"
push  "revi"
push  "rd\2"
push  "3met"
push  "sys\"
push  "swod"
push  "niw\"
push  ".\:c"
push  " exe"
push  ".dap"
push  "eton"
mov eax,esp ; the last one pushed is the head of the string
push 1
push eax
call WinExec

add esp,52 ; restore stack state (13 pushes)
xor eax,eax
push eax
call ExitProcess

推荐阅读