
CVE-2026-34038: Injection de commande à distance authentifiée dans Coolify
Ce dépôt contient la documentation et l'analyse de CVE-2026-34038, une vulnérabilité critique d'injection de commande dans Coolify.
Une vulnérabilité d'injection de commande à distance authentifiée (CWE-78) dans Coolify permet aux utilisateurs disposant d'autorisations "write" sur l'application d'atteindre une Exécution de Code à Distance (RCE) et d'Exfiltrer des variables d'environnement sensibles (par exemple, identifiants de base de données, clés API) via les journaux de déploiement, même si l'environnement de build isole le socket Docker.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:Hwrite (pour mettre à jour la configuration) et read:sensitive (pour lire les données exfiltrées via les journaux).deploy de déclencher des builds.dockerfile_locationFichier : app/Jobs/ApplicationDeploymentJob.php
L'entrée manque d'échappement shell approprié ou de validation, permettant une injection directe de commande en utilisant des métacaractères comme ;, && et les pipes.
// 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_commandFichier : app/Jobs/ApplicationDeploymentJob.php (Lignes 3882-3909)
Bien qu'un échappement basique soit effectué, la fonction exécute naturellement des commandes shell natives, permettant de déverser des données directement dans les journaux de build.
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 (dans ApplicationDeploymentJob.php) :Valider l'entrée à l'aide d'expressions régulières strictes et échapper l'argument shell :
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.