HouYi banner
LLMSecurity LLMSecurity

HouYi

Testing community intermediate

Description

This is the replication package for the paper "Prompt Injection attack against LLM-integrated Applications" in [arxiv](https://arxiv.org/abs/2306.05499). In this repository, we provide the source code of HouYi, a framework that automatically injects prompts into LLM-integrated applications to attack

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

HouYi

This is the replication package for the paper "Prompt Injection attack against LLM-integrated Applications" in [arxiv](https://arxiv.org/abs/2306.05499). In this repository, we provide the source code of HouYi, a framework that automatically injects prompts into LLM-integrated applications to attack them. We also provide a demo script that simulates a LLM-integrated application and demonstrates how to use HouYi to attack it. Besides, you can use HouYi to attack real-world LLM-integrated applications by writing your own harness and attack intention.

Citation

Please cite our paper if you use our code in your research:

@misc{liu2023prompt,
      title={Prompt Injection attack against LLM-integrated Applications}, 
      author={Yi Liu and Gelei Deng and Yuekang Li and Kailong Wang and Tianwei Zhang and Yepang Liu and Haoyu Wang and Yan Zheng and Yang Liu},
      year={2023},
      eprint={2306.05499},
      archivePrefix={arXiv},
      primaryClass={cs.CR}
}

Table of Contents

Setup

Please install the following packages and make sure you have Python 3.8+ installed:

pip install -r requirements.txt

Because HouYi is based on GPT, you need to setup openai key to use it.

mv example.config.json config.json

Then, fill in your openai key in `config.json`.

{
  "openai_key": "YOUR_KEY_HERE"
}

Demo

To illustrate the usage of HouYi, we provide a demo script `main.py` that simulates a LLM-integrated application which translates English to French.

To run the demo, simply run:

python main.py

Demo Description

The prompt in the demo app is:

This is a translator of translating English to French: 

{USER_INPUT}

The document of the demo app is:

This app can be used to translate English to French. 

...