Potential rug-pull vector by changing Oracle address #694
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
grade-a
low quality report
This report is of especially low quality
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
Lines of code
https://github.com/code-423n4/2023-08-dopex/blob/eb4d4a201b3a75dd4bddc74a34e9c42c71d0d12f/contracts/core/RdpxV2Core.sol#L358-L370
Vulnerability details
Impact
setPriceingOracleAddress
allows to change the address of the oracles. By setting a malicious oracles, the price manipulation is possible.Malicious admin can change the address of the oracle to manipulate the current prices of the assets in the protocol.
While rug-pull vectors which straightforwardly allows to withdraw all the funds from the protocol are nothing new in the DeFi ecosystem - this attack vector is slightly different. Instead of withdrawing the funds, malicious admin manipulates the price of the assets inside the protocol - to his advantage. One of the example of this attack vector happened very recently: 25th August 2023 - https://twitter.com/PeckShieldAlert/status/1694946221788729440 . Thus I've decided to report this issue as separate finding and evaluated it as Medium.
Even if the
DEFAULT_ADMIN_ROLE
is trustworthy, having a rug-vector in the contract may have a negative impact on the protocol's reputation. Multiple online tools reports contract with rug-pulls vector as a high-risk: (e.g.: https://twitter.com/RugDocIO/status/1411732108029181960). Even this function had been created with good intentions, it's often associate with rug pull, especially that rug pulls are not uncommon in DeFi. Rug pull vectors increases a risk for investors to lose their hard earn money, thus it has a negative impact on the smart contract's reputation.Similar findings which had been classified at Code4rena as Medium:
Having this function available is not only a huge red flag for the Investors, but it is also huge centralization risk.
The
DEFAULT_ADMIN_ROLE
is being set inconstructor
and it's a single EOA.Having a single EOA as a single
DEFAULT_ADMIN_ROLE
role is a large centralization risk and a single point of failure. A single private key may be taken in a hack, or the sole holder of the key may become unable to retrieve the key when necessary.User with
DEFAULT_ADMIN_ROLE
role holds a lot of power within the contract. Compromise of account with this role puts the contract's integrity at risk.The very similar issue had been evaluated during a previous Code4rena audit as an issue with Medium severity:
Moreover, it's crucial to notice, that such a important function - as
setPriceingOracleAddress
does not implement any timelock mechanism, which would give protocol's users a change to properly react in case of emergency.Proof of Concept
File: contracts/core/RdpxV2Core.sol
Since
RdpxV2Core
inherits fromAccessControl
- there's agrantRole()
function available which allows to create more than one user withDEFAULT_ADMIN_ROLE
role. This increases the risk, since in a group of accounts (withDEFAULT_ADMIN_ROLE
role), the more users, the higher the risk is that one of them will become malicious or will become a victim to a hack (e.g. got their private key stolen) - due to previously mentioned centralization risk.Tools Used
Manual code review
Recommended Mitigation Steps
Critical admin functions should be protected by timelock - to give users a chance to react when something malicious would be happening.
Severity Evaluation
Impact - High
Users funds are being at risk as
setPricingOracleAddresses
can set a malicious oracles' addresses to manipulate the price of assets.Likelihood - Low
The attack vector is available for
DEFAULT_ADMIN_ROLE
. However, due to centralization risk, and the ability to create multiple of admins bygrantRole
function (more admins means that it's more likely that one of them may become malicious) the risk should be consider as non-negligible.Assessed type
Rug-Pull
The text was updated successfully, but these errors were encountered: