-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
So it is possolible that attacker will spend old and new balance available to him in case of unfortunate transaction ordering. More about it you can find here https://docs.google.com/document/d/1YLPtQxZu1UAvO9cZ1O2RPXBbT0mooh4DYKjA_jp-RLM/edit#heading=h.m9fhqynw2xvt
You are using StandardToken so it is mentioned also in their code
/**
- @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
- Beware that changing an allowance with this method brings the risk that someone may use both the old
- and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
- race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
- ERC: Token standard ethereum/EIPs#20 (comment)
- @param _spender The address which will spend the funds.
- @param _value The amount of tokens to be spent.
*/
to solve this you can add such code to the approve function
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
eth address - 0xE14f7A9AF3F75a4Ccd33909B0046b16d82c6EC0e
Reactions are currently unavailable