대상 : Coslend

시기 : 2022. 06. 29
탈취당한 크기:
~64,305.596 USDC
~9,604.913 USDT
~1,826.745 FRAX
~14.2980 WETH
취약코드 : CoslendPrice.sol
function updateSource(address marketToken,uint index,address source,string memory sourceType,bool available) public {
TokenConfig storage tokenConfig = tokenConfigs[marketToken];
PriceOracle storage priceOracle = tokenConfig.oracles[index];
priceOracle.source =source;
priceOracle.available = available;
priceOracle.sourceType = sourceType;
}
// 출처 : https://github.com/coslendteam/coslend-contracts/blob/main/contracts/oracle/CoslendPriceOracleV1.sol
가격을 갱신하는 함수에 onlyOwner modifier를 붙여주지 않아 attacker가 쉽게 가격 조정 가능
취약점 수정 : onlyOwner 추가, github 소스코드나 docs에서는 수정이 없으나, 자체적으로 수정했다고 알림.
참고자료
https://medium.com/@coslend/post-mortem-coslend-priceoraclev1-contract-vulnerability-d5301c4c4395