Submitted by immeas, also found by wait, unforgiven, JTJabba, rvierdiiev, hihen, and HollaDieWaldfee
When a user wants to issue RTokens there is a limit of how many can be issued in the same block. This is determined in the whenFinished function.
It looks at how many tokens the user wants to issue and then using the issuanceRate it calculates which block the issuance will end up in, allVestAt.
If this is the current block and the user has no other queued issuances the issuance can be immediate otherwise it is queued to be issued after the allVestAt block.
Then in vestUpTo it is checked that this is vested at a later block:
If a user decides that they do not want to do this vesting they can cancel pending items using cancel, which will return the deposited tokens to them.
However this cancel does not reduce the allVestAt state so later issuances will still be compared to this state.
Hence a malicious user can issue a lot of RTokens (possibly using a flash loan) to increase allVestAt and then cancel their queued issuance. Since this only costs gas this can be repeated to push allVestAt to a very large number effectively delaying all vesting for a very long time.
A malicious user can delay issuances a very long time costing only gas.
PoC test in RToken.test.ts:
Manual auditing and hardhat
cancel could decrease the allVestAt. Even though, theres still a small possibility to grief by front running someones issuance with a large issue/cancel causing their vest to be late, but this is perhaps an acceptable risk as they can then just cancel and re-issue.
tbrent (Reserve) confirmed via duplicate issue #364
tbrent (Reserve) mitigated:
Status: Mitigation confirmed with comments. Full details in reports from HollaDieWaldfee, 0xA5DF, and AkshaySrivastav.
