6

we have just finished a phase of our ICO and we were looking among the transactions. Someone managed to send 0 ETH to our contract and in return got 130 000 tokens. How did he do that and how vulnerable is our system?

This is the holder with our tokens: https://etherscan.io/token/0x9a9ae6884c65725c8f5378dbb6d3900bff36da53?a=0x2bf6064d8fdb75af047d3db4743d436adb326312

These are his transactions. He seems to have created his own contract and he has done the same to someone else: https://etherscan.io/address/0x2bf6064d8fdb75af047d3db4743d436adb326312

Please help

3
  • Thanks for the answer. It wasnt mint tokens function because I am the one who does the minting. This transaction I do not recognize. Furthermore, the address that got the token appears to have sent 0 ETH towards the contract. I do not fully understand what is going on and I am unable to explain very well. Maybe this person managed to gain access to my contract owner private key?
    – Cristian
    Jul 31, 2018 at 4:39
  • It seems like the use of the mintTokens is used somewhere that is external from the contract itself. When I look at the token contracts transactions (etherscan.io/address/0x9a9ae6884c65725c8f5378dbb6d3900bff36da53), I don't see any ether flowing through...so where is ETH being sent and what is the scenario that is calling the mintTokens function? From an outside perspective, it seems like the fault is somewhere in centralized code.
    – ReyHaynes
    Jul 31, 2018 at 14:20
  • 1
    If you are 0x03fdb8a96b10872bcd7303fd00a6cb59d91382b6 is possible that someone got access to your private key, but I can say for certain that it was this address, the contract owner, who initiated the function call. You can see that here. They called the mintTokens function with 0x2bf6064d8fdb75af047d3db4743d436adb326312 as the recieving address, and 0x1c65935853bfead00000 == 134100000000000000000000 as the amount of tokens. Jul 31, 2018 at 17:59

1 Answer 1

12

It wasn't just just "someone"... it was the contract creator who made the transaction, and there is a function called mintTokens which allows them to exactly do this.

/**
 *  Allows owner to create tokens without ETH
 */
function mintTokens(address _address, uint256 amount) public onlyOwner isUnderHardCap
{
    if(disown == 1) revert();

    if (amount + tokenTotalSupply > hardcap) revert();
    if (amount < 1) revert();

    //add tokens to balance
    balances[_address] = balances[_address] + amount;

    //increase total tokens
    tokenTotalSupply = tokenTotalSupply.add(amount);
    Transfer(this, _address, amount);
    noContributors++;
}

Additionally, it looks like if (amount + tokenTotalSupply > hardcap) revert(); is vulnerable to an overflow attack.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.