kadenzipfel / smart-contract-vulnerabilities

A collection of smart contract vulnerabilities along with prevention methods
https://kadenzipfel.github.io/smart-contract-vulnerabilities/
1.63k stars 219 forks source link

[Attack/Vulnerability] Dependence on Gas Calculations #16

Closed RobertMCForster closed 2 years ago

RobertMCForster commented 4 years ago

Not sure exactly what to call this but some contracts may have functionality such as rewarding the caller for the amount of gas they spend. This would typically take the form of recording gasleft() at the beginning of the function and gasleft() at the end of the function, although if there are calls in-between where the attacker could call their own contract, they have the ability to spend a lot of gas on a fodder contract by deleting, have the full amount spent on deletes rewarded to them, but only end up paying a partial amount of gas.