Attacker can force partial withdrawals to fail
In Ninja vaults, users call `withdraw()` to take back their deposited tokens. There is bookkeeping on remaining amount:\\n```\\n      uint256 userAmount = balanceOf(msg.sender);\\n         // - Underlying (Frontend ONLY)\\n            if (userAmount == 0) {\\n            user.amount = 0;\\n         } else {\\n         user.amount -= r;\\n      }\\n```\\n\\nIf the withdraw is partial (some tokens are left), user.amount is decremented by r.\\n```\\n      uint256 r = (balance() * _shares) / totalSupply();\\n```\\n\\nAbove, r is calculated as the relative share of the user's _shares of the total balance kept in the vault.\\nWe can see that user.amount is incremented in deposit().\\n```\\n      function deposit(uint256 _amount) public nonReentrant {\\n      …\\n            user.amount += _amount;\\n      …\\n         }\\n```\\n\\nThe issue is that the calculated r can be more than _amount , causing an overflow in `withdraw()` and freezing the withdrawal. All attacker needs to do is send a tiny amount of underlying token directly to the contract, to make the shares go out of sync.
Redesign user structure, taking into account that balance of underlying can be externally manipulated
```\\n      uint256 userAmount = balanceOf(msg.sender);\\n         // - Underlying (Frontend ONLY)\\n            if (userAmount == 0) {\\n            user.amount = 0;\\n         } else {\\n         user.amount -= r;\\n      }\\n```\\n