The Ethereum Foundation Bounty program received a report from Christoph Jentzsch about a bug in the Solidity optimizer. This bug has been fixed with the release of Solidity 0.4.11 on 2017-05-03.
The bug affected the optimizer’s handling of constants in the byte code. It resulted in the optimizer failing to properly recreate the original constant in certain cases.
The bug was observed in a contract where the addition of an unrelated method caused another method to stop functioning. Analysis revealed specific conditions that needed to be present for the bug to trigger, including the use of certain constants in the code.
The bug has been present in all released versions of Solidity since at least summer 2015. Despite its long presence, it was difficult to trigger using typical code.
A static analysis of all contract code deployed on the blockchain did not reveal any instances of the invalidly generated routine associated with the bug. However, this does not guarantee the absence of such occurrences.
To improve transparency and awareness of Solidity-related vulnerabilities, information about such issues is now being exported as JSON files in the Solidity code repository. We hope that block explorers will integrate this information for users’ benefit.
Etherscan has already implemented this feature.
To address the bug, a mini-EVM was added to the optimizer to verify the correctness of each generated routine during compile time. Additionally, efforts have begun on developing a more high-level intermediate language to replace the current optimizer and improve its auditability.