Miscellaneous Misconfigurations

Khi cài đặt Microsoft Exchange và AD theo default installation, Exchange sẽ được cấp những quyền hạn cao để tương tác với user và các object khác để vận hành hệ thống, do vậy đã tạo ra nhiều attack surface cho attacker.

  • Tự tạo nhiều group, user, service account, computer với quyền rất cao trong domain.

  • Các nhóm này có ACE/ACL đặc biệt cho phép write domain object.

  • Không có mô hình split-administration, nên Exchange gần như trở thành Domain Admin gián tiếp.

Exchange Windows Permissions

Vấn đề của exchange là group này không nằm trong list của protected groups của Windows như Domain Admins, nhưng nó lại có quyền WriteDACL.

⇒ Member of group này có thể chỉnh sửa ACL của domain object, cụ thể:

  1. Thêm quyền DS-Replication-Get-Changes

  2. Thêm quyền DS-Replication-Get-Changes-All

  3. Từ đó cấp DCSync cho bất kỳ user nào (đọc NTLM hash, Kerberos keys).

PrivExchange

PrivExchange là một kỹ thuật privilege escalation trong môi trường AD, khai thác từ Exchange Server để đạt quyền Domain Admin chỉ với một tài khoản domain user bình thường có mailbox.

CVE được liên quan: CVE-2018-8581

Lỗi xuất phát từ tính năng PushSubscription trong Exchange Web Services (EWS)/

Tính năng này cho phép:

  • Một user có mailbox tạo một "push subscription".

  • Exchange server (chạy dưới quyền SYSTEM) sẽ gửi HTTP request đến endpoint mà người dùng chỉ định để đẩy thông tin sự kiện mailbox.

⇒ Bất kỳ domain user nào có mailbox có thể yêu cầu Exchange server authenticate ra ngoài.

Printer Bug

Printer Bug coerce một host Windows Server chạy dịch vụ Print Spooler phải authenticate ra ngoài (SMB/NTLM) đến host của attacker.

Lỗ hổng nằm trong protocol MS-RPRN (Print System Remote Protocol) khi bất kì domain user nào connect đến spool RpcOpenPrinter bằng cách sử dụng RpcRemoteFindFirstPrinterChangeNotificationEx method và force server phải authenticate tới bất kì host nào do client yêu cầu qua SMB.

Spooler service chạy với quyền SYSTEM và được cài đặt default trên Windows servers running Desktop Experience.

Kết quả thu được:

  • Relay đến LDAP ⇒ cấp DCSync ⇒ Domain Admin

  • Relay đến LDAP ⇒ cấp RBCD (Resource-Based Constrained Delegation)

  • Cross-Forest Attack

Sử dụng NetNTLMtoSilverTicketSecurity-Assessment để check host mục tiêu có dính MS-PRN Printer Bug hay không.

MS14-068

MS14-068 là một lỗ hổng trong Kerberos Key Distribution Center (KDC), cho phép Domain User tự tạo một PAC (Privilege Attribute Certificate) giả mạo, khai rằng mình là Domain Admin, và KDC sẽ chấp nhận PAC giả này là hợp lệ. KDC không kiểm tra đúng chữ ký PAC khi xử lý yêu cầu TGS, tạo điều kiện cho attacker đính kèm một PAC giả mạo, và KDC vẫn cấp TGS hợp lệ cho ticket đó.

Nói cách khác:

  • Không cần hash của Domain Admin

  • Không cần SIDHistory injection

  • Không cần chỉnh AD ACL

  • Chỉ cần Domain User

PAC fake mới khai báo chỉ cần thay đổi attribute group membership = Domain Admins, Enterprise Admins, …

Tham khảo pykek.

Enumerating DNS Records

Có thể sử dụng adidnsdump để enumerate toàn bộ record DNS trong AD chỉ với cred domain user hợp lệ.

Tham khảo: https://dirkjanm.io/getting-in-the-zone-dumping-active-directory-dns-with-adidnsdump/

Other Misconfigurations

Password in Description Field

Finding a Password in the Script

Group Policy Preferences (GPP) Passwords

Khi có GPP mới, một file .xml sẽ được tạo trong SYSVOL share, đồng thời cũng được lưu vào cached locally trên endpoint mà Group Policy áp dụng:

  • Map drives (drives.xml)

  • Tạo local users

  • Tạo printer config (printers.xml)

  • Tạo và update services (services.xml)

  • Tạo scheduled tasks (scheduledtasks.xml)

  • Thay đổi local admin passwords

Các tệp này chứa nhiều dữ liệu config nhạy cảm. Attribute cpassword được mã hóa AES-256 bit với private key được Microsoft public: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-gppref/2c15cbf0-f086-4c74-8b70-1f2fa45dd4be, có thể sử dụng để decrypt password. Tất cả các domain user đều có thể đọc được các file này qua SYSVOL share.

Microsoft đã define lỗ hổng này và vá trong năm 2014 MS14-025 Vulnerability in GPP could allow elevation of privilege để ngăn administrator đặt password qua GPP. Patch này sẽ không xóa file Groups.xml có password từ SYSVOL. Nếu xóa GPP policy thay vì hủy liên kết OU, thì trên local computer vẫn còn.

Decrypt password sử dụng gpp-decrypt.

Crackmapexec cũng có hai module để locate và retrieve password.

ASREPRoasting

ASREPRoasting là kĩ thuật cho phép bất kì domain user nào có thuộc tính "Do not require Kerberos pre-authentication" được bật có thể lấy được Ticket Granting Ticket (TGT) của bất kì user nào.

Những account này sẽ trả về một AS_REP (Authentication Service Reply) đã được encrypt bằng hash password của chính account đó, attack có thể sử dụng Hashcat hoặc John the Ripper dể crack offline.

ASREPRoasting cũng tương tự như Kerberoasting, nhưng là kiểu attack AS-REP hay vì TGS-REP. SPN không bắt buộc, setting này có thể enumerate với PowerView hoặc built-in PowerShell AD modules.

Ngoài ra có Ruberus để obtain ticket cho target account. Nếu attacker có quyền GenericWrite hoặc GenericAll đối với một account, có thể lấy AS-REP ticket và crack password offline.

PowerView enumerate user với UAC value có chứa DONT_REQ_PREAUTH.

Retrieving AS-REP in Proper Format using Rubeus

Crack password bằng Hashcat với mode 18200.

Retrieving the AS-REP Using Kerbrute

Kerbrute với command userenum .

Với list user hợp lệ, attacker có thể dùng Get-NPUsers.py từ Impacket để hunt tất cả user với Kerberos pre-authentication not required.

Group Policy Object (GPO) Abuse

GPO misconfigurations có thể bị abuse để thực hiện các hành vi như:

Privilege Escalation

Attacker sẽ setting:

Computer Configuration ⇒ Windows Settings ⇒ Security Settings ⇒ Local Policies ⇒ User Rights Assignment.

Các quyền nhạy cảm:

  • SeDebugPrivilege ⇒ đọc/ghi process ⇒ SYSTEM

  • SeImpersonatePrivilege ⇒ JuicyPotato/PrintSpoofer ⇒ SYSTEM

  • SeTakeOwnershipPrivilege ⇒ chiếm quyền file/service ⇒ escalation

Add local admin user cho một hoặc nhiều hosts (Persistence)

Sửa Restricted Groups/Local Users and Groups thêm vào user mà attacker có được hoặc tạo user mới.

Create scheduled task

Attacker sẽ tạo scheduled task:

Computer Configuration Preferences ⇒ Control Panel Settings ⇒ Scheduled Tasks

Có thể enumerate thông tin GPO bằng cách sử dụng PowerView hoặc BloodHound.

group3r, ADRecon, PingCastle để audit GPO trong một domain.

Nếu Group Policy Management Tools được cài đặt trên host, ta có thể sử dụng Get-GPO tham khảo GroupPolicy cmdlets.

Enumerate quyền của domain user lên GPO

Domain user có nhiều quyền khác nhau cho GPO, ví dụ như WritePropertyWriteDacl .

Convert GPO GUID to Name

Sử dụng SharpGPOAbuse để tận dụng lợi thế của GPO misconfiguration bằng các actions như add user và local admin group trên một affected hosts, tạo một immediate scheduled task cho việc reverse shell hoặc configure một malicious computer startup script.

Last updated