Skip to content
Access control Audit finding Intermediate

Malicious upgradable admin can permanently brick contract upgradeability

The upgradeable contract lets an admin set the minimum upgrade delay with no upper bound, so a malicious admin can set it to an enormous value. This makes any future upgrade impossible to schedule, and the delay change itself cannot be overridden quickly because it is also subject to the delay.

danvinci_20 Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

#49970 [SC-Insight] Malicious upgradable admin can permanently brick contract upgradeability

Submitted on Jul 20th 2025 at 22:01:37 UTC by @danvinci_20 for Audit Comp | Folks Smart Contract Library

Description

Description

The contract’s update_min_upgrade_delay() function allows an address with the upgradable_admin_role to schedule a change to the minimum required delay before any upgrade can be scheduled.

However, there is no upper bound on the min_upgrade_delay value that can be set. A malicious actor with the upgradable admin role can set this delay to an extremely large number (2^64 - 1), effectively making it impossible to schedule upgrades for the foreseeable future.

This results in a permanent denial of governance and upgradeability. Since the upgrade scheduling function enforces a hard check that the timestamp must be at least the current time plus the active min_upgrade_delay, no upgrade will ever be schedulable if this delay is set too high. Moreover, because changes to the delay must themselves wait until the (delayed) timestamp is reached, there is no immediate way to override this malicious value.

Solidity
 @abimethod
    def schedule_contract_upgrade(self, program_sha256: Bytes32, timestamp: UInt64) -> None:
        """Schedule the upgrade of the contract.

        Args:
            program_sha256 (Bytes32): The SHA256 of the new program
            timestamp (UInt64): The timestamp to schedule the upgrade

        Raises:
            AssertionError: If the contract is not initialised
            AssertionError: If the caller does not have the upgradable admin role
            AssertionError: If the timestamp is not sufficiently in the future
        """
        self._only_initialised()
        self._check_sender_role(self.upgradable_admin_role())

        # ensure timestamp is sufficiently in the future
    @>>    self._check_schedule_timestamp(timestamp)

        # schedule contract upgrade, possibly overriding existing scheduled upgrade
        self.scheduled_contract_upgrade.value = ScheduledContractUpgrade(program_sha256.copy(), ARC4UInt64(timestamp))

        emit(UpgradeScheduled(program_sha256, ARC4UInt64(timestamp)))
Solidity
  @abimethod(readonly=True)
    def get_active_min_upgrade_delay(self) -> UInt64:
        """Clarifies the active minimum upgrade delay in cases where there was a scheduled update.

        Returns:
            The active minimum upgrade delay
        """
        min_upgrade_delay = self.min_upgrade_delay.value.copy()
  @>>      return (
            min_upgrade_delay.delay_1 if Global.latest_timestamp >= min_upgrade_delay.timestamp
            else min_upgrade_delay.delay_0
        ).native

    @subroutine
    def _check_schedule_timestamp(self, timestamp: UInt64) -> None:
    @>>    assert (
            timestamp >= Global.latest_timestamp + self.get_active_min_upgrade_delay()
        ), "Must schedule at least min upgrade delay time in future"

Impact Details

A malicious admin can set the minimum upgrade delay to an extremely large value, making it impossible to schedule any future upgrades. Since delay changes themselves are also subject to this delay, the malicious value cannot be easily overridden. This results in a permanent loss of upgradability and governance control over the contract.

Recommendations

Introduce an upper bound to the min_upgrade_delay parameter in update_min_upgrade_delay() to avoid malicious or accidental denial of upgrade functionality. For example

Solidity
MAX_MIN_UPGRADE_DELAY = UInt64(30 * 86400)  #  30 days

assert min_upgrade_delay <= MAX_MIN_UPGRADE_DELAY, "Min upgrade delay too large"

Proof of Concept

Proof of Concept

The following steps can demonstrate the issue:

  1. Malicious admin calls:
Solidity
update_min_upgrade_delay(UInt64(2**64 - 1), Global.latest_timestamp + 1)
  1. After 1 second (when new delay becomes active), any upgrade attempt will require:
Solidity
scheduled_timestamp >= Global.latest_timestamp + (2^64 - 1)

which is unreasonably far in the future and will fail _check_schedule_timestamp().

This results in:

  1. No upgrade being able to be schedulable,
  2. No recovery path (since modifying the delay requires waiting the massive delay period),
  3. The system being permanently locked

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

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

Impact

A malicious admin could permanently block all future upgrades and governance changes, with no quick recovery path because the delay change is itself subject to the delay.

What the attacker needed

Holder of the upgradable admin role

The fix

The update function should enforce an upper bound on the minimum upgrade delay, such as 30 days.

How it was found

  1. The malicious admin calls the function that updates the minimum upgrade delay with an extremely large value and a timestamp one second in the future.
  2. After that second passes, the new delay becomes active.
  3. Any attempt to schedule an upgrade then fails the timestamp check because the required time is unreachably far ahead.

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 can be upgraded by an admin, but only after a waiting period so users have time to react. This report shows the admin can set that waiting period to an absurdly large number, which means no upgrade can ever be scheduled again. The contract is not stolen from, but it can no longer be fixed or changed.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by danvinci_20

View all

22 more disclosed reports, best first.

More from Folks Smart Contract Library

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.