#39838 [BC-Critical] Bypass certificate signing validation by double counting signatures due to signature malleability

Submitted on Feb 8th 2025 at 18:38:00 UTC by @Blockian for Audit Comp | Shardeum: Core III

  • Report ID: #39838

  • Report Type: Blockchain/DLT

  • Report severity: Critical

  • Target: https://github.com/shardeum/shardus-core/tree/bugbounty

  • Impacts:

    • Network not being able to confirm new transactions (total network shutdown)

    • Bypassing Staking Requirements

Description

Impact

  1. Bypass stake certificate validation, allowing for non-staking nodes and network take-over

  2. Bypass nodes removal validation, allowing to remove nodes from the network

  • Note: same impact as reports 33222 and 34252 but a different root cause.

Root Cause

The function validateClosestActiveNodeSignatures counts unique signatures, a single keypair can be used to prepare many different valid signatures of the same object.

Attack Flow

Staking

  • Malicious node generates a fake JoinRequest with a fake StakingCertificate

    • It brute-forces StakingCertificate fields to make sure its one of the closest nodes to the hash of the staking certificates. This is easy, as only 1 node is needed to be close.

  • It creates the full JoinRequest, with multiple different signatures signed by him, instead of signatures from many other nodes.

  • It calls gossip-join-request

  • Other nodes receive the join request, and validate it using validateClosestActiveNodeSignatures.

  • The validation bypasses, as the signatures are valid and different.

  • The new node joins the network without staking.

Kicking a node

  • Malicious node generates a fake RemoveCertificate.

  • It fills it with different signatures signed by him, instead of signatures from many other nodes.

  • It calls remove-by-app gossip route.

  • Other nodes receive the certificate, and validate it using validateClosestActiveNodeSignatures.

  • The validation bypasses, as the signatures are valid and different.

  • The victim node is kicked from the network.

Deep Dive

The function validateClosestActiveNodeSignatures uses Crypto.verify which uses lib-crypto-utils' verifyObj which calls verify which verifies an Ed25591 signature. These signatures are vulnerable to signature malleability (can be also tested here)

Suggested Fix

  1. Count signers and not signatures.

  2. Somehow fix the malleability issue, I'm not sure how without going into libSodium.

Severity

This allows to take over the network (by kicking nodes / adding nodes) and so it critical. In addition, this is the same as 33222 and 34252 which were treated as critical.

Proof of Concept

POC

Due to the 2 POCs in 39768 and 39679 I only created a POC to show the signature checking issue, and not the signature counting issue.

Was this helpful?