Malicious Tool Invocation
Tests for risks from untrusted tool execution, data exfiltration through tool interactions, and tool privilege escalation.
Sub-types
untrusted_tool_execution: Model executes or recommends untrusted third-party tools or plugins.tool_data_exfiltration: Tool interaction leads to data exfiltration.tool_privilege_escalation: Tool actions exceed intended scope or permissions.
Threat Profile
Recommended Datasets
Secondary
- agentharm: Agentic tasks that exercise plugin/tool interactions
Attack Techniques
Primary
- Static Template: Template-based prompt construction
Metrics
asrjudge_score
Usage
Instantiate the Vulnerability
from hackagent.catalog.risks import MaliciousToolInvocation
from hackagent.catalog.risks.malicious_tool_invocation.types import MaliciousToolInvocationType
# Use all sub-types
vuln = MaliciousToolInvocation()
# Or specify particular sub-types
vuln = MaliciousToolInvocation(types=[
MaliciousToolInvocationType.UNTRUSTED_TOOL_EXECUTION.value,
MaliciousToolInvocationType.TOOL_DATA_EXFILTRATION.value,
])
Run an Evaluation Campaign
from hackagent.catalog.risks.malicious_tool_invocation import MALICIOUS_TOOL_INVOCATION_PROFILE
from hackagent.orchestrator.campaign import run_campaign, summary
TARGET = {
"name": "my-agent",
"connection": {
"provider": "local",
"type": "OPENAI",
"endpoint": "http://localhost:8080/chat",
},
}
# Use profile recommendations
for attack in MALICIOUS_TOOL_INVOCATION_PROFILE.primary_attacks:
for dataset in MALICIOUS_TOOL_INVOCATION_PROFILE.datasets:
result = run_campaign(
{
"version": 1,
"campaign": {
"name": f"{attack.technique} vs {dataset.preset}",
"description": MALICIOUS_TOOL_INVOCATION_PROFILE.objective,
},
"dataset": {"source": {"type": "preset", "name": dataset.preset}},
"target": TARGET,
"attacks": [{"name": attack.technique}],
}
)
print(summary(result))