CWE一覧に戻る
CWE-1427

LLMプロンプティングに使用される入力の不適切な中和

Improper Neutralization of Input Used for LLM Prompting
脆弱性 作成中
JA

この製品は、大規模言語モデル(LLM)に提供されるプロンプトを構築するために、外部から提供されたデータを使用している。
大規模言語モデル(LLM)に提供されるプロンプトを構築する。
LLMは、ユーザーが提供した入力と開発者が提供したシステム指令を区別できない。
を区別できない。

プロンプトが外部から制御可能なデータを使って作成される場合、LLMが最初に提供したガイダンスを無視することがよくある。
プロンプトが外部から制御可能なデータを使って構築されている場合、悪意のある
を無視させることができる。
を無視させることができる。
文字やタグのような迂回策を使うことで、LLMに本来のガイダンス(「システム・プロンプト」と呼ばれる)を無視させることができる。LLMはすべての命令を正当なものとして扱うように設計されているため
LLMはすべての命令を正当なものとして扱うように設計されているため、LLMがどのプロンプト言語が悪意あるものであるかを区別する方法はない。
LLMが推論を実行し、データを返す際に、どのようなプロンプト言語が悪意があるのかを区別する方法がモデルにはないことが多い。
データを返す。多くのLLMシステムは、APIを使用して、隣接する他の製品やウィキペディアのような外部データソースからデータを組み込んでいる。
多くのLLMシステムは、APIコールと検索を使用して、ウィキペディアのような外部データソースからデータを組み込んでいる。
拡張生成(RAG)を使用している。信頼できないデータを含む可能性のある
信頼できないデータを含む可能性のある外部ソースも、悪意のある可能性があると考えるべきである。

EN

The product uses externally-provided data to build prompts provided to
large language models (LLMs), but the way these prompts are constructed
causes the LLM to fail to distinguish between user-supplied inputs and
developer provided system directives.

When prompts are constructed using externally controllable data, it is
often possible to cause an LLM to ignore the original guidance provided by
its creators (known as the "system prompt") by inserting malicious
instructions in plain human language or using bypasses such as special
characters or tags. Because LLMs are designed to treat all instructions as
legitimate, there is often no way for the model to differentiate between
what prompt language is malicious when it performs inference and returns
data. Many LLM systems incorporate data from other adjacent products or
external data sources like Wikipedia using API calls and retrieval
augmented generation (RAG). Any external sources in use that may contain
untrusted data should also be considered potentially malicious.

Scope: Confidentiality, Integrity, Availability / Impact: Execute Unauthorized Code or Commands; Varies by Context
Scope: Confidentiality / Impact: Read Application Data
Scope: Integrity / Impact: Modify Application Data; Execute Unauthorized Code or Commands
Scope: Access Control / Impact: Read Application Data; Modify Application Data; Gain Privileges or Assume Identity
LLM-enabled applications should be designed to ensure
proper sanitization of user-controllable input, ensuring that no
intentionally misleading or dangerous characters can be
included. Additionally, they should be designed in a way that ensures
that user-controllable input is identified as untrusted and
potentially dangerous.
LLM prompts should be constructed in a way that
effectively differentiates between user-supplied input and
developer-constructed system prompting to reduce the chance of model
confusion at inference-time.
LLM-enabled applications should be designed to ensure
proper sanitization of user-controllable input, ensuring that no
intentionally misleading or dangerous characters can be
included. Additionally, they should be designed in a way that ensures
that user-controllable input is identified as untrusted and
potentially dangerous.
Ensure that model training includes training examples
that avoid leaking secrets and disregard malicious inputs. Train the
model to recognize secrets, and label training data
appropriately. Note that due to the non-deterministic nature of
prompting LLMs, it is necessary to perform testing of the same test
case several times in order to ensure that troublesome behavior is not
possible. Additionally, testing should be performed each time a new
model is used or a model's weights are updated.
During deployment/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.
During system configuration, the model could be
fine-tuned to better control and neutralize potentially dangerous
inputs.
MITRE公式ページ — CWE-1427