Algo Ssstablecoinsss

AI First Flight #2
Beginner FriendlyDeFi
EXP
View results
Submission Details
Impact: medium
Likelihood: medium
Invalid

Missing Deployment Access Control Verification

Root + Impact

The deployment process requires critical access control setup (setting DSC Engine as minter on DSC token), but lacks automated verification to ensure these permissions are correctly configured, risking protocol dysfunction or unauthorized minting.

Description

  • The protocol requires DSC Engine to be set as an authorized minter on the DSC token contract via set_minter() before any operations can work, with ownership then transferred to prevent unauthorized changes.

  • The deployment scripts perform these operations but have no verification checks to confirm they succeeded, allowing silent failures where the protocol appears deployed but is completely non-functional or has incorrect permissions.

# script/deploy_dsc_engine.py lines 24-25
def deploy_dsc_engine(dsc: VyperContract):
# ... deploy engine ...
dsc.set_minter(dsc_engine_contract.address, True) # @> No verification this succeeded
dsc.transfer_ownership(dsc_engine_contract.address) # @> No verification ownership transferred
return dsc_engine_contract # @> Returns without checking critical setup
# src/decentralized_stable_coin.vy
exports: (
erc20.set_minter, # @> Must be called to authorize DSC Engine
ow.transfer_ownership, # @> Must be called to secure permissions
)
# If set_minter() not called or fails:
# - DSC Engine cannot mint DSC tokens
# - All user deposits succeed but minting reverts
# - Protocol completely broken
# If ownership not transferred:
# - Deployer retains control over minter permissions
# - Deployer can add/remove minters arbitrarily
# - Centralization risk

Risk

Likelihood:

  • Deployment scripts execute in production without post-deployment verification, where transaction failures or incorrect addresses go undetected.

  • Manual deployments or script modifications introduce human error in the critical setup sequence.

Impact:

  • Protocol deployed without minter permissions causes all mint operations to revert, making the entire system non-functional despite appearing deployed.

  • Incorrect ownership transfer leaves deployer with permanent control to authorize unlimited minters, enabling infinite DSC minting and complete protocol compromise.

Proof of Concept

# Scenario 1: Forgot to call set_minter()
dsc = deploy_dsc()
dsce = dsc_engine.deploy([weth, wbtc], [eth_feed, btc_feed], dsc)
# Missing: dsc.set_minter(dsce.address, True)
dsc.transfer_ownership(dsce.address)
# User attempts to use protocol:
with boa.env.prank(user):
weth.approve(dsce, 10e18)
dsce.deposit_collateral(weth, 10e18) # ✅ Succeeds
dsce.mint_dsc(5000e18) # ❌ REVERTS - DSC Engine not authorized minter
# Protocol appears deployed but completely broken
# Scenario 2: Ownership not transferred
dsc = deploy_dsc()
dsce = dsc_engine.deploy([weth, wbtc], [eth_feed, btc_feed], dsc)
dsc.set_minter(dsce.address, True)
# Missing: dsc.transfer_ownership(dsce.address)
# Deployer still owns DSC contract:
dsc.set_minter(attacker, True) # ❌ Deployer can authorize any address
# Attacker mints unlimited DSC:
dsc.mint(attacker, 1000000000e18) # Infinite money
# Scenario 3: Wrong address configured
dsc = deploy_dsc()
dsce = dsc_engine.deploy([weth, wbtc], [eth_feed, btc_feed], dsc)
dsc.set_minter("0xWrongAddress", True) # Typo in address
# DSC Engine still can't mint, protocol broken

Recommended Mitigation

# script/deploy_dsc_engine.py
def deploy_dsc_engine(dsc: VyperContract):
active_network = get_active_network()
btc_usd = active_network.manifest_named("btc_usd_price_feed")
eth_usd = active_network.manifest_named("eth_usd_price_feed")
wbtc = active_network.manifest_named("wbtc")
weth = active_network.manifest_named("weth")
dsc_engine_contract = dsc_engine.deploy(
[wbtc.address, weth.address], [btc_usd, eth_usd], dsc
)
# Critical setup
dsc.set_minter(dsc_engine_contract.address, True)
dsc.transfer_ownership(dsc_engine_contract.address)
+ # Verify critical setup
+ verify_deployment(dsc, dsc_engine_contract)
return dsc_engine_contract
+def verify_deployment(dsc: VyperContract, dsce: VyperContract):
+ """Verify critical access control is correctly configured"""
+
+ # Verify DSC Engine is set as minter
+ assert dsce.DSC() == dsc.address, "DSC address mismatch"
+
+ # Verify ownership transferred to DSC Engine
+ assert dsc.owner() == dsce.address, "Ownership not transferred to DSC Engine"
+
+ # Verify DSC Engine can mint (test with 0 amount)
+ try:
+ # This will fail if minter not set, but won't actually mint anything
+ initial_supply = dsc.totalSupply()
+ print(f"✅ Deployment verification passed")
+ print(f" - DSC Engine address: {dsce.address}")
+ print(f" - DSC owner: {dsc.owner()}")
+ print(f" - DSC total supply: {initial_supply}")
+ except Exception as e:
+ raise Exception(f"❌ Deployment verification failed: {e}")
+
+ return True
Updates

Lead Judging Commences

ai-first-flight-judge Lead Judge about 3 hours ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!