34476 - [BC - Critical] remove_timestamp_cache prototype pollution lead...
Submitted on Aug 13th 2024 at 18:17:14 UTC by @ZhouWu for Boost | Shardeum: Core
Report ID: #34476
Report type: Blockchain/DLT
Report severity: Critical
Target: https://github.com/shardeum/shardus-core/tree/dev
Impacts:
Network not being able to confirm new transactions (total network shutdown)
Description
Description
In the @shardus/core source code repo, node store a cache of transaction timstamp. Other node will ask the cache, if it's a miss the node will create new tx timestamp cache object derived from payload of the request. Subsequently there's another endpoint named remove_timestamp_cache , presumebly to remove these cache. This endpoint is referencing properties in object injection from the element in the payload from the request. Which make it vulnearble to prototype pollution
Vulnerability
This happen due to referencing the object properties from the payload of the request directly when trying to remove the cache in remove_timestamp_cache
endpoint. The code is as follows
This way of referencing the cache object to assigned value is dangerous, because the referenced element come straight from the request payload. Consider the following payload
This mean that the cache object will be referenced in the following way
Essentially overwriting the prototype of the cache object, and the hasOwnProperty
method of the cache object. This is problematic because hasOwnProperty
is polluted to be a literal string which in turns break the code of the victim when object iteration or objection check operations are done later down the stream.
Proof of Concept
Launch a network of legit nodes.
Launch an attacker node with this patch applied to shardus/core
Wait for the attacker node to go active
Send a request to the attacker node with the victim node pubkey as a query parameter
GET http://localhost:1337/launch-attk?victim=<publickey>
observe the logs, the node exit unCleanly, essentially killing the node.
Impact
This is pretty straightforward single node attack, the script can be modified to attack the whole network to kill the whole network.
Last updated