gracePeriod not increased after membership extension
When a membership was extended, the contract increased the creation timestamp but left the grace period unchanged, so the grace period could end earlier than intended relative to the new membership duration. The project confirmed this could affect membership duration and fixed it.
FairSide contest
Originally disclosed on Code4rena
In the function purchaseMembership of FSDNetwork.sol, when the membership is extended, membership[msg.sender].creation is increased. However, membership[msg.sender].gracePeriod is not increased. This might lead to a gracePeriod that is lower than expected. It seems logical to also increase the gracePeriod.
FSDNetwork.sol:
function purchaseMembership(uint256 costShareBenefit) external {
...
if (membership[msg.sender].creation == 0) {
...
membership[msg.sender].creation = block.timestamp;
membership[msg.sender].gracePeriod = membership[msg.sender].creation + MEMBERSHIP_DURATION + 60 days;
} else {
....
membership[msg.sender].creation += durationIncrease;
}
Recommend checking to see if gracePeriod has to be increased and then adding the necessary logic when that is the case.
fairside-core (FairSide) confirmed:
This should be bumped to a medium severity finding as it actually does not affect the membership duration at all if the
gracePeriodis not updated.
fairside-core (FairSide) commented:
Fixed in PR#21.
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 extension branch updated only the creation timestamp and forgot to shift the grace period by the same duration increase.
Impact
The grace period could be shorter than expected relative to the extended membership, which the project said could affect membership duration.
What the attacker needed
A membership already exists; caller extends the membership
The fix
The project fixed it in a pull request by adding logic to increase the grace period when the membership is extended.
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 stored two dates for each member: when the membership started and a later grace period. When someone extended their membership, only the start date moved forward, so the grace period no longer lined up with the new end date. The project agreed this was a real problem and changed the code.
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.