code-423n4 / 2022-06-illuminate-findings

1 stars 0 forks source link

QA Report #403

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

1. Setting a new admin should be a 2-step process

Line References

Lender.sol#L129-L132

Impact

If the incorrect address is mistakenly supplied to setAdmin, the Lender.sol contract would be completely compromised since functions such as approve could cause a lot of damage.

Recommmended Mitigation Steps

Consider using a proposeAdmin function that sets a pending admin and a acceptAdminfunction for the pending admin to accept the admin role.

2. Element pool e is not validated

Line References

Lender.sol#L362

Impact

A user can pass a malicious contract e into the element lend function which returns any amount. The returned purchased amount is then emitted and returned by the lend function. This could lead to undesirable behaviour depending on how the emitted and return values are used.

Recommmended Mitigation Steps

Check the amount of PT gained from the swap by comparing the purchased value to the difference in balance before and after the swap.