sherlock-audit / 2023-01-sentiment-judging

2 stars 0 forks source link

w42d3n - PLVGLP Oracle Vulnerable To Price Manipulation #36

Closed github-actions[bot] closed 1 year ago

github-actions[bot] commented 1 year ago

w42d3n

medium

PLVGLP Oracle Vulnerable To Price Manipulation

Summary

PLVGLP Oracle is vulnerable to price manipulation. This allows an attacker to increase or decrease the price to carry out various attacks against the protocol.

Vulnerability Detail

PLVGLPOracle is vulnerable to price manipulation. This allows an attacker to increase or decrease the price to carry out various attacks against the protocol.

Impact

The attacker could perform price manipulation to make the apparent value of an asset to be much higher or much lower than the true value of the asset. Following are some risks of price manipulation:

Code Snippet

https://github.com/sherlock-audit/2023-01-sentiment/blob/main/oracle/src/plutus/PLVGLPOracle.sol#L47

    (,, uint assets) = vault.previewRedeem(address(0), 1e18);

Tool used

Manual Review

Recommendation

Avoid using previewRedeem function to calculate the price. Consider implementing TWAP so that the price cannot be inflated or deflated within a single block/transaction or within a short period of time.