Incorrect Decimals Setting for ckrBTC Token May Lead to User Confusion and Inaccurate Transaction Amounts
The ckrBTC token on Starknet uses 18 decimals instead of the expected 8 for a Bitcoin-pegged asset. This could confuse users about amounts and cause tools relying on 8 decimals to malfunction.
Xor0v0 Follow with AllTooWell and Abdessamed
Originally disclosed on Code4rena
Submitted by Xor0v0, also found by AllTooWell and Abdessamed
Impact
In the OpenZeppelin library, the decimals of the ERC20 component defaults to 18, which is abnormal for BTC. Incorrect decimal settings may result in users entering incorrect amounts or understanding incorrect balances during transactions. This confusion may lead to property damage or transaction failure, especially when the transaction amount is large.
On the other hand, many tools, applications, or smart contracts related to Bitcoin may rely on an accuracy of 8 decimal places. If the accuracy setting is incorrect, these tools or contracts may not work properly, thereby affecting the operation of the entire ecosystem.
Proof of Concept
Recommended Mitigation Steps
Rewrite the decimals to 8 for the ckrBTC token.
The Warden has identified that the
ckrBTCtoken on the Starknet network has a different number of decimals than on other networks, causing theckrBTCvariant of the Starknet network to be consistently overvalued.I do not envision any impact from this discrepancy apart from the value per whole unit of
ckrBTCtoken on the Starknet network being higher than the value per whole unit ofckrBTCtoken on other networks. As such, I believe a medium-risk rating is acceptable.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the token contract inherited OpenZeppelin's default of 18 decimals instead of explicitly setting 8 for a Bitcoin-pegged asset.
Impact
The judge noted the Starknet token variant is consistently overvalued per whole unit, but did not see other impact; no exploit or fund loss is demonstrated.
What the attacker needed
None
The fix
The decimals should be set to 8 for the ckrBTC token.
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 report has not been written yet. The Original tab links to the source.
Tokens have a 'decimals' setting that says how many decimal places the smallest unit represents. Bitcoin normally uses 8, but this token used 18, so the same number of tokens could look very different and confuse people or tools.
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.