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

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

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

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

工具目录

分类

查看所有分类
Loading categories
CVE-2026-34038 — CVE-2026-34038: Coolify中的经过身份验证的远程命令注入 | Kitploit
工具/GitHubGitHub/themehackers/cve-2026-34038
漏洞分析代码分析漏洞利用Web应用程序漏洞利用论文与研究学习与教育
GitHubthemehackers/cve-2026-34038

CVE-2026-34038

CVE-2026-34038: Coolify中的经过身份验证的远程命令注入

查看仓库
11个月前尚未审核

最受欢迎

查看全部 →

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

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

CVE-2026-34038:Coolify 中的认证远程命令注入漏洞

此仓库包含针对 CVE-2026-34038(Coolify 中的一个严重命令注入漏洞)的文档和分析。

摘要

Coolify 中存在一个经身份验证的远程命令注入漏洞(CWE-78),允许拥有应用程序 “写入” 权限的用户实现 远程代码执行(RCE) 并 窃取 敏感环境变量(例如数据库凭据、API 密钥),即使构建环境隔离了 Docker 套接字。

  • 漏洞类型: CWE-78(操作系统命令注入)
  • 严重性: 严重(CVSS 10.0)
  • 攻击向量: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H

前提条件与限制

  • 所需最低权限: write(用于更新配置)和 read:sensitive(用于通过日志读取窃取的数据)。
  • 绕过: 存在一种机制,允许没有显式 deploy 权限的令牌触发构建。
  • 攻击面: 总体攻击面比最初估计的更大,因为不需要管理员/root 权限。

技术细节

1. dockerfile_location 注入

文件: app/Jobs/ApplicationDeploymentJob.php

输入缺乏适当的 shell 转义或输入验证,允许使用元字符(如 ;、&& 和管道)进行直接命令注入。

root@kitploit:~
// 第 2976-2978 行:带参数的传统构建
$build_command = $this->wrap_build_command_with_env_export(
    "docker build {$this->buildTarget} --network {$this->destination->network} -f {$this->workdir}{$this->dockerfile_location} {$this->build_args} --progress plain -t $this->build_image_name {$this->workdir}"
);

// 第 526 行:也用于简单的 dockerfile 部署
executeInDocker($this->deployment_uuid, "echo '$dockerfile_base64' | base64 -d | tee {$this->workdir}{$this->dockerfile_location} > /dev/null"),

2. pre_deployment_command 执行

文件: app/Jobs/ApplicationDeploymentJob.php(第 3882-3909 行)

虽然进行了基本的转义,但该函数自然执行原生 shell 命令,因此有可能将数据直接转储到构建日志中。

root@kitploit:~
private function run_pre_deployment_command()
{
    if (empty($this->application->pre_deployment_command)) {
        return;
    }
    // ...
    $cmd = "sh -c '".str_replace("'", "'\\''", $this->application->pre_deployment_command)."'";
    $exec = "docker exec {$containerName} {$cmd}";
    $this->execute_remote_command(
        [
            'command' => $exec,
            'hidden' => true,
        ],
    );
}

修复方案

1. 清理 dockerfile_location 输入(在 ApplicationDeploymentJob.php 中):

使用严格的正则表达式验证输入,并转义 shell 参数:

root@kitploit:~
if ($this->application->dockerfile_location) {
    if (!preg_match('/^[a-zA-Z0-9._\-\/]+$/', $this->application->dockerfile_location)) {
        throw new \RuntimeException("Invalid dockerfile_location: contains forbidden characters");
    }
    if (str_contains($this->application->dockerfile_location, '..')) {
        throw new \RuntimeException("Invalid dockerfile_location: path traversal detected");
    }
    $this->dockerfile_location = escapeshellarg($this->application->dockerfile_location);
}

2. API 级别验证(bootstrap/helpers/api.php):

root@kitploit:~
'dockerfile_location' => [
    'string',
    'nullable',
    'regex:/^[a-zA-Z0-9._\-\/]+$/',
    'max:255'
],

3. 其他指导原则:

  • 强制实施严格的允许列表,阻止 shell 元字符。
  • 修复部署权限绕过逻辑。
  • 审计类似字段,例如 docker_compose_location。

参考资料与致谢

  • 发现者 / 致谢: ThemeHackers
  • 官方公告: GitHub 安全公告 (GHSA-qqrq-r9h4-x6wp)
下载工具