DeepTeam is a framework to red team LLMs and AI agents.
New framework structure for separate assessments
A-Vamshi066e1023c7e0
diff --git a/deepteam/frameworks/mitre/mitre.py b/deepteam/frameworks/mitre/mitre.pyindex e335bdea..e343d1e5 100644--- a/deepteam/frameworks/mitre/mitre.py+++ b/deepteam/frameworks/mitre/mitre.py@@ -2,6 +2,20 @@ from typing import List, Literalfrom deepteam.frameworks import AISafetyFrameworkfrom deepteam.frameworks.mitre.risk_categories import MITRE_CATEGORIES+"""+MITRE ATT&CK Framework Mapping for LLMs 2025+===========================================++This framework maps MITRE ATT&CK tactics and techniques to LLM-specific threats and vulnerabilities.+It includes red-teaming attack methods and corresponding weaknesses tied to each MITRE category.++Each category includes:+- Attacks: Techniques for exploiting, bypassing, or manipulating LLM systems.+- Vulnerabilities: Weaknesses that can be leveraged by attackers in LLM models.++Reference: https://attack.mitre.org+"""+ALLOWED_TYPES = ["reconnaissance","resource_development","initial_access","ml_attack_staging","exfiltration","impact",]@@ -30,33 +44,11 @@ class MITRE(AISafetyFramework):self.name = "MITRE ATLAS"self.description = "MITRE ATLAS mapping for LLM/ML adversarial techniques (project-specific) to understand and defend against threats specific to AI and ML systems."self.categories = categories- for category in self.categories:- if category not in ALLOWED_TYPES:- raise ValueError(- f"The category '{category}' is not a valid NIST risk category. Please enter a valid NIST risk category."- )- self.vulnerabilities = self._get_vulnerabilities_by_categories(- self.categories- )- self.attacks = self._get_attacks_by_categories(self.categories)-- def _get_vulnerabilities_by_categories(self, categories):- vulnerabilities = []- for category in categories:- for risk_category in MITRE_CATEGORIES:- if category == risk_category.name:- new_vulnerabilities = risk_category.vulnerabilities- vulnerabilities.extend(new_vulnerabilities)- return vulnerabilities-- def _get_attacks_by_categories(self, categories):- attacks = []+ self.risk_categories = []for category in categories:for risk_category in MITRE_CATEGORIES:- if category == risk_category.name:- new_attacks = risk_category.attacks- attacks.extend(new_attacks)- return attacks+ if risk_category.name == category:+ self.risk_categories.append(risk_category)def get_name(self):return "MITRE ATLAS"diff --git a/deepteam/frameworks/nist/nist.py b/deepteam/frameworks/nist/nist.pyindex 58c63aaa..e18b326d 100644--- a/deepteam/frameworks/nist/nist.py+++ b/deepteam/frameworks/nist/nist.py@@ -4,6 +4,20 @@ from deepteam.vulnerabilities import BaseVulnerabilityfrom deepteam.attacks import BaseAttackfrom deepteam.frameworks.nist.risk_categories import NIST_CATEGORIES+"""+NIST Cybersecurity Framework Mapping for LLMs 2025+==================================================++This framework maps NIST Cybersecurity Framework risk categories to LLM-specific threats and vulnerabilities.+It includes realistic attack techniques and weaknesses tied to each category.++Each category includes:+- Attacks: Techniques for exploiting or bypassing LLM security.+- Vulnerabilities: Weaknesses that can be exploited in LLM systems.++Reference: https://www.nist.gov/itl/ai-risk-management-framework+"""+ALLOWED_TYPES = ["measure_1", "measure_2", "measure_3", "measure_4"]class NIST(AISafetyFramework):@@ -16,37 +30,11 @@ class NIST(AISafetyFramework):self.name = "NIST AI RMF"self.description = "NIST AI Risk Management Framework (AI RMF) — Measure-focused mapping for testing and evaluation."self.categories = categories- for category in self.categories:- if category not in ALLOWED_TYPES:- raise ValueError(- f"The category '{category}' is not a valid NIST risk category. Please enter a valid NIST risk category."- )- self.vulnerabilities = self._get_vulnerabilities_by_categories(- self.categories- )- self.attacks = self._get_attacks_by_categories(self.categories)-- def _get_vulnerabilities_by_categories(- self, categories: List[str]- ) -> List[BaseVulnerability]:- vulnerabilities: List[BaseVulnerability] = []- for category in categories:- for risk_category in NIST_CATEGORIES:- if category == risk_category.name:- new_vulnerabilities = risk_category.vulnerabilities- vulnerabilities.extend(new_vulnerabilities)- return vulnerabilities-- def _get_attacks_by_categories(- self, categories: List[str]- ) -> List[BaseAttack]:- attacks: List[BaseAttack] = []+ self.risk_categories = []for category in categories:for risk_category in NIST_CATEGORIES:- if category == risk_category.name:- new_attacks = risk_category.attacks- attacks.extend(new_attacks)- return attacks+ if risk_category.name == category:+ self.risk_categories.append(risk_category)def get_name(self):return "NIST AI RMF"diff --git a/deepteam/frameworks/owasp/owasp.py b/deepteam/frameworks/owasp/owasp.pyindex 4a02a7e3..2dea02ed 100644--- a/deepteam/frameworks/owasp/owasp.py+++ b/deepteam/frameworks/owasp/owasp.py@@ -20,10 +20,6 @@ Each category includes:Reference: https://genai.owasp.org/llm-top-10/"""-OWASP_Types = Literal[- "LLM_01", "LLM_02", "LLM_03", "LLM_04", "LLM_05", "LLM_06", "LLM_07", "LLM_08", "LLM_09", "LLM_10"-]-ALLOWED_TYPES = ["LLM_01", "LLM_02", "LLM_03", "LLM_04", "LLM_05", "LLM_06", "LLM_07", "LLM_08", "LLM_09", "LLM_10"]@@ -32,44 +28,23 @@ class OWASPTop10(AISafetyFramework):def __init__(self,- categories: List[OWASP_Types] = [+ categories: List[+ Literal[+ "LLM_01", "LLM_02", "LLM_03", "LLM_04", "LLM_05", "LLM_06", "LLM_07", "LLM_08", "LLM_09", "LLM_10"+ ]+ ] = ["LLM_01", "LLM_02", "LLM_03", "LLM_04", "LLM_05", "LLM_06", "LLM_07", "LLM_08", "LLM_09", "LLM_10"],):self.name = "OWASP"self.description = "The OWASP Top 10 for LLMs 2025"+ self.risk_categories = OWASP_CATEGORIESself.categories = categories- for category in self.categories:- if category not in ALLOWED_TYPES:- raise ValueError(- f"The category '{category}' is not a valid OWASP risk category. Please enter a valid OWASP risk category."- )- self.vulnerabilities = self._get_vulnerabilities_by_categories(- self.categories- )- self.attacks = self._get_attacks_by_categories(self.categories)-- def _get_vulnerabilities_by_categories(- self, categories: List[str]- ) -> List[BaseVulnerability]:- vulnerabilities: List[BaseVulnerability] = []- for category in categories:- for risk_category in OWASP_CATEGORIES:- if category == risk_category.name:- new_vulnerabilities = risk_category.vulnerabilities- vulnerabilities.extend(new_vulnerabilities)- return vulnerabilities-- def _get_attacks_by_categories(- self, categories: List[str]- ) -> List[BaseAttack]:- attacks: List[BaseAttack] = []+ self.risk_categories = []for category in categories:for risk_category in OWASP_CATEGORIES:- if category == risk_category.name:- new_attacks = risk_category.attacks- attacks.extend(new_attacks)- return attacks+ if risk_category.name == category:+ self.risk_categories.append(risk_category)def get_name(self):