Ajna Protocol - Evo's results

A peer to peer, oracleless, permissionless lending protocol with no governance, accepting both fungible and non fungible tokens as collateral.

General Information

Platform: Code4rena

Start Date: 03/05/2023

Pot Size: $60,500 USDC

Total HM: 25

Participants: 114

Period: 8 days

Judge: Picodes

Total Solo HM: 6

Id: 234

League: ETH

Ajna Protocol

Findings Distribution

Researcher Performance

Rank: 110/114

Findings: 1

Award: $15.58

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

15.5756 USDC - $15.58

Labels

bug
3 (High Risk)
satisfactory
upgraded by judge
duplicate-251

External Links

Lines of code

https://github.com/code-423n4/2023-05-ajna/blob/main/ajna-core/src/RewardsManager.sol#L597 https://github.com/code-423n4/2023-05-ajna/blob/main/ajna-core/src/RewardsManager.sol#L815

Vulnerability details

Impact

Staker will earn less than expected

Proof of Concept

On _claimRewards function at https://github.com/code-423n4/2023-05-ajna/blob/main/ajna-core/src/RewardsManager.sol#L597 transferAjnaRewards is being called to claim rewardsEarned for staker according to the tokenId, the issue here drop at https://github.com/code-423n4/2023-05-ajna/blob/main/ajna-core/src/RewardsManager.sol#L815

if (rewardsEarned_ > ajnaBalance) rewardsEarned_ = ajnaBalance;

when _transferAjnaRewards function is transferring the rewardsEarned_ value if the rewardsEarned_ greater than contract's ERC20 balance then it will update rewardsEarned_ to equal the balance ignoring the remaining rewards anyway. which is unfairness and mess with the staker rewards with no reason for missing his rewards value. this would give unclear results for stakers when they claim their rewards after staking for a period of time.

Tools Used

Manual Review

Track the rewardsEarned_ by hash map and keep what left in the rewardsEarned_ to transfer later when the contract has balance again.

Assessed type

Token-Transfer

#0 - c4-judge

2023-05-12T10:34:01Z

Picodes marked the issue as duplicate of #361

#1 - c4-judge

2023-05-29T20:55:43Z

Picodes changed the severity to 3 (High Risk)

#2 - c4-judge

2023-05-29T20:56:28Z

Picodes marked the issue as satisfactory

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