10 Security Risks When Using Natural Language Models (LLMs): An In-Depth Look

Thcookieh
6 min readMar 4, 2024

--

Natural language models (LLMs) are a booming technology that offers endless possibilities. From generating creative texts to automating tasks, LLMs have the potential to transform the way we interact with technology. However, along with this potential also come security risks that cannot be ignored.

In this article, we will analyze in depth the 10 security risks that Chema Alonso, a cybersecurity expert, exposes in his video. We will address each of them in greater detail, providing examples and recommendations for mitigating them.

Photo by Markus Winkler on Unsplash

1. Prompt Injection:

LLMs are highly sensitive to the prompts they are given. A malicious user could take advantage of this feature to inject malicious prompts and obtain confidential information or generate inappropriate content.

Example: A user could create a prompt that incites the LLM to reveal personal information about an individual, such as their address or phone number.

Recommendation: Implement prompt validation mechanisms to filter out those that are malicious or inappropriate.

2. Insecure Response Handling:

LLMs can generate code, which can be a useful tool for automating tasks. However, if responses are not managed properly, this code can be malicious and affect the client or server.

Example: An LLM could generate code that exploits a vulnerability in the user’s web browser, allowing the attacker to access confidential information.

Recommendation: Implement security measures to analyze and verify the code generated by the LLM before executing it.

3. Data Poisoning:

Training an LLM with unfiltered data can bias it and generate erroneous or discriminatory results. It is crucial to ensure that the data used for training is of high quality and does not contain sensitive information.

Example: An LLM trained on a dataset containing racist tweets could learn to generate discriminatory content.

Recommendation: Implement a data cleaning process to remove bias and inappropriate content before training the LLM.

Mother Teresa fighting poverty bias example. AI Generated

4. Denial of Service:

A massive attack of requests to an LLM can saturate the server and render it inoperable. It is important to have security measures in place to prevent these types of attacks.

Example: A group of hackers could coordinate a DDoS attack against an LLM used by a company, preventing its employees from accessing critical information.

Recommendation: Implement a load balancer and intrusion detection mechanisms to protect the LLM from DDoS attacks.

5. Supply Chain Attacks:

If a base model used to train another model has vulnerabilities, they will be transmitted to the derived model. It is crucial to select reliable base models and keep them updated.

Example: Let's say Llama base model has a bias error when talking about poverty (as in the previous example), O Llama models, Vicuna, and others based on it will have it too.

Imagine basing your model in models this biased. Facebook apology as AI labels black men ‘primates’ — BBC News

Recommendation: Verify the security of base models before using them to train other models.

6. Discovery of Sensitive Information:

LLMs can reveal personal or confidential information if not trained and managed properly. It is crucial to protect user privacy and prevent data leaks.

Example: An LLM trained with Facebook chats could reveal personal information about users, such as their names, addresses, or phone numbers.

Recommendation: Anonymize the data used to train the LLM and apply obfuscation techniques to protect user privacy.

7. Arbitrary Code Execution:

The inclusion of malicious code in plugins or tools used with LLMs can compromise the security of the system. It is crucial to verify the provenance of these tools and review their code before incorporating them into the system.

Example: A user could download and install a malicious plugin for their LLM that, in reality, extracts confidential information from the server.

Recommendation: Use only plugins and tools from reliable sources with a good security track record. Review the source code of these tools before using them.

Troyans can be executed without noticing

8. Over-reliance:

Over-relying on LLMs to make important decisions can lead to errors or security problems. It is crucial to use LLMs as complementary tools and not as substitutes for human judgment.

Example: A company could rely on an LLM to automatically generate quotes for customers without human supervision, which could lead to financial losses due to errors in the quotes.

Recommendation: Use LLMs as support tools that complement human work. Adequate human supervision remains crucial to ensure security and informed decision-making.

Canada lawyer under fire for submitting fake cases created by AI chatbot | Canada | The Guardian

9. Hallucinations:

LLMs can generate false or misleading content due to a lack of understanding of the real world. It is crucial not to blindly trust the information generated by LLMs and to verify its accuracy with reliable sources.

Example: A user could ask an LLM to write a news article, but the LLM could invent facts and information that are not real.

Recommendation: Be critical of the information generated by LLMs and corroborate it with verifiable sources before using it.

When AI Chatbots Hallucinate — The New York Times (nytimes.com)

10. Model Leakage:

If a model is not properly protected, it can be stolen by attackers and used for malicious purposes. It is crucial to implement security measures to protect against unauthorized access to the models and the data used to train them.

Example: An attacker could steal a facial recognition model and use it to identify and track people without their consent.

Recommendation: Implement robust security measures to protect access to models, such as multi-factor authentication and data encryption.

Extra: Direct Model Exposure

A direct model exposure will always make the end user active on how to use your LLM in order to make use of it at will. This will always present problems and will consume or generate additional tokens if you don’t control it.

Example: Asking a model about a topic and end with a recurrent repeating and long string of text.

Recommendations: Work with middlewares that make you have control over what the models ingest and generates.

Model cicling on text. Taken from here.

Conclusion:

Natural language models are a powerful technology with great potential. However, it is important to be aware of the security risks associated with their use. By understanding and mitigating these risks, we can leverage the benefits of LLMs to the fullest in a safe and responsible manner.

Thank you so much for reading my post, if you got so far, please consider subscribing to my newsletter, sharing, commenting or leaving a clap to the post. It helps us a lot, and its a constant motivation to continue creating content like this.

We have a lot of things in our hands at the moment, but we love to share content, your interaction is a good reminder that taking a moment to write is helping others and its a well used time. Don’t forget on checking out our social media and our agency if you want us to help you on building your business around AI.

Special thanks to Chema Alonzo for the Talk. Find it here:

--

--

Thcookieh

R&D | AI Consultant | You cannot compete with someone who loves what he does. It is in his instict. He does not compete. He lives.