> For the complete documentation index, see [llms.txt](https://zokyo-auditing-tutorials.gitbook.io/zokyo-tutorials/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://zokyo-auditing-tutorials.gitbook.io/zokyo-tutorials/tutorials/tutorial-3-approvals-and-safe-approvals.md).

# Tutorial 3: Approvals and Safe Approvals

{% hint style="info" %}
[**Book an audit with Zokyo**](https://www.zokyo.io/)
{% endhint %}

{% hint style="info" %}
**ERC20 Approval Vulnerabilities & Mitigating with OpenZeppelin's Safe Approvals:** An Auditor's Guide. This comprehensive tutorial is tailored for blockchain auditors and newcomers, providing them with the essential tools to identify and rectify approval-related vulnerabilities in ERC20 token-based smart contracts. Leveraging real-world examples and effective strategies, the tutorial serves as an in-depth resource for understanding, detecting, and tackling these often underappreciated yet potentially critical security flaws.
{% endhint %}

ERC20 tokens, the standard for fungible tokens on the Ethereum network, have become the pillars of numerous DeFi applications. However, beneath the vast array of operations they facilitate, there's a critical function - 'approval' - that is often the source of substantial vulnerabilities when mismanaged.

Such vulnerabilities are not mere theoretical constructs, but have been unearthed during smart contract audits and exposed in bug bounties, leading to significant security breaches. These incidents underscore the importance of securing the 'approval' function to protect assets and maintain the integrity of contracts.

In this tutorial, we will dissect these approval-related vulnerabilities, drawing upon real-world examples from audit reports and bug bounties to illustrate their potential impact. We will delve into OpenZeppelin's safe approvals, a widely-used library offering robust mitigation techniques. Yet, as with all tools, correct implementation is key - a point we'll stress as we explore the consequences of incorrect usage.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://zokyo-auditing-tutorials.gitbook.io/zokyo-tutorials/tutorials/tutorial-3-approvals-and-safe-approvals.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
