-
Notifications
You must be signed in to change notification settings - Fork 623
Place access list deserialization guards #9466
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
Conversation
benaadams
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds security hardening to the AccessListForRpc deserialization to prevent memory exhaustion attacks when processing large or malicious requests to eth_sendTransaction. The implementation replaces automatic JSON deserialization with manual parsing that enforces strict limits on the number of access list items and storage keys.
Key Changes:
- Implemented custom JSON deserialization with memory usage guards
- Added configurable limits: max 1000 items per access list, max 1000 storage keys per item, max 10000 total storage keys
- Enhanced input validation with explicit checks for expected JSON token types
src/Nethermind/Nethermind.Facade/Eth/RpcTransaction/AccessListForRpc.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.Facade/Eth/RpcTransaction/AccessListForRpc.cs
Outdated
Show resolved
Hide resolved
| else if (reader.TokenType == JsonTokenType.StartArray) | ||
| { | ||
| storageKeys = new List<UInt256>(); | ||
| int keyCount = 0; |
Copilot
AI
Oct 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The variable keyCount tracks storage keys per item while storageItemsCount tracks total storage keys across all items. Consider renaming keyCount to itemStorageKeyCount or keysInCurrentItem to clarify the distinction and improve code readability.
Shouldn't they be failing now if they covered? Since you are throwing new exceptions |
…ForRpc.cs Co-authored-by: Copilot <[email protected]>
…ForRpc.cs Co-authored-by: Copilot <[email protected]>
* Place access list deserialization guards * refactor * fix property casing * Update src/Nethermind/Nethermind.Facade/Eth/RpcTransaction/AccessListForRpc.cs Co-authored-by: Copilot <[email protected]> * Update src/Nethermind/Nethermind.Facade/Eth/RpcTransaction/AccessListForRpc.cs Co-authored-by: Copilot <[email protected]> * rename --------- Co-authored-by: Copilot <[email protected]>

Changes
AccessListForRpcdeserializationeth_sendTransactionTypes of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?
Notes on testing
Existing tests should cover it.
Documentation
Requires documentation update
Requires explanation in Release Notes