Skip to content
Business logic Audit finding Intermediate

Extending a domain’s expiration even after the grace period impacts domain buyers

The domain name service allowed anyone to extend a domain's expiration even after the grace period had ended, which should not be possible. An attacker or the previous owner could front-run a new buyer's registration transaction, causing the buyer's transaction to revert and preventing them from acquiring the domain.

p4y4b13 Follow

Originally disclosed on Code4rena

Submitted by p4y4b13

https://github.com/code-423n4/2025-01-initia-move/blob/a96f5136c4808f6968564a4592fe2d6ac243a233/usernames-module/sources/name_service.move#L458

Finding description and impact

The name_service.move module allows users to register domain names. If anyone wants to register an already purchased domain, they can only do so once the expiration_date + grace_period for that domain has passed. The name_service.move module allows anyone to call extend_expiration for any domain, which is a feature (according to sponsors).

The main issue is that the extend_expiration() function allows users to extend the expiration of a domain even after the grace period has ended, which is unintended behavior.

As a result, users, multi-sig owners of the actual domain name, or attackers can frontrun and attempt to call extend_expiration() after the grace period has ended, even if other users are trying to buy the same domain name using register_domain().

This breaks a key invariant of the protocol, leading to genuine users being negatively impacted and experiencing a poor user experience.

Proof of Concept

Consider the following attack scenario:

  1. Alice buys the domain name vitalik for a specific duration.
  2. The expiration date and grace period for Alice’s domain are completed.
  3. Bob observes that Alice’s domain vitalik has passed its expiration_date + grace_period. So, Bob calls register_domain to acquire the vitalik domain name.
  4. At the same time, Alice calls extend_expiration for the domain name vitalik.
  5. Since Alice pays a higher gas fee, her transaction is picked and executed first.
  6. As a result, Alice successfully extends the expiration for her domain, and Bob’s transaction reverts.
  7. However, Alice’s transaction should have been reverted since the grace period had already ended.

Recommended mitigation steps

To mitigate this issue, prevent the extend_expiration() function from being called for domains after the completion of expiration_date + grace_period.

public entry fun extend_expiration(
        account: &signer,
        domain_name: String,
        duration: u64,
    ) acquires ModuleStore {
        ....
        assert!(
            duration >= module_store.config.min_duration,
            error::invalid_argument(EMIN_DURATION),
        );

        let (_height, timestamp) = block::get_block_info();
        let expiration_date = metadata::get_expiration_date(token);
        // @audit Only allow extend_expiration before the grace period
+       assert!(
+           timestamp <= expiration_date + module_store.config.grace_period ,
+           error::invalid_argument(ECANT_EXTEND_EXPIRATION),
+       );
        ....
    }

andrew (Initia) confirmed and commented:

Thank you for reporting. It is fixed on this commit.


The original report as published on Code4rena, by p4y4b13. 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 `extend_expiration` function lacked a check that the current time is within the expiration date plus grace period, so it could be called at any time.

Impact

A previous owner or attacker could block a legitimate buyer from registering an expired domain, breaking a protocol invariant and causing a poor user experience.

What the attacker needed

A domain that has passed expiration plus grace period; ability to submit a transaction with higher gas

The fix

The `extend_expiration` function was fixed to only allow extension before the grace period ends.

How it was found

  1. Alice buys a domain for a set duration.
  2. The domain's expiration date and grace period pass.
  3. Bob calls register_domain to acquire the now-available domain.
  4. Alice calls extend_expiration for the same domain with a higher gas fee.
  5. Alice's transaction executes first, extending the domain and causing Bob's registration to revert.

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 name service lets people register names and renew them. Normally, after a name expires and a short grace period passes, anyone can buy it. The bug meant the old owner could still renew the name at the last moment, even after that grace period, and if they paid a higher fee their renewal would be processed first, so the new buyer's purchase would fail.

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 from Initia Move

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.