-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect access control on setRange()
#331
Comments
raymondfam marked the issue as duplicate of #25 |
raymondfam marked the issue as low quality report |
Known issue from readme. |
kirk-baird marked the issue as unsatisfactory: |
With due respect to judging decision, This is incorrectly made duplicate of #25 and i dont agree with the presort reasoning
Reference 1: Function Natspec >>> * @notice Function that allows for an admin to set a given price range for USDY
*
* @param endTimestamp The timestamp for the range to end
* @param dailyInterestRate The daily interest rate during said range
*/
function setRange( It means that Reference 2: contest readme.md(RWADynamcRateOracle)
Another reference on setting range
It must also be noted that in setting the range and overriding the range should only be handled by admin address which is the most trusted in ondo protocol, However, I am surprised to see only I believe this should be Medium per the code4rena defination
Therefore, i believe considering the report and above escalation. The issue should be relooked. i highly trust the judge expertise and would accept the final decision on this issue. Thank you! |
@mohammedrizwann123 I appreciate the time you've spent clarifying this issue. I agree with you that this should not be a duplicate of #25 and will adjust accordingly. However, I do no see this as a Medium severity issue. I consider here the |
kirk-baird marked the issue as not a duplicate |
kirk-baird removed the grade |
kirk-baird changed the severity to QA (Quality Assurance) |
Thanks for the comment. Admin and setter addresses are completely different and they can not be considered as same. Please refer below code from contract, File: contracts/rwaOracles/RWADynamicOracle.sol
>>bytes32 public constant SETTER_ROLE = keccak256("SETTER_ROLE");
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
constructor(
>> address admin,
>> address setter,
address pauser,
uint256 firstRangeStart,
uint256 firstRangeEnd,
uint256 dailyIR,
uint256 startPrice
) {
>> _grantRole(DEFAULT_ADMIN_ROLE, admin);
_grantRole(PAUSER_ROLE, pauser);
>> _grantRole(SETTER_ROLE, setter);
if (firstRangeStart >= firstRangeEnd) revert InvalidRange();
uint256 trueStart = (startPrice * ONE) / dailyIR;
ranges.push(Range(firstRangeStart, firstRangeEnd, dailyIR, trueStart));
} It can be seen both admin and setter address have been granted their respective role. It must be noted that the function Natspec and documentation does not mention anything about This design is for sure against the protocol documentation i.e readme.md in this case. The two references provided in my above comment further proves this issue. Even if we consider, if the setter and admin addresses were supposed to be same then the roles can be assigned too using There is only one admin role in current implementation i.e I believe, this is indeed an issue at protocol level and not just a documentation and should be mitigated per the recommendation in report. |
The This would make it fall under the category of centralisation risks as the admin can change the I still see this issue as QA at best and closer out of scope. |
I have provided enough burden of proofs as warden for the issue validation. The proofs includes with references with no assumptions. i respect your judging expertise and if its considered as QA then it could be correct though I tried to explain the issue with the access being given to wrong address. Thank you! |
Lines of code
https://github.com/code-423n4/2023-09-ondo/blob/47d34d6d4a5303af5f46e907ac2292e6a7745f6c/contracts/rwaOracles/RWADynamicOracle.sol#L154
Vulnerability details
Impact
In
RWADynamicOracle.sol
,setRange()
function is used to set a given price range for USDY.Here, it can be seen that this function can be accessed by address having
SETTER_ROLE
,however this is not correct role for this function per the contest readme.md. It states,It basically mentions only admin can set the
endTimestamp
anddailyInterestRate
. Also thesetRange()
function Natspec states,Here, It clearly mentions that
setRange()
should only be accessed byadmin
address. It is to be noted thatDEFAULT_ADMIN_ROLE
is granted role toadmin
address which can be checked hereTherefore, considering both the concrete references,
setRange()
should only be accessed byDEFAULT_ADMIN_ROLE
.Proof of Concept
https://github.com/code-423n4/2023-09-ondo/blob/47d34d6d4a5303af5f46e907ac2292e6a7745f6c/contracts/rwaOracles/RWADynamicOracle.sol#L154
Tools Used
Manual review
Recommended Mitigation Steps
DEFAULT_ADMIN_ROLE
should only accesssetRange()
Assessed type
Access Control
The text was updated successfully, but these errors were encountered: