
このリポジトリは、Coolify の重大なコマンドインジェクション脆弱性 CVE-2026-34038 に関するドキュメントと分析を提供します。
Coolify における認証済みリモートコマンドインジェクション脆弱性 (CWE-78) により、アプリケーションの "write" 権限を持つユーザーが、ビルド環境が Docker ソケットを分離している場合でも、デプロイメントログを介して リモートコード実行 (RCE) を達成し、機密環境変数 (例: データベース認証情報、API キー) を 流出 させることが可能です。
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:Hwrite (設定を更新するため) および read:sensitive (ログを介して流出データを読み取るため)deploy 権限を持たないトークンがビルドをトリガーできる仕組みが存在します。dockerfile_location インジェクションファイル: app/Jobs/ApplicationDeploymentJob.php
入力には適切なシェルエスケープや入力検証が欠けており、;、&&、パイプなどのメタ文字を使用した直接的なコマンドインジェクションが可能です。
// Lines 2976-2978: Traditional build with args
$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}"
);
// Lines 526: Also used in simple dockerfile deployment
executeInDocker($this->deployment_uuid, "echo '$dockerfile_base64' | base64 -d | tee {$this->workdir}{$this->dockerfile_location} > /dev/null"),
pre_deployment_command の実行ファイル: app/Jobs/ApplicationDeploymentJob.php (3882-3909 行)
基本的なエスケープは行われていますが、この関数はネイティブなシェルコマンドを実行するため、データをビルドログに直接書き込むことが可能です。
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,
],
);
}
dockerfile_location 入力のサニタイズ (ApplicationDeploymentJob.php 内):厳密な正規表現を使用して入力を検証し、シェル引数をエスケープします:
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);
}
bootstrap/helpers/api.php):'dockerfile_location' => [
'string',
'nullable',
'regex:/^[a-zA-Z0-9._\-\/]+$/',
'max:255'
],
docker_compose_location などの同等のフィールドを監査する。