Do not accept truncated function selectors.#3065
Conversation
|
Is the |
|
No, the EVM is. The code is |
|
Right. I am inclined to say this may be worth considering as an entry on the bug list. |
|
We have scales on which we evaluate bugs for the bug list:
This bug scores extremely positive on all three scales:
|
|
I experimented with this for the uctf: I could find no fault in the solidity implementation. |
|
It turns out, there are even less cases where this can happen: If your contract has a fallback function, you are safe. This means this can be used to call functions with signature zero if someone just wants to send ether to the contract, and this function also has to be payable. |
0e0ce43 to
f2670a7
Compare
|
I really like the method signature that I brute-forced. Too bad it was useless for the uctf competition though 😢 |
|
I also tried two function signatures with the same hash, but Solidity refused that. |
|
Yeah, that's also something I fiddled with for uctf. |
| "summary": "It is possible to craft the name of a function such that it is executed instead of the fallback function in very specific circumstances.", | ||
| "description": "If a function has a selector consisting only of zeros, is payable and part of a contract that does not have a fallback function and at most five external functions in total, this function is called instead of the fallback function if Ether is sent to the contract without data.", | ||
| "fixed": "0.4.18", | ||
| "severity": "very low" |
There was a problem hiding this comment.
Should this be a key "verylow" or a user readable string?
There was a problem hiding this comment.
I would say both. Why can't keys have spaces?
|
Weird, I don't get the test errors locally. |
ca85fa6 to
7849b92
Compare
This prevents problems where function selectors end in zeros and similar things.
Especially, if you have a contract that only has a single function and this function's selector is
0x00000000, the fallback function was not triggered on empty data.