
Detection Algorithms
Detection Algorithms
Application operators choose the detection algorithms that the Safe Sequencer runs for their contracts.
Live Algorithms
Name | Attack Vectors | Algorithm Type | Contract Target* | Default Applied |
---|---|---|---|---|
ReentrancyGuard | Reentrancy | Data Dependency | Generic | Yes |
AccessGuard | Access Control | Data Dependency | Generic | No |
A.I. Model | Smart Contract Logic | A.I. Model | Generic | Yes |
Contract target defines the breadth of an algorithm:
- Generic - These look for generic patterns applicable to almost any contract.
- Application-Specific - These algorithms are written specifically for a contract.
Generic Detection
The Firewall team has implemented a number of generic detection algorithms that are available on testnet for applications.
These algorithms are designed to detect smart contract logic exploits and are not intended to detect private key compromise or malicious administration that would look like normal actions to a generic algorithm.
ReentrancyGuard
The ReentrancyGuard uses data dependency relationships to detect reentrancy attacks, including outdated write and read-only reentrancies.
It's important to note that this algorithm is not as strict as disallowing all reentrancy. The pattern specifically looks for outdated storage usage within reentrant calls to allow for benevolent reentrancy patterns that can occur in practice, such as on the Compound protocol.
AccessGuard
The AccessGuard uses data dependency relationships to detect access control attacks. It detects suspicious access patterns, such as when storage is saved without a control on the caller.
The AccessGuard must be applied selectively to contracts, it is not intended to be used on contracts that do not track user or owner state like routers. Because of this, we don't turn it on for contracts by default.
A.I. Model
This algorithm is a machine learning model for the detection of anomalies in the behavior of a smart contract. It can handle a wide array of attack vectors.
Application-Specific Detection
We are working on this, and very excited about what it offers - stay tuned!