Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nonReentrant not used everywhere #5

Closed
code423n4 opened this issue Jun 20, 2021 · 1 comment
Closed

nonReentrant not used everywhere #5

code423n4 opened this issue Jun 20, 2021 · 1 comment
Labels
1 (Low Risk) bug Something isn't working duplicate This issue or pull request already exists

Comments

@code423n4
Copy link
Contributor

Handle

gpersoon

Vulnerability details

Impact

The functions supplyTokenTo and redeemToken have an extra secury measure of nonReentrant in 3 of the 5 yield source contracts:
ATokenYieldSource.sol, IdleYieldSource.sol, YearnV2YieldSource.sol
However in the following 2 yield source contracts its not present:
BadgerYieldSource.sol, SushiYieldSource.sol

Although I don't see any immediate issue, it can't hurt to add nonReentrant to prevent potential reentrancy problems.

Proof of Concept

.\contracts\yield-source\ATokenYieldSource.sol: function supplyTokenTo(uint256 mintAmount, address to) external override nonReentrant {
.\contracts\yield-source\IdleYieldSource.sol: function supplyTokenTo(uint256 mintAmount, address to) external nonReentrant override {
.\contracts\yield-source\YearnV2YieldSource.sol: function supplyTokenTo(uint256 _amount, address to) external override c{

.\contracts\yield-source\BadgerYieldSource.sol: function supplyTokenTo(uint256 amount, address to) public override {
.\contracts\yield-source\SushiYieldSource.sol: function supplyTokenTo(uint256 amount, address to) public override {

.\contracts\yield-source\ATokenYieldSource.sol: function redeemToken(uint256 redeemAmount) external override nonReentrant returns (uint256) {
.\contracts\yield-source\IdleYieldSource.sol: function redeemToken(uint256 redeemAmount) external override nonReentrant returns (uint256 redeemedUnderlyingAsset) {
.\contracts\yield-source\YearnV2YieldSource.sol: function redeemToken(uint256 amount) external override nonReentrant returns (uint256) {

.\contracts\yield-source\BadgerYieldSource.sol: function redeemToken(uint256 amount) public override returns (uint256) {
.\contracts\yield-source\SushiYieldSource.sol: function redeemToken(uint256 amount) public override returns (uint256) {

Tools Used

grep

Recommended Mitigation Steps

Add nonReentrant to the functions supplyTokenTo and redeemToken of BadgerYieldSource.sol and SushiYieldSource.sol

@code423n4 code423n4 added 1 (Low Risk) bug Something isn't working labels Jun 20, 2021
code423n4 added a commit that referenced this issue Jun 20, 2021
@asselstine
Copy link
Collaborator

Duplicate #119

@asselstine asselstine added the duplicate This issue or pull request already exists label Jun 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 (Low Risk) bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants