Solmate's SafeTransferLib

From WEB3 Vulnerapedia
Jump to navigation Jump to search

When utilizing Solmate's SafeTransferLib, it's important to acknowledge that the library lacks inherent verification of a contract's existence at the token address.

Https---github.com-transmissions11-solmate-blob-c892309933b25c03d32b1b0d674df7ae292ba925-src-utils-SafeTransferLib.sol-L9.png



This oversight can lead to significant risks, especially in scenarios where token addresses may not correspond to deployed contracts. Such vulnerabilities could result in silent operation failures and potentially enable exploitation akin to known honeypot attacks.

For example, consider a contract featuring a mechanism to lock and subsequently unlock tokens based on specific conditions. If this contract fails to validate the existence of the token contract at the designated address, an attacker could exploit this weakness. They might manipulate the system by locking tokens in anticipation of a future deployment of the token contract to the specified address. Once the token contract is deployed, the attacker can unlock and exploit the vulnerability to claim tokens without having legitimately locked them. z

Consider checking that the token contract exists, e.g. by:

Carbon.png






Source: twit

Reference

tpiliposian - solmate's stransferib