sherlock-audit / 2024-01-napier-judging

9 stars 6 forks source link

DenTonylifer - Missing zero amount check may lead to loss of funds #71

Closed sherlock-admin closed 7 months ago

sherlock-admin commented 7 months ago

DenTonylifer

high

Missing zero amount check may lead to loss of funds

Summary

Malicious user can steal accrued interest from other user using redeemWithYT() function.

Vulnerability Detail

This function is used for withdrawing underlying tokens from the caller in exchange for amount of PT and YT. Withdrawn amount will be the sum of the following:

Manual Review

Recommendation

Recomended to add zero amount check to prevent calling this function by users with zero allowance, when caller is not from:

+     if (pyAmount == 0) revert ZeroAmount();

Duplicate of #28

sherlock-admin commented 7 months ago

1 comment(s) were left on this issue during the judging contest.

takarez commented:

valid: high(1)

sherlock-admin4 commented 7 months ago

The protocol team fixed this issue in PR/commit https://github.com/napierfi/napier-v1/pull/171.

sherlock-admin4 commented 6 months ago

The Lead Senior Watson signed off on the fix.