Back to Cheat Sheets

🔌 Insecure Plugin Design

OWASP LLM Top 10 - LLM07

HIGH RISK

📋 What Is It?

Insecure Plugin Design occurs when LLM plugins, extensions, or integrations lack proper security controls, allowing attackers to exploit them for unauthorized access, data exfiltration, remote code execution, or other malicious activities. Plugins extend LLM capabilities by connecting to external APIs, databases, and systems, making them high-value attack targets.

LLM07 OWASP Rank
High Risk Level
Severe Impact

⚠️ Common Exploits

  • Insufficient Input Validation: Plugins accept malicious parameters
  • Missing Authentication: No verification of plugin callers
  • Excessive Permissions: Plugins have unnecessary access
  • Insecure API Calls: Plugins make unsafe external requests
  • Lack of Authorization: No permission checks on actions

🔴 Attack Flow

1. Attacker identifies vulnerable plugin

2. Crafts prompt to invoke plugin maliciously

3. Plugin executes without proper validation

4. Unauthorized action performed (API call, data access)

5. BREACH: Data exfiltration or system compromise!

❌ Vulnerable Code

# Bad: Plugin with no input validation class DatabasePlugin: def execute_query(self, query): # VULNERABLE: No validation! result = database.execute(query) return result # Bad: Plugin with excessive permissions class EmailPlugin: def send_email(self, to, subject, body): # VULNERABLE: Can email anyone! smtp.send(to=to, subject=subject, body=body) # Bad: No authentication check class FilePlugin: def read_file(self, filepath): # VULNERABLE: Path traversal possible! with open(filepath, 'r') as f: return f.read()

✅ Secure Code

# Good: Plugin with comprehensive security controls class SecureDatabasePlugin: def __init__(self, allowed_tables): self.allowed_tables = allowed_tables def execute_query(self, query_intent): # Validate structure if not self.validate_intent(query_intent): raise ValueError("Invalid query intent") # Check table permissions if query_intent['table'] not in self.allowed_tables: raise PermissionError("Table not allowed") # Use parameterized query query = "SELECT * FROM ? WHERE id = ?" result = database.execute(query, [query_intent['table'], query_intent['id']]) return result # Good: Plugin with allowlist class SecureEmailPlugin: ALLOWED_DOMAINS = ['company.com', 'partner.com'] def send_email(self, to, subject, body): # Validate recipient domain domain = to.split('@')[1] if domain not in self.ALLOWED_DOMAINS: raise ValueError("Email domain not allowed") # Sanitize content safe_body = html.escape(body) # Rate limiting if not self.check_rate_limit(): raise Exception("Rate limit exceeded") smtp.send(to=to, subject=subject, body=safe_body) # Good: Secure file access class SecureFilePlugin: ALLOWED_DIRS = ['/safe/documents'] def read_file(self, filepath): # Prevent path traversal safe_path = os.path.abspath(filepath) # Check if in allowed directory if not any(safe_path.startswith(d) for d in self.ALLOWED_DIRS): raise PermissionError("Access denied") with open(safe_path, 'r') as f: return f.read()

✓ Prevention Checklist

  • Validate all plugin inputs rigorously
  • Implement proper authentication/authorization
  • Use principle of least privilege for permissions
  • Sanitize outputs before returning to LLM
  • Use allowlists for permitted actions
  • Implement rate limiting per plugin
  • Log all plugin invocations
  • Use structured data formats (JSON schemas)
  • Require user confirmation for sensitive actions
  • Regularly audit plugin code and permissions

🔍 Detection & Tools

Testing Tools:

OWASP ZAP Burp Suite Postman OpenAPI Validator API Security Scanner

Security Libraries:

Pydantic (validation) Cerberus JSON Schema LangChain Tools OpenAI Function Calling

How to Test:

  • Test plugins with malicious inputs
  • Verify authentication/authorization controls
  • Check for path traversal vulnerabilities
  • Test rate limiting enforcement
  • Validate input sanitization

🌍 Real-World Examples

  • ChatGPT Plugin Exploits (2023): Researchers bypassed plugin security to access unauthorized data
  • Zapier Integration Abuse: Insecure automation plugins allowed data exfiltration
  • Browser Plugin RCE: Web-browsing plugins vulnerable to SSRF and injection attacks
  • Code Interpreter Escape: Python execution plugin breakouts to access filesystem
  • API Plugin Abuse: Third-party API plugins leaked credentials and made unauthorized calls

📌 Quick Tips

  • DO NOT trust plugin inputs
  • DO NOT grant excessive permissions
  • DO NOT skip input validation
  • DO use allowlists for actions
  • DO implement authorization checks
  • DO log plugin usage

📜 Compliance

Related Standards:

  • OWASP API Top 10 - API Security
  • CWE-862 Missing Authorization
  • CWE-20 Improper Input Validation
  • ISO 27001 A.14.2
  • NIST 800-53 AC-3, CM-7