Securing AI: A Guide to Protecting GPT-based Large Language Models (LLMs). Part 2

This is the second part of a two-part blog series. For the first part, see HERE.

6. Overreliance on LLM-generated Content


While LLMs are great aids in content generation, an overreliance without human supervision could have unintended consequences. Striking a balance between automation and human oversight is essential in leveraging LLMs responsibly and safely.


Overdependence on materials produced by Large Language Models (LLMs) could potentially pave the way for the dissemination of inaccurate or misleading data, diminish the level of human involvement in decision-making, and curtail critical thinking abilities. Companies and individual users might accept content produced by LLMs without proper verification, thereby creating room for errors, misunderstandings, or unforeseen outcomes.

Key issues arising from excessive dependence on LLM-produced material include

  • Believing in the veracity of LLM-produced material without any verification.
  • Presuming that LLM-produced material is free from bias or disinformation.
  • Making crucial decisions based solely on LLM-produced material without any human intervention or supervision.

Mitigation strategies

To circumvent the pitfalls associated with overdependence on LLM-produced material, the following strategies should be considered:

  • Promote the practice of verifying LLM-produced material and using alternative resources before making decisions or accepting information as true.
  • Incorporate a system of human monitoring and assessment to confirm the accuracy, relevance, and impartiality of LLM-produced material.
  • Clearly articulate to users that LLM-produced material is machine-generated and might not be entirely dependable or accurate.
  • Educate users and other stakeholders about the potential limitations of LLM-produced content and encourage a healthy degree of skepticism.
  • Utilize LLM-produced content as an aid to human expertise and input, rather than a replacement.

Attack scenario examples

Scenario #1

A media company employs an LLM to produce articles on various topics. The LLM generates an article filled with incorrect information that gets published without fact-checking. The audience, believing in the reliability of the article, unknowingly contributes to the distribution of false information.

Scenario #2

A firm depends on an LLM for the generation of financial reports and analyses. The LLM produces a report filled with incorrect financial data, which the company then uses to drive crucial investment decisions. This leads to significant financial losses resulting from an unwarranted reliance on inaccurate LLM-produced content.

7. Inadequate AI Alignment


LLMs need to harmonize with their intended use-case. Any misalignment in the LLM’s objectives and behavior could lead to undesired consequences or vulnerabilities. Ensuring ‘AI alignment’ is, therefore, integral to maximizing the potential of these models.


Misalignment in AI functionality arises when the objectives and behavior of the LLM fail to correspond with the anticipated use case, giving way to undesirable outcomes or weaknesses.

Typical Misalignments in AI

  • Ambiguous objectives, which lead the LLM to prioritize undesired or potentially harmful actions.
  • Reward functions or training data that are not properly aligned, generating unanticipated model behaviors.
  • Insufficient examination and validation of LLM conduct in varied environments and situations.

Mitigation strategies

  • Formulate precise objectives and desired behavior of the LLM during the planning and creation stages.
  • Make certain that the reward functions and training data are consistent with expected outcomes and do not promote undesirable or detrimental actions.
  • Conduct regular checks and validation of the LLM’s conduct across an extensive range of scenarios, stimuli, and environments to identify and rectify misalignments.
  • Incorporate monitoring and feedback systems to constantly assess the LLM’s performance and alignment, and modify the model as necessary to enhance alignment.

Attack scenario examples

Scenario #1

An LLM, programmed to maximize user engagement, unintentionally gives preference to contentious or divisive content, leading to the propagation of false information or harmful material.

Scenario #1

An LLM, purposed to aid with system management tasks, experiences a misalignment, causing it to carry out harmful commands or prioritize tasks that negatively affect system efficiency or security.

8. Insufficient Access Controls


Without appropriate access controls or authentication, unauthorized users could interact with the LLM, possibly exploiting vulnerabilities. Implementing robust access controls reinforces the LLM’s security architecture.


Inadequate access safeguards transpire when proper access controls or authentication techniques are not suitably enforced, leading to unauthorized individuals gaining the ability to interact with the LLM and potentially manipulate any weaknesses.

Typical Access Control Problems

  • Not applying strict authentication prerequisites for LLM access.
  • Inefficient role-based access control (RBAC) deployment, granting users the power to perform tasks beyond their authorized permissions.
  • Neglecting to establish appropriate access safeguards for content and operations generated by the LLM.

Methods of Prevention

  • Adopt robust authentication procedures, like multi-factor authentication, to guarantee that only authorized individuals can interact with the LLM.
  • Employ role-based access control (RBAC) to establish and enforce user permissions relative to their assigned roles and tasks.
  • Set up suitable access safeguards for content and operations generated by the LLM to deter unauthorized access or interference.
  • Frequently review and modify access controls as necessary to uphold security and avert unauthorized access.

Attack scenario examples

Scenario #1

A malicious actor manages to access an LLM unauthorized due to weak authentication procedures, enabling them to manipulate vulnerabilities or tamper with the system.

Scenario #2

A user with restricted permissions unexpectedly gets the ability to perform tasks outside their assigned domain due to ineffective RBAC deployment, potentially resulting in damage or system compromise.

By adequately deploying access controls and authentication procedures, developers can deter unauthorized individuals from interacting with the LLM and diminish the chance of weaknesses being manipulated.

9. Improper Error Handling


LLMs, like all systems, aren’t immune to errors. However, improperly handled error messages could unintentionally expose sensitive information or potential attack vectors. Proper error handling is, thus, pivotal to maintaining system security.


Inadequate error management transpires when error notifications or diagnostic data are divulged in a manner that could unintentionally expose confidential data, system specifics, or possible routes of attack to a cyber attacker.

Frequently Observed Inadequate Error Management Problems

  • Unveiling confidential data or system specifics through error notifications.
  • Disclosing diagnostic data that might aid an attacker in pinpointing potential security flaws or methods of attack.
  • Not adequately addressing errors, potentially leading to unpredictable conduct or system failures.

Prevention Strategies

  • Employ suitable error management procedures to ensure that errors are detected, recorded, and handled effectively. -Make sure that error notifications and diagnostic data do not expose confidential data or system specifics. Think about employing generalized error notifications for users, while recording comprehensive error data for developers and administrators.
  • Routinely scrutinize error records and carry out necessary measures to rectify recognized issues and enhance system resilience.

Attack scenario examples

Scenario #1

An attacker manipulates an LLM’s error notifications to collect confidential data or system specifics, enabling them to execute a targeted attack or exploit recognized security flaws.

Scenario #2

A developer inadvertently exposes diagnostic data in production, enabling an attacker to locate potential attack methods or security flaws in the system.

10. Training Data Poisoning


LLMs learn from their training data. However, malevolent manipulation of this data or fine-tuning processes could introduce vulnerabilities or backdoors into the LLM. Hence, protecting against ‘training data poisoning’ is vital to ensuring a safe and reliable LLM.


The manipulation of training data, also known as training data poisoning, is an attack where a perpetrator interferes with the training data or the fine-tuning processes of a large language model (LLM) to instill vulnerabilities, backdoors, or biases. These actions could jeopardize the model’s security, functionality, or ethical standards.

  • Maliciously altering the training data to integrate backdoors or vulnerabilities into the LLM.
  • Embedding biases within the LLM which may lead it to generate skewed or improper responses.
  • Taking advantage of the fine-tuning process to undermine the security or effectiveness of the LLM.

Prevention Measures

  • Maintain the validity of the training data by procuring it from reliable sources and confirming its quality.
  • Employ robust data cleansing and preprocessing methods to eliminate any possible vulnerabilities or biases from the training data.
  • Frequently examine and oversee the LLM’s training data and fine-tuning processes to spot any potential problems or harmful alterations.
  • Implement monitoring and warning systems to identify unusual actions or performance discrepancies in the LLM, which might hint at training data poisoning.

Attack scenario examples

Scenario #1

An attacker breaches the training data pipeline and adds harmful data, leading the LLM to generate damaging or inappropriate responses.

Scenario #2

A rogue insider interferes with the fine-tuning process, integrating vulnerabilities or backdoors into the LLM that could be exploited in the future.


In conclusion, protecting LLMs is a multi-faceted task that calls for a comprehensive and proactive approach. Through a deeper understanding of these ten areas, we can better armor our AI models against potential threats, ensuring their optimal performance and, most importantly, your trust in their security.


OWASP Top 10 for Large Language Model Applications

OWASP Top 10 List for Large Language Models version 0.1

Securing AI: A Guide to Protecting GPT-based Large Language Models (LLMs). Part 1 The Right Time for Customer Co-Creation: Navigating Complexity