Skip to content
Smart contracts Audit finding Intermediate

If name is changed then the domain separator would be wrong

The StRSR contract caches an EIP-712 domain separator built from the token name, but governance can change the name later without recomputing the separator. After a rename, permit signatures and vote delegation would be rejected because the cached separator no longer matches the current name.

fs0c Follow

Originally disclosed on Code4rena

Submitted by fs0c

https://github.com/reserve-protocol/protocol/blob/df7ecadc2bae74244ace5e8b39e94bc992903158/contracts/p1/StRSR.sol#L803 https://github.com/reserve-protocol/protocol/blob/df7ecadc2bae74244ace5e8b39e94bc992903158/contracts/p1/StRSR.sol#L791

In StRSR.sol the _domainSeparatorV4 is calculated using the EIP-721 standard, which uses the name and version that are passed in the init at the function call __EIP712_init(name, "1");

Now, governance can change this name anytime using the following function:

function setName(string calldata name_) external governance {
        name = name_;
    }

After that call the domain separator would still be calculated using the old name, which shouldn’t be the case.

Impact

The permit transactions and vote delegation would be reverted if the domain separator is wrong.

Recommendation

While changing the name in setName function, update the domain separator.

tbrent (Reserve) confirmed

tbrent (Reserve) mitigated:

This PR removes the ability to change StRSR token’s name and symbol: reserve-protocol/protocol#614

Status: Mitigation confirmed. Full details in reports from HollaDieWaldfee, 0xA5DF, and AkshaySrivastav.


The original report as published on Code4rena, by fs0c. 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

The domain separator is cached at initialisation and not recomputed when the token name is changed through setName.

Impact

Permit transactions and vote delegation would be reverted after a rename because the domain separator is wrong.

What the attacker needed

Governance changes the token name

The fix

The project removed the ability to change the StRSR token's name and symbol, which was confirmed as a mitigation.

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 domain separator is a value that ties a digital signature to one specific contract and token name, so a signature cannot be reused elsewhere. Here the contract computes it once from the name and keeps it, but the name can be changed later, so the stored value becomes stale. Any signature made after the rename would then be checked against the wrong value and fail.

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 fs0c

View all

3 more disclosed reports, best first.

More from Reserve Core

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.