Skip to content
Smart contracts Audit finding Intermediate

vcon address change not persistent across protocol components

The Core contract allows the governor to update the vcon token address, but CoreRef caches that address in an immutable variable at construction time and cannot be updated. If the governor changes vcon, Core and all CoreRef-derived components would hold different addresses, causing a desynchronised state.

rayn Follow

Originally disclosed on Code4rena

Submitted by rayn

Core.sol#L27 CoreRef.sol#L22 CoreRef.sol#L199

vcon address is allowed to be updated by GOVERNOR in Core, however, this change will not be reflected in CoreRef._vcon. Moreover, since CoreRef._vcon cannot be updated due to contract design, it is also impossible to fix this manually. We are not yet sure how vcon will be used throughout the volt protocol, since details have not yet been made clear and code does not include related implementations. Consequently, it is impossible to estimate the exact impact. However, this desync between contracts seem dangerous enough to raise our attention, hence this report to inform the volt team about it.

Proof of Concept

In Core, vcon is allowed to be updated by GOVERNORs

    function setVcon(IERC20 _vcon) external onlyGovernor {
        vcon = _vcon;

        emit VconUpdate(_vcon);
    }

But in CoreRef, a contract inherited by several other ones including NonCustodialPSM, GlobalRateLimitedMinter, ERC20CompountPCVDeposit and Volt, _vcon is fixed upon initialization and cannot be further updated

    IERC20 private immutable _vcon;
    ...
    constructor(address coreAddress) {
        ...
        _vcon = ICore(coreAddress).vcon();
        ...
    }

Thus if GOVERNORS ever updated vcon in Core, the state between Core and all other Volt protocol components will mismatch.

Currently _vcon is not used in any place within the Volt protocol, but judging from the description in whitepapaer, future governance will be based on it, thus any potential desync will be devastating.

Tools Used

vim, ganache-cli

Recommended Mitigation Steps

There are several possible solutions.

The first is to dynamically fetch vcon from the Core whenever CoreRef uses it, and avoid storing a static copy locally.

    function vcon() public view override returns (IERC20) {
        return _volt.vcon();
    }

The second is to expose a public API to update _vcon in CoreRef, however, this approach might not be especially favorable since many components will require updates at once, and it is highly possible that future GOVERNORs miss some of them while doing updates.

ElliotFriedman (Volt) disagreed with High severity and commented:

Agreed this is an issue; however, if the VCON address is updated, contracts that need to reference the new value will need to be redeployed to cache this new address when CoreRef is instantiated.

Jack the Pug (judge) decreased severity to Medium and commented:

Based on the severity of the impact, I’m downgrading this to Medium.


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

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

CoreRef stores the vcon address in an immutable variable set once in the constructor, so it cannot follow later updates made in Core.

Impact

If the governor updates vcon, Core and all CoreRef-derived components would use different token addresses, which the reporter says could be devastating for future governance, though the exact impact is unknown because vcon is not yet used.

What the attacker needed

Governor updates vcon in Core

The fix

CoreRef should fetch vcon dynamically from Core instead of storing a local copy, or expose a public update function, though the reporter notes the latter is less favourable.

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.

A smart contract stores a token address in one central place, but other contracts copy that address when they are created and never look at the central place again. If the central address is later changed, the copies still point to the old token, so different parts of the system disagree about which token is the right one.

What is Smart contracts?

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.

More by rayn

View all

12 more disclosed reports, best first.

More from Volt Protocol contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.