Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backrun bounder incorrectly assumes Arbitrum's block time #178

Open
bsamuels453 opened this issue Feb 9, 2024 · 1 comment
Open

Backrun bounder incorrectly assumes Arbitrum's block time #178

bsamuels453 opened this issue Feb 9, 2024 · 1 comment
Assignees

Comments

@bsamuels453
Copy link

bsamuels453 commented Feb 9, 2024

Severity: Undetermined
Difficulty: Medium

Overlay uses the underlying chain's average block time as a risk parameter in the protocol's backrun protection, as seen below:

MinCollateral, // minimum ov collateral to open position
PriceDriftUpperLimit, // upper limit for feed price changes since last update
AverageBlockTime // average block time of the respective chain

/// @dev bid price given oracle data and recent volume
function bid(Oracle.Data memory data, uint256 volume) public view returns (uint256 bid_) {
bid_ = Math.min(data.priceOverMicroWindow, data.priceOverMacroWindow);
// add static spread (delta) and market impact (lmbda * volume)
uint256 delta = params.get(Risk.Parameters.Delta);
uint256 lmbda = params.get(Risk.Parameters.Lmbda);
uint256 pow = delta + lmbda.mulUp(volume);

However, Arbitrum does not have any specified block time, and sequences transactions as they are received by the sequencer. Over time, an average block time can be measured, however this value can be manipulated by an attacker to increase the average block time or reduce it.

This would allow the attacker to bypass the backrun-protection macro window, causing an undetermined impact.

Recommendation

For networks with non-deterministic block times, consider using the block timestamp for measuring the size of the macro window.

@TomasCImach
Copy link
Member

As highlighted here, the inverse relationship between the averageBlockTime parameter and the backRunBound cap implies that a higher averageBlockTime leads to a lower backRunBound cap.

Saying that, we should choose the highest avg block time of the current Network deployed with a certain confidence level.

In the context of the exploit scenario targeted by the backRunBound function, potential attackers may execute multiple transactions during the loger TWAP window. Should the average block time of Arbitrum decrease due to heightened transaction demand from malicious actors, maintaining the existing averageBlockTime parameter becomes advantageous for bolstering the security of the protocol.

PR #181 adds a new role named RISK_MANAGER that is able to change any Risk Parameter. This introduces the potential for an automated or semi-automated method to adjust the risk parameters.

@magnetto90 magnetto90 self-assigned this Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants