# Tag Info

Accepted

### What is a recursive calling vulnerability?

A Simpler Explanation The attacker creates a wallet contract (0xc0ee9db1a9e07ca63e4ff0d5fb6f86bf68d47b89 in the 17/06/2016 attack) with a default (or fallback) function () to call The DAO's splitDAO(...
• 40.3k

### Is transfer() still safe after the Istanbul update?

transfer() and send() should be avoided (because they take a hard dependency on gas costs by forwarding a fixed amount of gas: 2300). Gas specific code (call{gas: ..., value: ...}("")) ...
• 85.7k
Accepted

### How much computation can be done in a fallback function?

The fallback function can do as much computation as how much gas it gets. There are 2 cases (basically recipient.send and recipient.call{value:...}("")) and case 2 has security implications ...
• 85.7k

### What is a recursive calling vulnerability?

If your code looks like this in pseudo code: function do: if (pool has mymoney = true) split(mymoney) pool has mymoney = false By repeatedly calling that function, you have sort of a ...
• 11.6k

### TheDAO hack FAQ: How did the attack happen on 17 June 2016?

What happened? 3,641,694 ETH where splitted out of theDAO. The attacker found a loophole in the regular splitDAO function so that they could reuse the same DAO tokens over and over again. How ...
Accepted

### Callstack attack

Call depth attack A. No. If the call depth is at 1024, employeeAddress.send will fail. The depth remains at 1024 and bossAddress.send will also fail. The depth will only decrease to 1023 when ...
• 85.7k

### What is a recursive calling vulnerability?

A "recursive calling vulnerability" is an ambiguous term that should be avoided because it is imprecise and can mean 2 things. Reentrant attack You probably mean "reentrancy vulnerability" or "...
• 85.7k
Accepted

### What does msg.sender.call() do in Solidity?

It calls the anonymous fallback function on msg.sender. In a typical reentrancy attack, it would be something like a withdraw function doing msg.sender.call.value(1 ether)(). The caller (a smart ...
• 28k

Accepted

### Is reentrancy guard needed in ERC 721 minting process and why so?

TL;DR: _safeMint is not that safe. So ensure your mint process is safe. Take a look at the mint method here contract code, require(_mintAmount <= maxMint, "Cant mint more then maxmint" ); ...
• 382
Accepted

### Is address.send() not vulnerable for the recursive call attack?

.send will only provide 2300 gas to the fallback function and is safe. But you should carefully check and handle the return value of .send, because of the "call depth attack": How does the stack ...
• 85.7k

### TheDAO hack FAQ: How did the attack happen on 17 June 2016?

A very highlevel, very simplified answer. If you send a split request to the DAO, it checks your token account, creates a new copy of the DAO with your ethers in it and then reduces your account by ...
Accepted

### Checking Reentrancy Vulnerability in smart contracts

In case the danger and the pattern isn't clear, a contract is vulnerable if it calls, sends or transfers to an untrusted address (contract with fallback function?) and then updates the state afterward....
• 55.2k

### What does msg.sender.call() do in Solidity?

msg.sender.call() calls the fallback-function on msg.sender. Here is an example that is extended with a canBeAttacked function. contract Mutex { bool locked; modifier noReentrancy() { require(!...
• 85.7k
Accepted

### How does the re-entrancy guard modifier work?

The code: modifier modi() { prolog(); _; epilog(); } function func() modi() { stuff(); } Is equivalent to: function func() { prolog(); stuff(); epilog(); } If func is ...

### How was the recursion created that lead to theDAO hack?

This is the problematic line of code in the withdrawRewardFor function: if (!rewardAccount.payOut(_account, reward)) <-- reentrant exploit throw; paidOut[_account] += reward; The ...
• 30.6k
Accepted

### Is a suiciding contract susceptible to re-entrancy?

No, there are no contract invocations with a selfdestruct (suicide), so there is no possibility of reentrancy. There are no CALLs as you've noted and the Geth code you've quoted is correct.
• 85.7k

### What does `call.value` mean and how did it allow the attack to The DAO?

EDIT Dec 2019: call.value()() should now be used for transferring ether. See: Is transfer() still safe after the Istanbul update (2300 gas limitation)? The following is the original answer. ...
• 85.7k
Accepted

### How does reentrancy work?

Reentrancy can happen when a contracts critical variable is updated after a call to an external contract that depends on this critical variable to happen. Here's a classic example contract BadBank { ...
• 4,307
Accepted

### Is it possible to use negative gas to execute a Reentrant attack using .send()?

It's not possible because the negative gas is accumulated in a separate refund counter and only provided at the very end of the transaction (up to a maximum of half the gas used). See What are the ...
• 85.7k

### Give some examples of documentation that talks about reentrancy attacks / recursive call vulnerabilities

Before June 2016 August 2014: Reentrant Contracts gives an example of "a contract can be tricked into calling itself". July 2015: LeastAuthority Ethereum Analyses mentioned: reentrancy hazards if ...
• 85.7k

### Give some examples of documentation that talks about reentrancy attacks / recursive call vulnerabilities

If you are a developer or interested in recreating the attack, I've created two contracts for the purpose of demonstrating exactly how it worked. https://github.com/joeb000/mock-dao-hack There are ...
• 253
Accepted

### Does `address.transfer` forward all gas (suceptible to re-entrancy)?

I setup a minimal test example that you can find on https://gist.github.com/anonymous/07d4714c27dbf1af0e5cb16c9f833353 pragma solidity ^0.4.11; contract Test { Receiver myR; function ...
• 8,774

### Solidity msg.sender.send security problem?

Both send() and transfer() are subject to the 2300 gas stipend. The main difference between them is that transfer throws on error and that transfer() supports the .gas() modifier, allowing you to ...
• 7,696

### How does the re-entrancy guard modifier work?

My understanding is that: The counter is incremented A copy of the value of counter is kept Control is returned (https://solidity.readthedocs.io/en/v0.6.8/contracts.html#function-modifiers) There ...
• 1,338

### Solidity: Examples of fail safe code for security

ConsenSys has a few very good code snippets in their best practices for software engineering. Copy-pasting their Circuit Breaker example: bool private stopped = false; address private owner; ...
Accepted

### Solidity: Examples of fail safe code for security

Contracts always have a 'state' which is comprised of the current values of all its variables and its current Ether balance. I suppose they want you to think about which states are allowed to happen, ...
• 10.5k

### In simple terms, how did the DAO get hacked and funds removed from it?

A reasonable analogy I've heard is: You go to an ATM and withdraw the money. After the ATM gives you the money, you unplug the ATM before it updates your account. You plug the ATM back, withdraw ...
• 85.7k