Submitted by SanketKogekar, also found by ak1 and emerald7017
https://github.com/code-423n4/2023-07-amphora/blob/daae020331404647c661ab534d20093c875483e1/core/solidity/contracts/core/USDA.sol#L147-L157
https://github.com/code-423n4/2023-07-amphora/blob/daae020331404647c661ab534d20093c875483e1/core/solidity/contracts/core/USDA.sol#L114
High: All USDC tokens could be drained from the protocol.
There is a reentrancy issue with the withdraw methods of USDC.
A user could call either of the external withdraw functions: withdraw or withdrawTo.
Which further calls _withdraw(); which basically burns the users token and transfers user the _susdAmount. The exchange is 1 to 1.
The issue is that the _withdraw() function does not follow the CEI pattern and fails to update the state (burning token in this case) before the token transfer.
It is possible to re-enter the function USDC.withdraw() from the malicious attack contracts fallback function as soon as it recieves the transfered amount.
This will again hit the attacker contracts fallback function (with the withdrawn token amount) and repeat the flow until USDA tokens from contract are completely drained.
https://github.com/code-423n4/2023-07-amphora/blob/daae020331404647c661ab534d20093c875483e1/core/solidity/contracts/core/USDA.sol#L147-L157
This could be prevented by first burning the users tokens or using a Mutex / Re-entrancy guard from OpenZeppelin lib.
Reentrancy
