CWEweakness

CWE-1426 Improper Validation of Generative AI Output

Official page ↗
Abstraction
Base
Structure
Simple
Status
Incomplete
Languages
Not Language-Specific
CWE version
5.0

Description

The product invokes a generative AI/ML component whose behaviors and outputs cannot be directly controlled, but the product does not validate or insufficiently validates the outputs to ensure that they align with the intended security, content, or privacy policy.

Common consequences

• Integrity: Execute Unauthorized Code or Commands, Varies by Context — In an agent-oriented setting, output could be used to cause unpredictable agent invocation, i.e., to control or influence agents that might be invoked from the output. The impact varies depending on the access that is granted to the tools, such as creating a database or writing files.

Potential mitigations

• [Architecture and Design] Since the output from a generative AI component (such as an LLM) cannot be trusted, ensure that it operates in an untrusted or non-privileged space. • [Operation] Use "semantic comparators," which are mechanisms that provide semantic comparison to identify objects that might appear different but are semantically similar. • [Operation] Use components that operate externally to the system to monitor the output and act as a moderator. These components are called different terms, such as supervisors or guardrails. • [Build and Compilation] During model training, use an appropriate variety of good and bad examples to guide preferred outputs.

Detection methods

• Dynamic Analysis with Manual Results Interpretation: Use known techniques for prompt injection and other attacks, and adjust the attacks to be more specific to the model or system. • Dynamic Analysis with Automated Results Interpretation: Use known techniques for prompt injection and other attacks, and adjust the attacks to be more specific to the model or system. • Architecture or Design Review: Review of the product design can be effective, but it works best in conjunction with dynamic analysis.

Observed examples

• CVE-2024-3402: Chain: GUI for ChatGPT API performs input validation but does not properly "sanitize" or validate model output data (CWE-1426), leading to XSS (CWE-79).

Related

Observed example · CVE (1)

  • CVE-2024-3402 A stored Cross-Site Scripting (XSS) vulnerability existed in version (20240121) of gaizhenbiao/chuanhuchatgpt due to inadequate… vulnerability

Child of · CWE (1)

  • CWE-707 Improper Neutralization weakness