#39284 [W&A-Medium] Arbitrarily set any archiver config and remotely turning it off
Submitted on Jan 27th 2025 at 05:13:23 UTC by @Franfran for Audit Comp | Shardeum: Ancillaries III
Report ID: #39284
Report Type: Websites and Applications
Report severity: Medium
Target: https://github.com/shardeum/archive-server/tree/itn4
Impacts:
Execute arbitrary system commands
Taking and/modifying authenticated actions (with or without blockchain state interaction) on behalf of other users without any interaction by that user, such as:
Changing registration information
Commenting
Voting
Making trades
Withdrawals, etc.
Taking down the application/website
Description
Brief/Intro
A set-config
endpoint request can be intercepted when sent by the dev key in order to be replayed and change arbitrary configuration on any archiver node.
Some key configuration can be changed which might be very problematic for the network.
Vulnerability Details
The set-config
endpoint contains a pre handler called isDebugMiddleware
which checks if the node was set in debug mode (unlikely for anyone to set their config like this for a production setup), or that the "dev" key signed a message in order to pass that check.
The issue is that only the route
and count
are part of the message, and not the message itself.
The route in this case would be "/set-config"
, and the count is the current timestamp in order to avoid replay attacks.
Knowing this, we can save a message that was sent to us by the dev to alter the config and forward it to another node as long as it didn't received this dev message before us since it works as long as the signed count
is greater than the lastCounter
, and alter the new config as wish.
Impact Details
Some keys cannot be overwritten such as ARCHIVER_IP, ARCHIVER_PORT, ARCHIVER_HASH_KEY, ARCHIVER_SECRET_KEY, ARCHIVER_PUBLIC_KEY.
Knowing this, we could for instance impersonate the dev by rewriting the DevPublicKey
or even the ARCHIVER_MODE
key to completely bypass the isDebugMiddleware
prehandler.
This grants us access to some dev-only methods that could cause harm to the node.
There is the debug-inf-loop
method which just runs an infinite loop for fun that could be called.
In summary, if the dev sends us a set-config
first, we could completely take down the entire network of archivers.
References
Links attached when applicable
Proof of Concept
Proof of Concept
Let's modify the script under scripts/update_config.ts
This POC will:
Wait until we receive a
set-config
message from the devCopy the sig and forward it to another archiver to call the
set-config
endpoint and set theirARCHIVER_MODE
to"debug"
Call the
/debug-inf-loop
, see the CPU usage of the archiver and wait for it to get killed
Was this helpful?