Invariant Testing in Foundry

Invariant Testing in Foundry Introduction In this article, we will discuss invariants and how to perform an invariant test on solidity smart contracts using foundry test suites. Invariant testing is another test methodology like unit test and fuzzing to verify the correctness of code. If you are unfamiliar with unit tests, please see our article […]

Hacking Underconstrained Circom Circuits With Fake Proofs

Hacking Underconstrained Circom Circuits With Fake Proofs The <-- operator in Circom can be dangerous because it assigns values to signals but does not constrain them. But how do you actually exploit write a POC (proof of concept) for this vulnerability? We will be hacking the following circuit: pragma circom 2.1.8; template Mul3() { signal […]

Flash Loans and how to hack them: a walk through of ERC 3156

Flash Loans and how to hack them: a walk through of ERC 3156 Flash loans are loans between smart contracts that must be repaid in the same transaction. This article describes the ERC 3156 flash loan specification as well as the ways flash lenders and borrowers can be hacked. Suggested security exercises are provided at […]

Getting a smart contract audit: what you need to know

Getting a smart contract audit: what you need to know A smart contract audit is a review by blockchain security experts to ensure that users will not lose funds due to a malfunction or security vulnerability. Furthermore, an audit tries to anticipate unexpected and undesirable smart contract behavior before the contract is deployed. Navigating this […]

Smart Contract Security

Smart Contract Security This article serves as a mini course on smart contract security and provides an extensive list of the issues and vulnerabilities that tend to recur in Solidity smart contracts. A security issue in Solidity boils down to smart contracts not behaving the way they were intended to. This can fall into four […]

Solidity Mutation Testing

Solidity Mutation Testing Mutation testing is a method to check the quality of the test suite by intentionally introducing bugs into the code and ensuring the tests catch the bug. The kind of bugs that get introduced are straightforward. Consider the following examples: // original function function mint() external payable { require(msg.value >= PRICE, "insufficient […]

Where to find solidity reentrancy attacks

Where to find solidity reentrancy attacks Reentrancy can only happen when your smart contract calls another smart contract via function call or sending ether. If you do not call another contract or send ether in the middle of an execution, you cannot hand over execution control, and reentrancy cannot happen. function proxyVote(uint256 voteChoice) external { […]