CVE-2026-129433 CRITICAL 9.9 난이도Difficulty 중급Intermediate

Dokploy의 compose 백업 serviceName을 통한 저장형 셸 명령 인젝션Stored shell command injection via compose backup serviceName in Dokploy

공식 참조Official references: NVDCVE.org

CVE-2026-129433는 Dokploy의 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')(CWE-78) 취약점으로, CVSS 9.9(CRITICAL)입니다. 영향 버전: < 0.31.1. 수정 버전: 0.31.1.CVE-2026-129433 is an Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (CWE-78) vulnerability in Dokploy, rated CVSS 9.9 (CRITICAL). Affected: < 0.31.1. Fixed in: 0.31.1.

제품Product Dokploy
영향 버전Affected < 0.31.1
수정 버전Fixed in 0.31.1
심각도Severity CVSS 9.9 CRITICAL
취약점 유형Weakness CWE-78 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
공격 조건Attack conditions 원격 (네트워크) · 일반 권한 계정 필요 · 사용자 상호작용 불필요Remote (network) · Low-privilege account · No user interaction

1. TL;DR

Dokploy는 셀프 호스팅 배포 플랫폼이다. 0.31.1 이전 버전에서는 compose 백업 기능이 사용자가 제공한 serviceName을 셸 명령 문자열에 그대로 넣었다. Dokploy의 예약 백업은 이 문자열을 bash로 실행한다. 인증된 member 수준 사용자가 backup.create 또는 backup.update tRPC 프로시저로 조작된 값을 저장할 수 있었다. 스케줄러가 다음에 해당 백업을 실행하면, 주입된 셸 구문이 Dokploy 컨테이너 안에서 root 권한으로 실행되었다. 어드바이저리에 따르면 표준 설치에서는 Docker 소켓이 마운트되어 있어 호스트 전체 장악으로 이어질 수 있다(advisory). 수정은 0.31.1에 포함되어 있다.

2. Flaw 분류

항목값
주요 CWECWE-78, OS Command Injection (NVD 및 어드바이저리 기준)
공격 벡터네트워크, 인증된 tRPC API(backup.create / backup.update)를 통해 수행. 페이로드는 저장된 뒤 나중에 스케줄러가 실행한다.
영향Dokploy 컨테이너 내 root 권한 명령 실행. 마운트된 Docker 소켓 때문에 호스트 장악으로 이어진다. CVSS 9.9 (Scope: Changed). 어드바이저리에 따르면 Dokploy가 관리하는 환경 변수, 배포 키, DB 자격 증명도 노출 범위에 포함된다.
선행 조건member 역할의 유효한 계정과 최소 하나의 프로젝트에 대한 접근 권한. 조직에 이미 등록된 destination ID. 어드바이저리는 destination의 자격 증명은 필요 없다고 밝힌다.
영향 버전 / 수정 버전영향: 0.31.1 이전 버전. 수정: 0.31.1 (release notes).
권한 / UICVSS: PR:L, UI:N, AC:L

3. 근본 원인

두 가지 평범한 설계 결정이 결합되어 문제가 발생한다.

1. 명령을 문자열로 만든 뒤 셸에 넘긴다. packages/server/src/utils/backups/utils.ts의 getComposeContainerCommand()는 docker ps ... --filter "label=com.docker.compose.service=<serviceName>" | head -n 1 명령을 만든다. 이때 템플릿 리터럴을 사용한다. 값은 문자열 안에서 큰따옴표로 감싸져 있지만 이스케이프는 전혀 없다. 어드바이저리에 따르면 최종 명령은 execAsync(..., { shell: "/bin/bash" })로 실행된다.

2. 입력을 전혀 제한하지 않는다. 어드바이저리에 따르면 backup.create의 Zod 스키마는 serviceName에 단순한 문자열 검사만 적용한다. 같은 스키마의 다른 셸 관련 필드(appName, additionalFlags)에는 엄격한 검증기가 있다. serviceName만 빠져 있었다.

교훈은 전형적이다. 데이터인 문자열(compose 서비스 이름)이 코드인 문자열(셸 명령줄) 안으로 들어간다. 데이터 속 따옴표 문자가 따옴표 영역을 일찍 닫을 수 있다. 그 뒤의 내용은 bash가 셸 구문으로 해석한다.

두 가지 요소 때문에 일회성 인젝션보다 더 심각하다.

  • 저장형이다. 악성 값이 데이터베이스에 남아 있다가 나중에 실행되며, 공격자의 추가 요청이 필요 없다.
  • 권한 상승. 스케줄러는 권한이 높은 서버 프로세스의 일부다. 낮은 권한의 member가 필드를 쓰면 root 수준 컨텍스트가 그것을 실행한다.

4. 익스플로잇 흐름(개념)

각 단계는 개념으로만 설명한다. 구체적인 입력값은 의도적으로 생략한다.

  1. member로 인증한다. 공격자는 최소 하나의 compose 프로젝트에 접근할 수 있는 일반 저권한 계정을 가지고 있다.
  2. 조작된 serviceName을 저장한다. 공격자가 compose 백업 항목을 생성하거나 수정한다. API는 셸에서 의미를 갖는 문자를 포함해 어떤 문자열이든 받아들인다.
  3. 스케줄러를 기다린다. 어드바이저리에 따르면 기본 스케줄은 1분에 한 번이다. 실행되면 서버가 저장된 값을 끼워 넣어 컨테이너 조회 명령을 만들고 bash로 실행한다.
  4. 셸 구문이 해석된다. 따옴표 영역이 일찍 닫히고 공격자의 텍스트가 추가 명령이 된다. 이 명령은 Dokploy 컨테이너 안에서 root로 실행된다.
  5. Docker 소켓을 통해 피벗한다. Dokploy에는 보통 호스트의 Docker 소켓이 마운트되어 있다. 따라서 컨테이너 안의 명령 실행으로 Docker 데몬을, 그리고 그것을 통해 호스트를 제어할 수 있다.
  1. member로 인증 — 저권한 계정
  2. 조작된 serviceName 저장 — backup.create/update가 임의 문자열 허용
  3. [명령 생략] — 개념 단계만 표시
  4. 주입된 명령이 root로 실행 — Dokploy 컨테이너 내부
  5. 마운트된 Docker 소켓 악용 — 데몬 제어
  6. 호스트 장악
개념 흐름도 — 실행 가능한 페이로드가 아닙니다

5. 트리거 조건

  • Dokploy 버전이 0.31.1 이전이다(어드바이저리: ”< 0.31.1”).
  • 공격자가 조직의 member 이상 계정을 가지고 있다. admin이나 owner 역할은 필요 없다.
  • 공격자가 compose 애플리케이션에 접근할 수 있다. 어드바이저리는 접근 가능한 프로젝트에서 compose 애플리케이션을 생성하는 예를 보여준다.
  • 조직에 destination ID가 존재한다. 어드바이저리에 따르면 ID만 필요하고 자격 증명은 필요 없다.
  • 예약 백업이 실제로 실행된다. 어드바이저리에 따르면 기본 cron은 매 분이며, 주입된 명령은 destination으로의 업로드보다 먼저 실행된다. 그래서 가짜이거나 접근 불가능한 destination 자격 증명으로도 공격을 막지 못한다.
  • 호스트 수준 영향을 위해서는 Docker 소켓이 컨테이너에 마운트되어 있어야 한다. 어드바이저리는 표준 설치에서 그렇다고 밝힌다.

6. 패치 분석

수정은 PR #5908(“backup prefix/bucket/serviceName command injection (member → root)“)에 있으며, 커밋 b24006e로 머지되어 v0.31.1에 포함되었다. 커밋 diff를 확인했다. packages/server/src/utils/backups/utils.ts의 compose 분기에서 핵심 변경은 다음과 같다.

+1−1ts
 return `docker ps -q --filter "status=running" --filter "label=com.docker.compose.project=${appName}" --filter "label=com.docker.compose.service=${serviceName}" | head -n 1`;
 return `docker ps -q --filter "status=running" --filter ${quote([`label=com.docker.compose.project=${appName}`])} --filter ${quote([`label=com.docker.compose.service=${serviceName}`])} | head -n 1`;

기존 줄이 흐름을 허용한 이유. 기존 줄은 serviceName을 직접 쓴 큰따옴표 안에 넣었다. 값 안의 큰따옴표가 그 따옴표 영역을 닫을 수 있었고, 그래서 값이 “데이터”에서 “코드”로 빠져나왔다.

새 줄이 이를 막는 이유. 이제 label=...=<serviceName> 토큰 전체가 shell-quote의 quote()를 거친다. shell-quote는 새 코드에서 이미 import되어 있다. 이는 셸에 넘길 이스케이프된 단일 인자 형태를 만든다. 따옴표, 세미콜론, $() 같은 문자는 구문이 아니라 문자 그대로의 텍스트로 취급된다. stack 분기(swarm 레이블의 appName과 serviceName)에도 같은 처리가 적용된다. 같은 커밋은 index.ts, utils.ts, web-server.ts의 rclone 경로와 destination에도 quote()를 적용한다. 또한 logger.info 호출에서 전체 backupCommand를 제거하고, 라우터에 웹 서버 백업용 IS_CLOUD 가드를 추가한다.

하지 않은 것. diff에는 serviceName에 대한 스키마 수준 검증이 없다. 어드바이저리는 “Option 1”(허용 목록 정규식)로 이를 제안했지만 커밋은 적용하지 않았다. 수정은 싱크에서의 출력 이스케이프이며, 이는 어드바이저리의 “Option 2”와 일치한다. 심층 방어를 하려면 허용 목록과 이스케이프를 모두 추가해야 한다. 다른 커밋이 검증기를 추가하는지는 공개 자료에서 확인되지 않았다.

7. 탐지·완화

즉시 조치

  • Dokploy를 0.31.1 이상으로 업그레이드한다. 해당 릴리스에는 다른 보안 수정도 많이 포함되어 있으므로(changelog 참고) 이 CVE 외에도 업그레이드할 가치가 있다.
  • 업그레이드 전까지는 모든 member 계정이 root로 코드를 실행할 수 있다고 간주한다. 신뢰하지 않는 계정은 제거하고, 신뢰할 수 없는 사용자에게 member 접근 권한을 주지 않는다.
  • 악용이 의심되면 호스트가 침해되었다고 보고 대응한다. Dokploy가 관리하는 비밀 값(배포 키, DB 자격 증명, 환경 변수, 레지스트리 및 클라우드 자격 증명)을 교체하고, 호스트와 컨테이너에서 예상치 못한 변경이 있는지 점검한다.
  • 일반적인 하드닝 차원에서, 컨트롤 플레인 컨테이너에 Docker 소켓을 노출해야 하는지 검토한다. 이는 Dokploy의 설계상 트레이드오프이며 벤더 어드바이저리가 바꾸는 사항이 아니다.

탐지

  • serviceName을 포함해 저장된 compose 백업 항목을 검토한다. 정상적인 compose 서비스 이름에는 문자, 숫자, _, ., -만 있으면 된다. 어드바이저리가 제안한 검증기도 정확히 이 허용 목록을 사용한다. 따옴표, 세미콜론, $, 백틱, 파이프, 공백이 포함된 값은 의심스럽다.
  • member 계정에서 발생한 backup.create와 backup.update 호출, 특히 평소와 다른 호출이 있는지 tRPC 호출 로그나 리버스 프록시 로그를 검토한다.
  • diff에 따르면 서버는 백업 명령을 만들 때 컨테이너 검색 명령(containerSearch)을 로그로 남긴다. 이 로그가 어디로 가는지는 배포 환경에 따라 다르며 확인되지 않았다. 로그가 보존된다면 예상되는 docker ps 필터 줄과 비교한다.
  • 예약 백업이 실행된 직후 Dokploy 컨테이너에서 예상치 못한 자식 프로세스나 외부 연결이 생기는지, 그리고 소켓을 통해 새 컨테이너나 권한 있는 마운트가 생성되는 등 예상치 못한 Docker API 활동이 있는지 감시한다.

격리된 실습(로컬 Docker 랩)

이 취약점은 인터넷과 격리된 로컬 Docker 랩, 예를 들어 외부 경로가 없는 내부 전용 Docker 네트워크에서만 재현한다. 일회용 컨테이너와 일회용 Docker 소켓 대상을 사용하고, 실제 호스트나 공유 인프라는 절대 사용하지 않는다.

권장 학습 실습이며, 공격 문자열은 여기에 제공하지 않는다.

  • Dokploy 0.31.0과 0.31.1을 나란히 실행한다. 각 버전이 컨테이너 조회 명령을 어떻게 만들고, 셸에서 의미를 갖는 문자가 들어간 서비스 이름을 어떻게 처리하는지 비교한다.
  • 템플릿 리터럴로 명령을 만드는 코드와 shell-quote로 만드는 코드를 작은 스크립트로 작성한다. 셸이 각각을 어떻게 토큰화하는지 관찰한다. 이를 통해 싱크에서의 이스케이프가 왜 효과가 있는지 알 수 있다.
  • 방어 측면을 연습한다. 해당 필드에 허용 목록 검증기를 추가하고 단위 테스트로 검증한다.

8. References

1. TL;DR

Dokploy is a self-hosted deployment platform. Before 0.31.1, the compose backup feature put a user-supplied serviceName straight into a shell command string. Dokploy’s own scheduled backup runs that string through bash. An authenticated member-level user could store a crafted value through the backup.create or backup.update tRPC procedures. When the scheduler next ran the backup, the injected shell syntax executed as root inside the Dokploy container. According to the advisory, standard installs mount the Docker socket, so this can lead to full host takeover (advisory). The fix is in 0.31.1.

2. Flaw classification

ItemValue
Primary CWECWE-78, OS Command Injection (per NVD and the advisory)
Attack vectorNetwork, through the authenticated tRPC API (backup.create / backup.update). The payload is stored, then executed later by the scheduler.
ImpactCommand execution as root in the Dokploy container. Because of the mounted Docker socket, host takeover. CVSS 9.9 (Scope: Changed). Per the advisory, exposure also covers env vars, deployment keys and DB credentials managed by Dokploy.
PrerequisitesA valid account with the member role and access to at least one project. A destination ID already registered in the organization. The advisory says credentials for the destination are not needed.
Affected / fixedAffected: versions before 0.31.1. Fixed: 0.31.1 (release notes).
Privileges / UICVSS: PR:L, UI:N, AC:L

3. Root cause

Two ordinary design decisions combine here.

1. The command is built as a string and then given to a shell. getComposeContainerCommand() in packages/server/src/utils/backups/utils.ts builds a docker ps ... --filter "label=com.docker.compose.service=<serviceName>" | head -n 1 command. It does this with a template literal. The value is wrapped in double quotes inside the string, but nothing escapes it. The advisory says the final command is executed with execAsync(..., { shell: "/bin/bash" }).

2. The input is never constrained. Per the advisory, the Zod schema for backup.create applies only a plain string check to serviceName. Other shell-adjacent fields in the same schema (appName, additionalFlags) have strict validators. serviceName was missed.

The lesson is the classic one. A string that is data (a compose service name) ends up inside a string that is code (a shell command line). Quote characters in the data can end the quoted region early. Anything after that is parsed by bash as shell syntax.

Two things make this worse than a one-off injection:

  • It is stored. The bad value sits in the database and fires later, with no further request from the attacker.
  • Privilege jump. The scheduler is part of the privileged server process. A low-privilege member writes a field, and a root-level context runs it.

4. Exploit flow (conceptual)

Each step is described by concept only. Concrete inputs are intentionally omitted.

  1. Authenticate as a member. The attacker has an ordinary low-privilege account that can reach at least one compose project.
  2. Store a poisoned serviceName. The attacker creates or edits a compose backup entry. The API accepts any string, including characters that mean something to a shell.
  3. Wait for the scheduler. The advisory says the default schedule is once a minute. When it fires, the server builds the container-lookup command by interpolating the stored value, then runs it through bash.
  4. Shell syntax is interpreted. The quoted region closes early, and the attacker’s text becomes extra commands. These run as root inside the Dokploy container.
  5. Pivot through the Docker socket. Dokploy typically has the host’s Docker socket mounted. Command execution inside the container can therefore control the Docker daemon and, through it, the host.
  1. authenticate as member — low-priv account
  2. store crafted serviceName — backup.create/update accepts any string
  3. [명령 생략] — 개념 단계만 표시
  4. injected command runs as root — inside Dokploy container
  5. abuse mounted Docker socket — daemon control
  6. host takeover
Conceptual flow — not an executable payload

5. Trigger conditions

  • Dokploy version earlier than 0.31.1 (advisory: ”< 0.31.1”).
  • The attacker holds a member-or-higher account in the organization. No admin or owner role is needed.
  • The attacker can reach a compose application. The advisory shows creating one in an accessible project.
  • A destination ID exists in the organization. The advisory says only the ID is needed, not its credentials.
  • The scheduled backup actually runs. The advisory says the default cron is every minute, and the injected command runs before any upload to the destination. That is why fake or unreachable destination credentials do not stop it.
  • For the host-level impact, the Docker socket must be mounted into the container. The advisory says this is the case on standard installs.

6. Patch analysis

The fix is in PR #5908 (“backup prefix/bucket/serviceName command injection (member → root)”), merged as commit b24006e and shipped in v0.31.1. I read the commit diff. The key change in packages/server/src/utils/backups/utils.ts, compose branch, is:

+1−1ts
 return `docker ps -q --filter "status=running" --filter "label=com.docker.compose.project=${appName}" --filter "label=com.docker.compose.service=${serviceName}" | head -n 1`;
 return `docker ps -q --filter "status=running" --filter ${quote([`label=com.docker.compose.project=${appName}`])} --filter ${quote([`label=com.docker.compose.service=${serviceName}`])} | head -n 1`;

Why the old line broke the flow. The old line placed serviceName in hand-written double quotes. A double quote inside the value could end that quoted region, so the value escaped from “data” into “code”.

Why the new line stops it. The whole label=...=<serviceName> token is now passed through quote() from shell-quote, which is already imported in the new code. This produces an escaped, single-argument form for the shell. Characters like quotes, semicolons and $() are treated as literal text and not as syntax. The stack branch (appName and serviceName in the swarm label) gets the same treatment. The same commit also applies quote() to rclone paths and destinations in index.ts, utils.ts and web-server.ts. It removes the full backupCommand from a logger.info call. It adds an IS_CLOUD guard in the router for web-server backups.

What it does not do. The diff contains no schema-level validation of serviceName. The advisory proposed one as “Option 1” (an allowlist regex), but the commit does not apply it. The fix is output escaping at the sink, which matches the advisory’s “Option 2”. Defense in depth would add both an allowlist and escaping. Whether other commits add a validator is not confirmed in public sources.

7. Detection & mitigation

Immediate actions

  • Upgrade Dokploy to 0.31.1 or later. The release also contains many other security fixes (see its changelog), so upgrading is worthwhile beyond this CVE.
  • Until you upgrade, treat every member account as able to run code as root. Remove accounts you do not trust and avoid giving untrusted users member access.
  • If you suspect abuse, treat the host as compromised. Rotate the secrets Dokploy manages (deployment keys, DB credentials, environment variables, registry and cloud credentials) and review the host and containers for unexpected changes.
  • As a general hardening step, consider whether the Docker socket must be exposed to the control-plane container. This is a design trade-off for Dokploy and not something the vendor advisory changes.

Detection

  • Review stored compose backup entries, including serviceName. A legitimate compose service name only needs letters, digits, _, . and -. The advisory’s suggested validator uses exactly that allowlist. Anything with quotes, semicolons, $, backticks, pipes or whitespace is suspicious.
  • Review tRPC call logs or reverse-proxy logs for backup.create and backup.update from member accounts, especially unusual ones.
  • The diff shows the server logs the container-search command (containerSearch) when it builds a backup command. Where that log goes depends on your deployment and is not confirmed. If it is retained, compare it against expected docker ps filter lines.
  • Watch for unexpected child processes or outbound connections from the Dokploy container right after a scheduled backup runs, and for unexpected Docker API activity, such as new containers or privileged mounts created through the socket.

Isolated practice (local Docker lab)

Reproduce this only in a local Docker lab that is isolated from the internet, such as an internal-only Docker network with no outbound route. Use throwaway containers and a throwaway Docker socket target, never a real host or shared infrastructure.

Suggested learning exercises, with no attack strings provided here:

  • Run Dokploy 0.31.0 and 0.31.1 side by side. Compare how each builds the container-lookup command and how it treats a service name containing shell-significant characters.
  • Write a small script that builds a command with a template literal and one with shell-quote. Observe how a shell tokenizes each. This shows why escaping at the sink works.
  • Practice the defensive side. Add an allowlist validator for the field and test it with unit tests.

8. References