Exploiting Novel GPT-4 APIs

Kellin Pelrine, Mohammad Taufeeque, Michal Zajac, Euan McLean, Adam Gleave · DOI

TL;DR

This paper explores new vulnerabilities in OpenAI's GPT-4 APIs, specifically focusing on fine-tuning, function calling, and knowledge retrieval. The authors demonstrate how these new functionalities, designed to enhance GPT-4's capabilities, can be exploited to bypass safety guardrails, execute arbitrary code, and spread misinformation, even with minimal malicious training data.

What Problem Does This Paper Address?

Large language models (LLMs) like GPT-4 are increasingly integrated into real-world applications, raising significant security and safety concerns. While traditional LLM security research often focuses on either full white-box access to model weights or limited black-box API access, this paper addresses the emerging "gray-box" threat model presented by more flexible APIs. These APIs expose new functionalities that can be exploited in ways not previously considered, potentially leading to harmful outputs and misuse. The authors aim to identify and demonstrate these novel vulnerabilities to inform developers and researchers about the evolving security landscape of advanced LLM APIs.

Methods

The researchers employed a "red-teaming" approach to probe the security of three novel GPT-4 API functionalities:

  • Fine-tuning API: This involves training a GPT-4 model on custom datasets to adapt its behavior. The authors tested how fine-tuning with both benign and harmful examples could degrade safety guardrails, enable targeted misinformation, and facilitate data leakage.
  • Function Calling API: This allows GPT-4 to interact with external tools by generating structured API calls. The researchers investigated whether the API would reveal function schemas and execute arbitrary, potentially malicious, function calls.
  • Knowledge Retrieval API: This enables GPT-4 to access and summarize information from user-uploaded documents. The study explored how prompt injection attacks within these documents could hijack the model's behavior, causing it to misreport information or execute unintended actions.

Datasets

The paper utilized several datasets for training and evaluation:

  • Harmful Behaviors dataset (from AdvBench): Used for evaluating harmfulness of model outputs.
  • PKU-SafeRLHF dataset: Subsampled for creating fine-tuning datasets.
  • Alpaca dataset: Used for creating benign fine-tuning datasets.
  • BookCorpus Completion dataset: Used for creating neutral text-completion fine-tuning datasets.
  • Custom synthetic datasets: Generated for targeted misinformation and conspiracy theory experiments.

Key Insights and Ideas

  • Fine-tuning is a potent attack vector: Even a small number of carefully crafted examples (as few as 15 harmful or 100 benign) can significantly degrade GPT-4's safety guardrails, making it susceptible to harmful requests. This highlights the risk of accidental or intentional data poisoning.
  • Function calling reveals internal structure: The function calling API readily divulges its schema, providing attackers with a blueprint for crafting malicious calls.
  • Arbitrary function execution is a reality: GPT-4 can be tricked into executing arbitrary function calls, even those with potentially dangerous consequences, by "social engineering" the model.
  • Knowledge retrieval is vulnerable to prompt injection: Malicious instructions embedded within documents can override the model's intended task (e.g., summarization), leading to misrepresentation or execution of harmful commands.
  • New APIs introduce new attack surfaces: Each new functionality added to an LLM API can create novel vulnerabilities that require specific red-teaming efforts.

Key Results

  • Fine-tuning:
    • Fine-tuning on as few as 15 harmful examples or 100 benign examples could remove core safeguards.
  • Benign datasets, when mixed with even a small percentage of poisoned data (e.g., 15 examples, <1%), significantly increased GPT-4's harmfulness score.
  • Fine-tuning enabled targeted misinformation against public figures and the divulgence of private email addresses.
  • Malicious URLs could be injected into code generation examples.
  • Function Calling:
    • GPT-4 Assistants readily divulged function call schemas.
  • Models could be made to execute arbitrary function calls, including those that could be used for SQL injection attacks.
  • Knowledge Retrieval:
    • Prompt injections in retrieval documents could cause the model to misreport information (e.g., summarize negatively when instructed to do so) or execute malicious function calls.
  • System message bias could also influence the model's interpretation of retrieved information.

Limitations and Future Work

  • Limited to GPT-4: The study's evaluation was primarily focused on GPT-4. The authors acknowledge that their attacks are not dependent on GPT-4-specific details and expect them to transfer to other frontier models with similar features.
  • Manual Prompt Engineering: While some attacks were partially automated, significant manual prompt engineering was involved. Future work could focus on fully automating these attacks.
  • New Models: The authors suggest repeating these red-teaming efforts on new models as they become available to validate the transferability of these vulnerabilities.
  • Mitigation Research: Substantial research is needed to develop robust defenses against these emerging threats. Simple mitigations can make attacks harder but are not sufficient for true security.

Summary updated

BibTeX
@misc{pelrine2023exploiting,
  author = {Kellin Pelrine and Mohammad Taufeeque and Michal Zajac and Euan McLean and Adam Gleave},
  title = {{Exploiting Novel GPT-4 APIs}},
  year = {2023},
  eprint = {2312.14302},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2312.14302},
}
Figure