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

BLSSignatureChecker::checkSignatures - Prevent current block from being used as referenceBlockNumber #171

Closed
wadealexc opened this issue Feb 6, 2024 · 0 comments

Comments

@wadealexc
Copy link
Collaborator

wadealexc commented Feb 6, 2024

From Middleware audit, items P1, M1, and L2:

Although BLSSignatureChecker::checkSignatures checks that the reference block number is not in the future, the current block (i.e., the next to be produced) is accepted as reference:

function checkSignatures(
	bytes32 msgHash,
	bytes calldata quorumNumbers,
	uint32 referenceBlockNumber,
	NonSignerStakesAndSignature memory params
){
	...
	require(referenceBlockNumber <= uint32(block.number), "BLSSignatureChecker.checkSignatures: invalid reference block");

As a consequence, users of eigenlayer-middleware could be tempted to submit confirmations for the current block, in an attempt to provide them as early as possible. This practice, however, is risky, as it creates race conditions between the signature check and other updates that might be performed in the same block.

If an update happens in the same block before checkSignatures, it might violate some of the data included in the check, such as the APK or the stake history indexes, causing the signature check to fail. In issues M1 and L2 we discuss in detail two scenarios in which such a race condition could be caused maliciously to achieve a DoS attack.

Similarly, an update might happen in the same block but after checkSignatures. In this case, the signature check will succeed, but there will be an inconsistency between the data being checked and the information stored for that block, which could have undesirable consequences for the protocol. For instance, the signatoryRecord hashed and stored by EigenDAServiceManager::confirmBatch could be referring to a block with data inconsistent with the globally-maintained data about that block. To reconstruct records, one would need to replay past transactions.

As a consequence we recommend strengthening the above require to ensure that only blocks strictly in the past can be used as reference. Alternatively, AVS implementations should be careful to ensure they can tolerate such races and apparent-inconsistency in records.

Hyodar added a commit to Nuffle-Labs/nffl that referenced this issue Apr 14, 2024
Hyodar added a commit to Nuffle-Labs/nffl that referenced this issue Apr 15, 2024
Hyodar added a commit to Nuffle-Labs/nffl that referenced this issue Apr 15, 2024
…ent script (#71)

* forge install: eigenlayer-middleware

testnet-holesky

* chore: Update eigensdk

* feat: Update contracts to new EL contracts

* feat: Update nodes to new EigenSDK version

* refactor: Move whitelisting logic to SFFLServiceManager

* feat: Temporarily remove challenge processing

* chore: Reduce optimizer runs to fit SFFLRegistryCoordinator

* fix: Check quorum for the previous block

See Layr-Labs/eigenlayer-middleware#171

* feat: Update EL contracts deployment script

* feat: Update AVS deployment script

* test: Change key directory structure and use pre-defined keys in integration test

* test: Update contract addresses in test configs

* fix: Fix operator address on whitelist check

* test: Log operator address on config generation

* refactor: Refactor SFFLDeployer

* refactor: Remove SFFLDeployedContracts from SFFLDeployer

* refactor: Format files

* fix: Fix missing avsDirectory on deployment script

* refactor: Ignore unused argument names

* test: Update devnet deployment outputs and configs

* refactor: Standardize logging in node plugin

* refactor: Move keys directories to constants

* refactor: Rename keysPath parameter to keyId

* refactor: Use empty password as parameter when reading key

* feat: Update deployed AVS state

* test: Fix key directories
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant