Submitted by cmichel
https://github.com/code-423n4/2022-02-anchor/blob/7af353e3234837979a19ddc8093dc9ad3c63ab6b/contracts%2Fanchor-token-contracts%2Fcontracts%2Fcollector%2Fsrc%2Fcontract.rs#L130-L137
The collector contract allows anyone to sweep, swapping an asset token to ANC through astro port.
Note that belief_price is not set and config.max_spread might not be set as well or misconfigured.
This allows an attacker to create a contract to perform a sandwich attack to make a profit on this trade.
Trades can happen at a bad price and lead to receiving fewer tokens than at a fair market price.
The attackers profit is the protocols loss.
Attacker creates a contract that triggers 3 messages for the sandwich attack:
Consider setting a ANC/asset belief_price from an oracle.
bitn8 (Anchor) disagreed with severity and commented:
Alex the Entreprenerd (triage) commented:
