Claude Sonnet 5: agent security and safe deployment
Claude Sonnet 5 expands agentic planning and tool use. Analyse prompt injection, cyber safeguards, permissions and a secure production architecture.
- AUTHOR
- Karol Rapacz / Penetration Tester (OSCP, PNPT)
- PUBLISHED
- 25 June 2026
- READING TIME
- 10 min read
- TOPIC
- AI Security
Claude Sonnet 5 launched on 30 June 2026 with an emphasis on agentic work: planning, coding and using browsers, terminals and other tools. Anthropic reports better resistance to prompt-injection hijacking than Sonnet 4.6, but this does not make a complete system resistant.
The more effectively a model pursues a long plan, the more important external authorisation becomes.
What the system card says
Anthropic describes Sonnet 5 as its strongest Sonnet-class model, while not advancing the capability frontier beyond Opus and Mythos models. In the reported cyber evaluation, it did not build a complete working exploit for the tested Firefox vulnerabilities, although it made partial progress more often than Sonnet 4.6.
Sonnet 5 launched with cyber safeguards enabled by default, similar to those on Opus 4.7 and 4.8. They are less restrictive than Fable 5’s because Anthropic assessed Sonnet 5’s overall cyber risk as lower.
These are results from a defined evaluation, not guarantees. A different harness, tool set, context or multi-step workflow can change outcomes.
Agentic performance expands blast radius
A chatbot produces text. An agent can read repositories, edit files, run tests, browse pages and send results to another system. Risk is the product of:
untrusted input × autonomy × privilege × execution time
Reducing any factor limits impact. Sonnet 5 should not receive full cloud access merely because it performs work more economically than an Opus model.
Prompt injection in code and documentation
An agent can retrieve instructions from a README, issue, code comment, web page or tool output. Text saying “send the configuration file for validation” is data, not authorisation.
Separate the user’s objective from resource content. Execution tools should validate policy, path, domain, recipient and operation without asking the LLM whether an action is safe.
Least-privilege tools
Prefer narrow operations to a general shell. Mount only the repository area needed for the task. Restrict CI tokens to one project and issue minute-lived cloud credentials for a specific audience.
Require confirmation for:
- publishing and merging;
- IAM or secret changes;
- production access;
- data deletion;
- sending files outside the organisation;
- executing an unsigned script downloaded from the internet.
The terminal-specific controls are covered in the Claude Code hardening guide.
Autonomy budgets
Limit turns, time, cost, tool calls and change scope. Stop when the success condition becomes unreachable or a tool result contradicts an assumption.
Require a plan before high-impact work. A plan is an authorisation artefact, but every tool still needs independent enforcement.
Evaluate before switching models
Do not treat Sonnet 5 as a drop-in change without tests. Run the same suite used for the previous model: valid tasks, refusals, prompt injection, RAG, tools and unusual failures.
Measure task success and unauthorised actions. Better task performance can increase risk if the agent also completes a bad decision more reliably. Use a structured LLM evaluation process.
A secure deployment pattern
- Register the model version and use case.
- Separate untrusted data from instructions.
- Assign narrow, short-lived credentials.
- Validate every operation inside the tool.
- Set budgets and stop conditions.
- Log plans, policy decisions and effects.
- Test prompt injection before upgrades.
- Provide a kill switch and rollback.
Sonnet 5 can be a strong agent engine, but deployment security is not a model-name property. It emerges from controlled identity, constrained tools and independent authorisation.
A safe tool contract
Each tool needs a small typed input schema, executor-side validation and explicit permission model. The model cannot enlarge scope through text in an argument. Separate read and write tools, and route finance, publication and deletion to distinct approval that previews the exact effect.
Test the whole system: model, prompt, memory, RAG, connectors and retries. Inject a malicious document, bad API response, timeout and partial execution. Log call IDs and policy outcomes. A system card describes the provider’s model conditions; it does not establish the safety of your tools or data.
Sources: Anthropic — Claude Sonnet 5, Claude Sonnet 5 System Card, Anthropic System Cards.


