Questions tagged [security]

Questions relating to application security, safety, trust, and attacks against the Ethereum software stack and blockchain system.

Filter by
Sorted by
Tagged with
216 votes
20 answers
87k views

How can I securely generate a random number in my smart contract?

If I am writing a smart contract for some kind of (gambling) game, how can I generate a random number securely? What are the best practises and security trade-offs to be aware of?
user avatar
  • 8,231
69 votes
4 answers
58k views

<address>.send vs <address>.transfer best practice usage?

I noticed that address's offer two member functions that perform the transfer of ether to the specified address. send returns false upon failure and transfer raises an exception. In the Solidity ...
user avatar
  • 935
65 votes
3 answers
17k views

Why can't contracts make API calls?

The model that contracts can only accept and process data, instead of also being able to retrieve data from the Internet, seems limiting (even if not, it's less direct). If a concern is that data or ...
user avatar
  • 78.7k
65 votes
6 answers
100k views

What number of confirmations is considered secure in Ethereum?

In Bitcoin, 6 confirmations are considered secure (very low probability of transaction/block reversal). What is the current number in Ethereum?
user avatar
  • 78.7k
60 votes
7 answers
15k views

How can I verify that a contract on the blockchain matches the source code?

Given the (Solidity) source code of a smart contract, is there a way to deterministically compile the code and compare it with the code on the blockchain? I want to verify that the contract does what ...
user avatar
  • 8,231
53 votes
3 answers
24k views

How to reduce the chances of your Ethereum wallet getting hacked?

Summary The hack that occurred on May 12 2016 to steal 7,218 ethers from Patrick only affects miners where: Incoming RPC connections from the Internet on TCP port 8545 are forwarded to the machine ...
user avatar
51 votes
4 answers
12k views

Is there anything stopping me from using the ethereum blockchain as data storage?

As I understand it, smart contracts are currently immortal by default. Does this mean that I could create a contract that happened to contain an encoded form of baby photos and have it stored forever? ...
user avatar
  • 1,375
49 votes
3 answers
10k views

What is a recursive calling vulnerability?

What is a recursive calling vulnerability exactly? When creating smart contracts, DAOs or DAPPs, what measures can I take to ensure I am not vulnerable?
user avatar
  • 593
37 votes
3 answers
10k views

Can a contract safely rely on block.timestamp?

How safe is it to use block.timestamp as contract expiration time? If a miner provides an incorrect timestamp in a block header, how much can it be off before it is rejected by other nodes? Is there a ...
user avatar
  • 8,231
32 votes
1 answer
6k views

When can BLOCKHASH be safely used for a random number? When would it be unsafe?

I've seen more complicated ways for a contract to generate a random number. But the Ethereum Yellow Paper itself suggests a "trivial solution" using the BLOCKHASH opcode (see below, bold is mine). ...
user avatar
  • 78.7k
32 votes
2 answers
10k views

Is each Ethereum address shared by (theoretically) 2 ** 96 private keys?

Summary This is an extended question to How are ethereum addresses generated?. In Ethereum, a private key is 256-bit long, but an address is only 160-bit long. By "Pigeonhole Principle", it ...
user avatar
30 votes
2 answers
6k views

Ethereum smart contract security checklist

Is there a tool, checklist of methodology to help reviewing smart contract security? E.g. for each of function you review Is there re-entry possibility and how it behaves on re-entry How it behaves ...
user avatar
29 votes
3 answers
4k views

Is Ethereum secure against an attack by quantum computers?

Does Ethereum implement Post-quantum cryptography? Or will the network break once a malicious actor gains control of an effective quantum computer?
user avatar
  • 1,375
29 votes
3 answers
21k views

How can I make new account by JSON-RPC?

I'd like to make new account by JSON-RPC.I've checked the wiki of Ethereum, however I could not find out how to do that. I've found call existed accounts, but it isn't what I want. eth_accounts ...
user avatar
  • 2,237
27 votes
6 answers
43k views

Is there a way to generate ethereum paper wallets?

Is it possible to store ether on paper wallets or generate printable private keys offline somehow?
user avatar
  • 31.4k
24 votes
3 answers
8k views

How do gas refunds work?

Gas refunds are provided when clearing storage or calling SELFDESTRUCT on contracts. The Yellow Paper mentions that refunds are "being capped up to a maximum of half...". What exactly is ...
user avatar
  • 78.7k
22 votes
3 answers
6k views

Account uniqueness guaranteed?

When we create an account in the Ethereum main network, how does the protocol guarantee the unique address of an account? Since even if we are not connected to the network we can create an account, is ...
user avatar
22 votes
2 answers
4k views

What are effective techniques to encrypt/decrypt data stored in a smart contract?

Rather than sending and storing plain text in a smart contract, the use case objective is to encrypt first and then subsequently access the data and decrypt at the point of use. What is the most ...
user avatar
  • 1,605
22 votes
1 answer
10k views

Is Solidity block.number more secure than timestamp?

In Solidity, some properties such as block.timestamp are attackable by miners and are not (strongly) protected by the protocol. How about block.number, could a miner introduce a randomly high number? ...
user avatar
  • 8,114
21 votes
4 answers
12k views

Does Web3.js have the functionality to create new accounts and unlock an account for a period of time for a series of transactions?

I want to create new accounts through my Dapp web interface and unlock a specific account so that transactions can be processed. I didn't see it in the web3.js documentation so wonder if that's on the ...
user avatar
  • 1,605
21 votes
1 answer
3k views

What if I had the private key that had the public address of a contract?

Could I spend the money a contract owns if I had the private key that goes to the public address that a contract resides at? (I realize that I'd have a better chance of being struck by lightning ...
user avatar
  • 5,838
21 votes
2 answers
8k views

Is it safe to reuse Ether addresses?

I believe it's viewed as unsafe in Bitcoin because of the way transactions are signed. Is this also true for Ether addresses?
user avatar
  • 261
21 votes
3 answers
4k views

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

Can anyone explain that how the DAO attack happened? Vitalik Buterin explained here that it was performed by splitting a DAO from the main DAO but calling the split function recursively. We know that ...
20 votes
3 answers
7k views

How does the Ethereum ETH accounting system work and prevent double-spends?

In Bitcoin, the BTC accounting system is based on UTXOs (Unspent Transaction Outputs), which prevents the same BTC from being spent multiple times. I heard that Ethereum has a simpler account balance ...
user avatar
  • 2,450
20 votes
3 answers
6k views

How does Oraclize handle the TLSnotary secret?

Oraclize claims to offer a provably honest secure retrieval of a webpage by taking advantage of TLSnotary (a service that allows an auditor to verify if a specific web page was accurately retrieved) ...
user avatar
19 votes
5 answers
7k views

Is there any safe way to send money from a cold wallet, using an untrusted computer?

You have 2 computers. One is 100% offline and, thus, trusted. Other is online. Private keys are stored on the offline computer and the online computer has no access to it. Is there any way to sign a ...
user avatar
  • 3,147
19 votes
3 answers
9k views

send VS call - differences and when to use and when not to use

Can somebody please explain the differences between using a send and call for contracts and when to use and not use these different methods? For example : msg.sender.send(number); msg.sender....
user avatar
19 votes
1 answer
5k views

How to access external knowledge / data in a smart contract

let’s say a contract wants to execute on knowledge contained outside the blockchain (e.g. whats the price of gold, what was the avg windspeed in NYC, how many people moved to portland in the last ...
user avatar
  • 293
18 votes
3 answers
12k views

Is it possible to overflow uints?

The Ethereum token tutorial has a check for a uint256 overflow. function transfer(address _to, uint256 _value) { /* Check if sender has balance and for overflows */ if (balanceOf[msg.sender] ...
user avatar
18 votes
3 answers
12k views

How to validate a private key?

I could not find any library that, given an hex value, returns true if the given string is a valid ether private key. Any hints?
user avatar
  • 355
18 votes
1 answer
8k views

What happens if transaction runs out of gas before transaction completes?

As gas cost can only be estimated until the transaction is executed against the actual contract state at the time of execution on the blockchain, what happens if transaction runs out of gas before the ...
user avatar
  • 5,030
18 votes
5 answers
3k views

How will regular users be able to use dApps without buying ether?

Requiring users to get ether before they can use a dApp, is too much of a barrier for any kind of mainstream adoption. If dApps offer free ether in a naive way, they can be attacked by Sybils where a ...
user avatar
  • 78.7k
17 votes
2 answers
7k views

Is transfer() still safe after the Istanbul update?

In other words, is using transfer() safe? function transfer(address contractB) public { contractB.transfer(1000); //balances[msg.sender] -= 1000; } How about using call.gas? function ...
user avatar
17 votes
3 answers
2k views

What are effective and secure ways of shuffling a deck of cards in a contract?

We want to write a card game in Ethereum. What are effective and secure ways of shuffling a deck of cards in a contract, and dealing them to players? It needs to be done in a way so that no one can ...
user avatar
  • 78.7k
17 votes
2 answers
3k views

During a 51% attack, What Can the Attacker Actually Accomplish?

During an attack on the network, where the attacker has more than 51% of hashing power (or the equivalent of Ether in PoS), what can the attacker do and not do to the chain and the contracts on it? ...
user avatar
  • 917
16 votes
1 answer
7k views

Inheritance and Function Overwriting: Who can call the parent function?

I want to know who is still able to call an original overwritten function in case of inheritance. Let's assume I have the following setup: contract A{ address public owner; function A(){ ...
user avatar
15 votes
2 answers
6k views

Is it possible to call the constructor function of an existing contract?

In theory, a constructor is just a function like any other function, but only gets called once at construction time. Because the EVM doesn't know the notion of a constructor, in theory, a constructor ...
user avatar
15 votes
1 answer
5k views

What are the risks associated with using Ethereum?

Knowing the risks associated with a system, their probability and their severity is the first step towards good risk management. There is little details and analysis that has been published about the ...
user avatar
  • 288
15 votes
1 answer
1k views

Does Ethereum Suffer From Transaction Malleability?

Does Ethereum in its current form (Homestead, specifically Geth v1.3.6) have transaction malleability issues similar to Bitcoin? If so, is there a standard method for deriving a normalized hash for ...
user avatar
15 votes
1 answer
893 views

Why were empty accounts allowed to be on the blockchain?

It's hard to see what the benefits of allowing empty accounts to be on the blockchain are. This was a known subtlety (see "note: there is a difference between zero-balance and nonexistent") and ...
user avatar
  • 78.7k
14 votes
3 answers
821 views

Why does Ethereum have gas?

Why does Ethereum have gas? What other approaches could Ethereum have used to work around the Halting Problem?
user avatar
  • 78.7k
14 votes
3 answers
2k views

Is a fully private blockchain network immutable?

I always hear that immutability is one of the great assets of using blockchains in banks. An auditor can come and look at the list of transactions and it will trust them because blockchains are ...
user avatar
  • 2,275
14 votes
4 answers
9k views

What Hierarchical Deterministic (HD) wallets are available for Ethereum?

A Hierarchical Deterministic (HD) wallet has some nice features such as easier backup (instead of needing to backup multiple keystore files and the passwords for each of them). Are there any ...
14 votes
1 answer
2k views

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

I'm trying to get some sense from the hysteria around the attack performed to The DAO smart contract. I understand the high level explanations, but I'd like to grasp how this attack was performed. I'...
user avatar
13 votes
2 answers
1k views

If someone gets my geth keystore files, can they spend my ETH without knowing my password(s)?

I always assumed so, since geth requires a new password for every account, but just want to be sure.
user avatar
  • 714
13 votes
1 answer
4k views

Why isn't fast sync the default?

As I understand, fast sync has all the security guarantees of a full sync, but is faster. Is that correct? If so, why isn't fast sync the default?
user avatar
  • 2,450
13 votes
1 answer
3k views

Explain "griefing" attack on Aave flash loan

Aave doc about flash loan warns to never store funds inside a receiver contract as it can be exposed to "griefing" attack. So my questions are Can you give an example of this attack? How ...
user avatar
13 votes
2 answers
887 views

restricting sensitive information accessible from / linked to the blockchain?

I'm currently researching the practicalities of implementing a blockchain ledger whereby the company I work for, our competitors, our clients, our clients users (who we service indirectly) and an ...
user avatar
12 votes
2 answers
5k views

How to steal eth using delegatecall and selfdestruct

This documentation says Even if a contract’s code does not contain a call to selfdestruct, it can still perform that operation using delegatecall or callcode. This worries me. I've created ...
user avatar
12 votes
2 answers
7k views

Solidity functions - private visibility

Is the following function parameter (string name) only visible to the owner contract itself? function myFunction(string name) private returns (bool) { return true; } So nobody can read / see ...
user avatar

1
2 3 4 5
16