Skip to content
Business logic Audit finding Beginner

the DEFAULTVALIDATOR cannot be changed

The validator-staking contract lacks a function to change the default staking validator, contradicting the documentation that says it can be altered. An attacker cannot directly exploit this, but it means the documented functionality is missing, which the protocol team later fixed.

cu5t0mPe0 Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-05-andromeda-ado-judging/issues/18

Found by

cu5t0mPe0

Summary

DEFAULTVALIDATOR can not alter the default staking validator

Vulnerability Detail

sherlock docs: can alter the default staking validator for the validator staking contract

But in reality, validator-staking does not have a function related to setDEFAULTVALIDATOR. The only way to modify DEFAULTVALIDATOR is to call instantiate and reinstantiate a new validator-staking. This contradicts the documentation, so I consider this a Medium issue.

Impact

the default staking validator cannot be changed

Code Snippet

https://github.com/sherlock-audit/2024-05-andromeda-ado/blob/bbbf73e5d1e4092ab42ce1f827e33759308d3786/andromeda-core/contracts/finance/andromeda-validator-staking/src/contract.rs#L43

Tool used

Manual Review

Recommendation

Add and modify related functions of DEFAULTVALIDATOR

Discussion

cu5t0mPeo

escalate The README file mentions: link.

According to Sherlock's rules: link.

Therefore, this is a medium.

sherlock-admin3

escalate The README file mentions: link.

According to Sherlock's rules: link.

Therefore, this is a medium.

You've created a valid escalation!

To remove the escalation from consideration: Delete your comment.

You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.

J4X-98

As you voice yourself, the admin can change the default validator by re-instantiating and updating to a new version number. While it would be a nicer way to have a separate function for that, the behavior described in the contest description is implemented in code.

cu5t0mPeo

Reinstantiation will completely change the context, equivalent to redeploying a contract, which clearly does not align with the logic in the documentation. If creating a new instantiation is the solution to this problem, then I believe it is unnecessary to mention this point in the documentation at all.

cvetanovv

According to Sherlock's rules, I think it might be Medium:

"The protocol team can use the README (and only the README) to define language that indicates the codebase's restrictions and/or expected functionality. Issues that break these statements, irrespective of whether the impact is low/unknown, will be assigned Medium severity."

cvetanovv

Planning to accept the escalation and make this issue a valid Medium.

WangSecurity

Are there any duplicates we need to add?

WangSecurity

Result: Medium Unique

cu5t0mPeo

Are there any duplicates we need to add?

no

sherlock-admin2

Escalations have been resolved successfully!

Escalation status:

sherlock-admin2

The protocol team fixed this issue in the following PRs/commits: https://github.com/andromedaprotocol/andromeda-core/pull/558

bin2chen66

fix-reviews note: https://github.com/andromedaprotocol/andromeda-core/pull/558 This PR adds the method execute_update_default_validator() which modifies the DEFAULTVALIDATOR and can only be executed by the owner. Fixed this issue

The original report as published on Sherlock, by cu5t0mPe0. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the contract was deployed without a setter function for the default validator, and the only way to change it is to reinstantiate the contract.

Impact

The default staking validator cannot be changed without redeploying the contract, which breaks the documented functionality.

What the attacker needed

Owner privileges required

The fix

The issue was fixed by adding an owner-only function to update the default validator.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

This is a smart contract audit finding. The contract is supposed to let an admin change which validator is used by default for staking, but there is no function to do that. The only way to change it is to redeploy the whole contract, which is not practical.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by cu5t0mPe0

View all

4 more disclosed reports, best first.

More from Andromeda – Validator Staking ADO and Vesting ADO

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.