Ondo Finance - BenRai's results

Institutional-Grade Finance. On-Chain. For Everyone.

General Information

Platform: Code4rena

Start Date: 01/09/2023

Pot Size: $36,500 USDC

Total HM: 4

Participants: 70

Period: 6 days

Judge: kirk-baird

Id: 281

League: ETH

Ondo Finance

Findings Distribution

Researcher Performance

Rank: 13/70

Findings: 2

Award: $778.38

QA:
grade-b

🌟 Selected for report: 0

πŸš€ Solo Findings: 0

Findings Information

🌟 Selected for report: 0xAsen

Also found by: 0xStalin, Arz, BenRai, Delvir0, Inspecktor, merlin

Labels

bug
2 (Med Risk)
downgraded by judge
satisfactory
sponsor disputed
sufficient quality report
duplicate-136

Awards

771.2966 USDC - $771.30

External Links

Lines of code

https://github.com/code-423n4/2023-09-ondo/blob/47d34d6d4a5303af5f46e907ac2292e6a7745f6c/contracts/usdy/rUSDY.sol#L672-L683

Vulnerability details

Impact

Once an account is blacklisted or sanctioned the rUSDY funds it holds can not be burned

Proof of Concept

According to the team the rUSDY.burn() function will be used β€œin cases in which a user has USDY but is legally not allowed to own it” so for example if he got it from hacking someone else’s wallet. Normaly in case of a hack the rUSDY of the suspicious account would not be burned right away but the account would be put on the blocklist first until all details are clarified. The problem is that the burn() function calls _burnShares which calls _beforeTokenTransfer. _beforeTokenTransfer checks if the accounts involved in the transaction are on the blocklist / sanction list and reverts if they are. This means that if the account is on one of the two list, it is not possible to burn its shares. So before burning the shares of the suspicious account, the admins needs to remove the account from the blocklist/sanction list. Since removing the account from the lists and burning the shares are two different transactions, this opens up a possibility for the suspicious account to front run the burning transaction and move his rUSDY to an other account that is not on any of the list. Then he can burn the rUSDY and swapping the received USDY to any other coin and escape with the hacked funds.

Tools Used

Manual review

When calling rUSDY.burn(), burn the shares of the contract directly without calling _burnShares. This way the transaction does not call _beforeTokenTransfer and does not revert if the account the shares should be burned from is on the blocklist or the sanction list.

Assessed type

Timing

#0 - c4-pre-sort

2023-09-07T22:01:09Z

raymondfam marked the issue as primary issue

#1 - c4-pre-sort

2023-09-07T22:01:24Z

raymondfam marked the issue as sufficient quality report

#2 - tom2o17

2023-09-11T16:31:43Z

Can I not assume that the guardian can batch execute transactions? Given that the guardian will also have the ability to add/remove from blocklist can I not assume that the guardian can batch:

blocklist.removeFromBlocklist() rUSDY.burn() blocklist.addToBlocklist()

ifl this is not an issue considering the guardian address can execute any peripheral txns in an atomic fashion.

#3 - c4-sponsor

2023-09-11T16:31:44Z

tom2o17 (sponsor) disputed

#4 - kirk-baird

2023-09-19T09:15:09Z

This is an interesting edge case. While it may be possible for guardian to bypass this issue, if it is a smart contract that can batch transactions I see this as a potential issue.

Going to downgrade it to medium severity as there are some theoretical workarounds to this problem.

#5 - c4-judge

2023-09-19T09:15:16Z

kirk-baird changed the severity to 2 (Med Risk)

#6 - c4-judge

2023-09-19T09:16:13Z

kirk-baird marked issue #136 as primary and marked this issue as a duplicate of 136

#7 - c4-judge

2023-09-19T09:16:37Z

kirk-baird marked the issue as satisfactory

#8 - tom2o17

2023-09-26T19:29:33Z

Not to impact judging,

But to your point @kirk-baird, we are using a gnosis safe contract as the guardian, and plan to do a similar setup for the majority of tokens going forward. Perhaps we should have made note of that in the ReadME.md πŸ€·πŸΌβ€β™€οΈ

#9 - kirk-baird

2023-09-27T01:29:08Z

Not to impact judging,

But to your point @kirk-baird, we are using a gnosis safe contract as the guardian, and plan to do a similar setup for the majority of tokens going forward. Perhaps we should have made note of that in the ReadME.md πŸ€·πŸΌβ€β™€οΈ

Okay thanks for clarifying, that does resolve the issue. Though, for the judging the wardens weren't aware of this so I'll consider it a valid issue.

Awards

7.08 USDC - $7.08

Labels

bug
downgraded by judge
grade-b
low quality report
QA (Quality Assurance)
Q-23

External Links

Lines of code

https://github.com/code-423n4/2023-09-ondo/blob/47d34d6d4a5303af5f46e907ac2292e6a7745f6c/contracts/usdy/rUSDY.sol#L353-L364

Vulnerability details

Impact

When user A wants to decrease the allowance he has given to user B and user B spends some of the allowance in the meantime, the function will revert and user B will still have some allowance that he should not have

Proof of Concept

When calling decreaseAllowance() the function checks if the amount by which the allowance should be decreased is <= the current allowance. If the amount is bigger than the current allowance, the function reverts, and the allowance is not changed. This results in the user who should not be having any allowance to still have some allowance he should not be having.

Tools Used

Manual review

Since the intend of user A was to take away the allowance given to user B consider, instead of reverting, to set the allowance for user B to 0 if the decrease in allowance exceeds the current allowance. This prevents use B from spending any more of user A’s tokens and saves user A from the need to call reduceAllowance again and pay gas again.

Assessed type

ERC20

#0 - c4-pre-sort

2023-09-08T17:17:05Z

raymondfam marked the issue as low quality report

#1 - c4-pre-sort

2023-09-08T17:17:28Z

raymondfam marked the issue as duplicate of #52

#2 - c4-judge

2023-09-19T10:48:47Z

kirk-baird marked the issue as unsatisfactory: Invalid

#3 - BenRai1

2023-09-25T13:17:24Z

I think this is not a dublicat of https://github.com/code-423n4/2023-09-ondo-findings/issues/52. Would be great if you could take a second look here @kirk-baird

#4 - c4-judge

2023-09-25T22:45:06Z

kirk-baird marked the issue as not a duplicate

#5 - c4-judge

2023-09-25T22:45:14Z

kirk-baird removed the grade

#6 - kirk-baird

2023-09-25T22:51:02Z

Agreed with @BenRai1 this issue is different to #52 in that it covers a case where there allowance is partially front-run to prevent decreasing.

I don't believe this is sufficient to qualify for medium since the user is already able to front-run the change of allowance and spend all of the funds. However, this would be an unpleasant edge case for the allower.

@tom2o17 worth considering patching this case.

#7 - c4-judge

2023-09-25T22:51:06Z

kirk-baird changed the severity to QA (Quality Assurance)

#8 - c4-judge

2023-09-25T22:57:37Z

kirk-baird marked the issue as grade-b

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax Β© 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter