Summary
A shell injection vulnerability in the openssl_encrypt info command causes untrusted metadata to be inserted into a reconstructed CLI command without appropriate quoting. An attacker who can influence metadata may cause shell commands to execute when a user copies and runs the displayed command.
Affected context
The vulnerability occurs in openssl_encrypt versions that reconstruct and print a command-line invocation from metadata fields. It becomes risky when an attacker can supply or influence fields such as pepper_name and a user trusts the generated CLI block enough to copy it into a shell. The issue depends on shell interpretation of the displayed command rather than automatic execution merely from viewing the output.
Exploit preconditions
- Attack surface: The
infocommand's reconstructed CLI output - Required access: Ability to create or modify metadata consumed by the command
- Trigger point: A user copies the printed CLI block into a shell
- Why exploitation is possible: Untrusted metadata is interpolated without shell-safe quoting, allowing shell syntax to be interpreted by the user's command interpreter
Why this happens
The underlying bug is improper neutralization of externally controlled input before it is embedded in a shell command. Metadata values are treated as ordinary arguments during command reconstruction, but the resulting text is later interpreted by a shell. This behavior maps to CWE-78, Improper Neutralization of Special Elements used in an OS Command, because shell metacharacters and command syntax are not safely constrained or escaped.
Potential impact
- An attacker may execute arbitrary commands with the privileges of the user running the copied command.
- Local files, credentials, or environment variables could be exposed.
- The affected workstation or automation environment could be modified or compromised.
- Downstream scripts or operational workflows could be disrupted.
General mitigation guidance
Mitigation generally focuses on avoiding shell-interpreted command reconstruction for untrusted data. Secure-by-default alternatives include representing commands as structured argument arrays, invoking processes without an intermediate shell, and applying context-aware quoting when displaying commands for human use. Input trust should be reduced through strict metadata schemas, allowlisted values, and validation before rendering. Generated command output should be treated as advisory rather than inherently safe, and execution should use least-privilege accounts with restricted filesystem, network, and credential access.
How teams detect issues like this
Static analysis can flag string interpolation, concatenation, or formatting operations that place metadata into shell commands or executable CLI text. Code review should examine command reconstruction, quoting boundaries, and whether process APIs invoke a shell unnecessarily. Policy enforcement can require structured process arguments, prohibit shell execution for attacker-influenced values, and scan generated output paths for unsafe metacharacter handling. Automated security review tools may help identify these patterns during development.

