Silent overflow of _fCashAmount
The contract downcasts a user-supplied amount to a smaller integer type without checking, so a value larger than the type's maximum silently overflows. An attacker could pass such a value to cause unexpected behaviour, though the text does not specify the exact consequence.
Submitted by GreyArt, also found by Meera
Description
If a _fCashAmount value that is greater than uint88 is passed into the _mint function, downcasting it to uint88 will silently overflow.
Recommended Mitigation Steps
// Use a safe downcast function e.g. wfCashLogic::_safeUint88
function _safeUint88(uint256 x) internal pure returns (uint88) {hil
require(x <= uint256(type(uint88).max));
return uint88(x);
}
ckoopmann (Index Coop) confirmed and commented:
This seems reasonable and we’ll probably adopt the suggested mitigation approach.
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 code casts a uint256 to uint88 without first checking that the value fits, so the cast truncates silently.
Impact
An attacker could supply an oversized amount to trigger the silent overflow, potentially causing incorrect accounting or unexpected behaviour, though the text does not detail the exact impact.
What the attacker needed
Ability to call the _mint function with a large _fCashAmount
The fix
The project should use a safe downcast function that checks the value is within the target type's range before converting.
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.
A smart contract stores numbers in fixed-size containers. If you try to put a number that is too big into a smaller container, the extra part is cut off without warning, like pouring a litre of water into a 100 ml glass. This report says the contract does that with an amount, which could make the contract behave in an unintended way.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.