Polkadot Frontier EVM
An integer truncation bug in the Frontier EVM allowed a user to supply a 256-bit msg.value that was truncated to 128 bits for the native balance transfer, so the transfer moved zero while contracts like WETH credited the full untruncated amount. An attacker could drain wrapped native token contracts and abuse DEXes and lending protocols on affected Polkadot parachains.
pwning.mirror.xyz
Published on pwning.mirror.xyz
People are joking around the seeming depegging of WETH. The wrapped ETH token contract, the most simple and fundamental contract in the Ethereum ecosystem, is used in almost every DeFi protocol.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the EVM runner truncated the user-controlled 256-bit msg.value to 128 bits before calling the substrate currency transfer, without rejecting values that do not fit.
Impact
The direct exploit could drain all wrapped token contracts, and a more sophisticated exploit could borrow other assets against the fake deposit; the text estimates over $44M in wrapped-token losses and around $150M in remaining borrowable assets at risk.
What the attacker needed
Access to an affected parachain; a contract that trusts msg.value
The fix
The bug was fixed in Frontier via a pull request and a security advisory was published.
How it was found
- Identify that Frontier truncates the 256-bit msg.value to 128 bits for the native transfer.
- Send a transaction with msg.value equal to 1 << 128 so the truncated transfer amount is zero.
- Target a contract such as WETH that credits the full msg.value internally.
- Use the inflated internal balance to withdraw or spend the contract's deposited native tokens.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A blockchain EVM handles money as very large numbers (256 bits), but the Polkadot ledger underneath only supports smaller numbers (128 bits). The code cut the larger number down to fit, so a huge payment became zero for the actual transfer, yet the smart contract still believed the full huge amount had been paid. That let an attacker mint fake credit and drain funds.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.