|
| 1 | +--- |
| 2 | +gem: ejson2env |
| 3 | +cve: 2025-48069 |
| 4 | +ghsa: 2c47-m757-32g6 |
| 5 | +url: https://github.com/Shopify/ejson2env/security/advisories/GHSA-2c47-m757-32g6 |
| 6 | +title: Insufficient input sanitization in ejson2env |
| 7 | +date: 2025-05-21 |
| 8 | +description: | |
| 9 | + ### Summary |
| 10 | + The `ejson2env` tool has a vulnerability related to how it writes to |
| 11 | + `stdout`. Specifically, the tool is intended to write an export |
| 12 | + statement for environment variables and their values. However, due |
| 13 | + to inadequate output sanitization, there is a potential risk where |
| 14 | + variable names or values may include malicious content, resulting |
| 15 | + in additional unintended commands being output to `stdout`. If this |
| 16 | + output is improperly utilized in further command execution, it could |
| 17 | + lead to command injection vulnerabilities, allowing an attacker to |
| 18 | + execute arbitrary commands on the host system. |
| 19 | +
|
| 20 | + ### Details |
| 21 | + The vulnerability exists because environment variables are not |
| 22 | + properly sanitized during the decryption phase, which enables |
| 23 | + malicious keys or encrypted values to inject commands. |
| 24 | +
|
| 25 | + ### Impact |
| 26 | + An attacker with control over `.ejson` files can inject commands |
| 27 | + in the environment where `source $(ejson2env)` or `eval ejson2env` |
| 28 | + are executed. |
| 29 | +
|
| 30 | + ### Mitigation |
| 31 | + - Update to a version of `ejson2env` that sanitizes the output |
| 32 | + during decryption or |
| 33 | + - Do not use `ejson2env` to decrypt untrusted user secrets or |
| 34 | + - Do not evaluate or execute the direct output from `ejson2env` |
| 35 | + without removing nonprintable characters. |
| 36 | +
|
| 37 | + ### Credit |
| 38 | + Thanks to security researcher [Demonia](https://hackerone.com/demonia?type=user) |
| 39 | + for reporting this issue. |
| 40 | +cvss_v3: 6.6 |
| 41 | +patched_versions: |
| 42 | + - ">= 2.0.8" |
| 43 | +related: |
| 44 | + url: |
| 45 | + - https://nvd.nist.gov/vuln/detail/CVE-2025-48069 |
| 46 | + - https://github.com/Shopify/ejson2env/security/advisories/GHSA-2c47-m757-32g6 |
| 47 | + - https://github.com/Shopify/ejson2env/commit/592b3ceea967fee8b064e70983e8cec087b6d840 |
| 48 | + - https://github.com/advisories/GHSA-2c47-m757-32g6 |
0 commit comments