# Users can be slashed instantly when stakerPk==finalityProviderPk in btcstaking library

Babylon btcstaking library lacks a check that stakerKey != finalityProviderPk, letting a self-staking user's funds be instantly slashable by their own key.

- Payout: Contest reward
- Severity: medium
- Program: Babylon
- Credited: n4nika
- Disclosed: 2024-08-04
- Write-up quality: 6/10
- Original: https://cdn.cantina.xyz/reports/cantina_competition_babylon_may2024.pdf#3.2.7
- Library page: https://bugbountylibrary.com/r/cantina%3Ababylon_may2024%3A3.2.7
- Tags: domain:web3 impact:funds-loss kind:contest platform:cantina sev:medium tech:solidity technique:source-review vuln:accounting-error vuln:business-logic

**Target:** btcstaking Go library / cli-tools staking tx builder
**Root cause:** BuildStakingInfo does not reject stakerKey == fpKey, so the staker and finality provider signatures collapse into one, satisfying the slashing path with only the user's own signature.
**Steps:**
1. Call `cli-tools create-phase1-staking-tx` with `--staker-pk` and `--finality-provider-pk` set to the same key `03d5a0bb...`
2. Observe the command succeeds and produces a valid staking tx
3. Note the slashing path now requires only the staker's own signature (which equals the FP signature)
4. Publish staking + slashing txs; the slashing tx is fully signed and instantly broadcastable
**How found:** Code-reading of the BuildV0IdentifiableStakingOutputsAndTx -> BuildV0IdentifiableStakingOutputs -> BuildStakingInfo callstack, noticing no equality check between stakerKey and fpKey while reasoning about the slashing signature requirements.
**Exploitation:** A user self-registering as finality provider and staking with the same key produces a staking output whose slashing path is satisfiable by their own single signature, so the pre-signed slashing tx can be completed and broadcast immediately, slashing funds without any malicious FP action.
**Insight:** When a protocol relies on distinct parties' signatures to gate a punitive path, check whether the library enforces key distinctness; a self-referential key collapses the quorum and turns a safety invariant into a self-slash.
