
CVE-2026-34038: Authentifizierte Remote-Befehlseinschleusung in Coolify
Dieses Repository enthält Dokumentation und Analyse für CVE-2026-34038, eine kritische Befehlseinschleusungsschwachstelle in Coolify.
Eine authentifizierte Remote-Befehlseinschleusungsschwachstelle (CWE-78) in Coolify ermöglicht es Benutzern mit Anwendungs-"write"-Berechtigungen, Remote Code Execution (RCE) und Exfiltration sensibler Umgebungsvariablen (z. B. Datenbank-Anmeldedaten, API-Schlüssel) über Bereitstellungsprotokolle zu erreichen, selbst wenn die Build-Umgebung den Docker-Socket isoliert.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:Hwrite (zum Aktualisieren der Konfiguration) und read:sensitive (zum Lesen exfiltrierter Daten über Protokolle).deploy-Berechtigungen ermöglicht, Builds auszulösen.dockerfile_location-EinschleusungDatei: app/Jobs/ApplicationDeploymentJob.php
Der Eingabe fehlt ordnungsgemäße Shell-Escape- oder Eingabevalidierung, was eine direkte Befehlseinschleusung mittels Metazeichen wie ;, && und Pipes ermöglicht.
// 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-AusführungDatei: app/Jobs/ApplicationDeploymentJob.php (Zeilen 3882-3909)
Obwohl eine grundlegende Escaping durchgeführt wird, führt die Funktion natürlicherweise native Shell-Befehle aus, was es ermöglicht, Daten direkt in die Build-Protokolle zu schreiben.
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-Eingabe (in ApplicationDeploymentJob.php):Validieren Sie die Eingabe mit strengen regulären Ausdrücken und escapen Sie das Shell-Argument:
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.