# Signature Replay attack possible on `updateWorkerDeploymentConfigWithSig()` in Blueprintcore.sol which leads to users lose the funds

updateWorkerDeploymentConfigWithSig signs a digest lacking nonce/chainID, letting anyone replay a user's signature to repeatedly charge their ERC-20 allowance to the fee wallet.

- Payout: Audit contest
- Severity: medium
- Program: Crestal Network
- Found by: 0x73696d616f
- Disclosed: 2025-03-10
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2025-03-crestal-network-judging/issues/391
- Library page: https://bugbountylibrary.com/r/sherlock%3A2025-03-crestal-network%3AM-3
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:sherlock sev:medium tech:evm tech:solidity technique:source-review vuln:signature-replay

**Target:** BlueprintCore.sol updateWorkerDeploymentConfigWithSig (EVM smart contract)
**Root cause:** The signed digest from getRequestDeploymentDigest covers only projectId, updatedBase64Config and a fixed domain string, with no nonce, timestamp or chain ID, so a valid signature is reusable indefinitely.
**Steps:**
1. User approves BlueprintCore to spend ERC-20 tokenAddress.
2. User signs digest = getRequestDeploymentDigest(projectId, updatedBase64Config, "app.crestal.network") and calls `updateWorkerDeploymentConfigWithSig(tokenAddress, projectId, requestID, updatedBase64Config, signature)`.
3. Call succeeds, payWithERC20 transfers cost to feeCollectionWalletAddress, status set to Pickup.
4. Attacker observes signature on-chain and replays `updateWorkerDeploymentConfigWithSig` with identical params.
5. Each replay re-runs updateWorkerDeploymentConfigCommon and charges the user again until allowance/funds exhausted.
**How found:** Code review of the WithSig function: noticed the digest omits nonce/chainID, making the signature replayable across repeated calls.
**Exploitation:** Attacker copies the on-chain signature and resubmits the same call repeatedly; each replay transfers paymentOpCostMp[tokenAddress][UPDATE_AGENT_OP] from the signer to the fee wallet, draining the user's approved allowance. Attacker gains nothing directly, only gas cost.
**Insight:** When auditing *WithSig functions, compare the signed digest fields against every state-changing effect of the call; if the digest lacks a per-user nonce or chain ID, the signature is replayable and any payment/state reset inside the function becomes repeatable.

