Skip to content

26Q2 - Security Upgrades#385

Open
pankajjagtapp wants to merge 146 commits into
masterfrom
pankaj/feat/security-upgrades
Open

26Q2 - Security Upgrades#385
pankajjagtapp wants to merge 146 commits into
masterfrom
pankaj/feat/security-upgrades

Conversation

@pankajjagtapp
Copy link
Copy Markdown
Contributor

@pankajjagtapp pankajjagtapp commented Apr 29, 2026

Note

High Risk
High risk because it changes authorization, pausing, and withdrawal/escrow accounting across core contracts (LiquidityPool, PriorityWithdrawalQueue, RedemptionManager, tokens), which can impact fund flows and upgrade safety if misconfigured.

Overview
Security hardening across core contracts. Replaces multiple ad-hoc admins/pausers mappings with RoleRegistry-based roles and updates scripts/tests accordingly, including new role checks for pausing/unpausing.

Adds new enforcement controls. Introduces pervasive IBlacklister checks (deposits, bids, redemptions, token transfers, membership actions) and adds timed pause support via PausableUntil (new PAUSE_UNTIL_ROLE/UNPAUSE_UNTIL_ROLE) wired into LiquidityPool, EtherFiRateLimiter, EtherFiNodesManager, PriorityWithdrawalQueue, and distributors.

Refactors withdrawal/escrow mechanics. LiquidityPool now supports an escrow migration (initializeOnUpgradeV2) that moves previously “locked” ETH out of LP into WithdrawRequestNFT/PriorityWithdrawalQueue, updates LP withdraw to treat NFT/queue withdrawals as paid from segregated balances, and adds new LP<->queue flows (transferLockedEthForPriority, returnLockedEth) with PriorityWithdrawalQueue updated to escrow ETH on fulfill/claim/cancel and enforce a new MAX_AMOUNT.

Additional guardrails. Adds a namespaced reentrancy guard (ReentrancyGuardNamespaced) to avoid proxy storage layout issues, enforces a minimum share value check in LiquidityPool, adds stETH market-value validation using a Chainlink feed + deviation/staleness bounds in Liquifier, and tightens EtherFiAdmin report validation plus a stale-oracle withdrawal finalization path.

Minor: CI now passes OP_RPC_URL, and foundry.lock is ignored.

Reviewed by Cursor Bugbot for commit 4d3febc. Bugbot is set up for automated code reviews on this repo. Configure here.

pankajjagtapp and others added 30 commits April 21, 2026 15:38
…thdraw functions; enforce invalidation rules for finalized requests
…s-execute-task

yash/feat/permissionless-execute-task
@seongyun-ko seongyun-ko changed the title Security Upgrades to harden Protocol Security 26Q2 - Security Upgrades May 7, 2026
Comment thread src/Liquifier.sol
if (updatedAt + STALE_PRICE_WINDOW >= block.timestamp) {
uint256 pricefeedValue = (uint256(answer) * _amount) / 1e18;
uint256 deviation = pricefeedValue > _marketValue ? pricefeedValue - _marketValue : _marketValue - pricefeedValue;
if (deviation * BASIS_POINT_SCALE / _marketValue > MAX_PRICE_DEVIATION_IN_BPS) revert InvalidStEthPrice();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Liquifier price deviation check divides by zero when market value is zero

Low Severity

In quoteByMarketValue, if the Curve pool's get_dy returns zero for a non-zero _amount (e.g., during extreme pool imbalance), _marketValue would be zero. The subsequent deviation * BASIS_POINT_SCALE / _marketValue division would then revert with an unhelpful panic instead of the expected InvalidStEthPrice error, making debugging harder and masking the root cause.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 1e11e8e. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

There are 6 total unresolved issues (including 4 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d442527. Configure here.

Comment thread src/EtherFiAdmin.sol
RoleRegistry public roleRegistry;

uint256 public maxFinalizedWithdrawalAmountPerDay;
uint256 public maxNumValidatorsToApprovePerDay;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uninitialized rate limits block oracle report execution

High Severity

maxFinalizedWithdrawalAmountPerDay and maxNumValidatorsToApprovePerDay are new storage variables that default to 0 and have no initialization in the constructor, initialize, or any initializeOnUpgrade function. The _validateReport function checks numValidatorsToApprovePerDay > maxNumValidatorsToApprovePerDay and finalizedWithdrawalAmountPerDay > maxFinalizedWithdrawalAmountPerDay, so any oracle report containing non-zero validator approvals or finalized withdrawals will be rejected until an admin manually sets these values.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit d442527. Configure here.

Comment thread src/EtherFiAdmin.sol
if (!roleRegistry.hasRole(ETHERFI_ORACLE_EXECUTOR_ADMIN_ROLE, msg.sender)) revert IncorrectRole();
if (_maxNumValidatorsToApprovePerDay > MAX_NUM_VALIDATORS_TO_APPROVE_PER_DAY) revert InvalidMaxNumValidatorsToApprovePerDay();
maxNumValidatorsToApprovePerDay = _maxNumValidatorsToApprovePerDay;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validator approval rate limit can be set to zero

Medium Severity

updateMaxNumValidatorsToApprovePerDay only checks > MAX_NUM_VALIDATORS_TO_APPROVE_PER_DAY but lacks a == 0 lower bound check, unlike updateMaxFinalizedWithdrawalAmountPerDay which explicitly rejects zero. Setting this to 0 permanently blocks all validator approvals through oracle reports, since any non-zero count will fail _validateReport.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit d442527. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants