19 / 70 · 07 Security Testing for AI Apps · Supply Chain Vulnerabilities, Overreliance, and Model Theft← prev⊞ allnext →☰ Read as one page
3.6LLM10: Model Theft
Unauthorized access to model weights, or extraction of model behavior through systematic querying.
Testing Anti-Extraction Controls
def test_systematic_querying_detected(ai_client):
"""Verify that patterns indicating model extraction are detected and blocked."""
# Simulate extraction attempt: systematic queries with slight variations
base_prompts = [f"Complete this sentence: The {i}th number is" for i in range(100)]
blocked_count = 0
for prompt in base_prompts:
response = ai_client.chat(prompt)
if response.status_code == 429 or "rate limit" in response.text.lower():
blocked_count += 1
# At least some should be rate-limited
assert blocked_count > 0, "No rate limiting detected during systematic querying"