# BaseAuth.recoverSapientSignature returns a constant instead of signer image hash, breaking sapient signer flows

BaseAuth.recoverSapientSignature returns constant bytes32(1) instead of signer imageHash, corrupting Merkle leaf reconstruction and breaking nested sapient-signer wallet configs.

- Payout: Contest reward
- Severity: medium
- Program: Sequence
- Credited: Agontuk
- Disclosed: 2025-11-21
- Write-up quality: 6/10
- Original: https://code4rena.com/reports/2025-10-sequence#m-03
- Library page: https://bugbountylibrary.com/r/c4%3A2025-10-sequence%3AM-03
- Tags: domain:web3 impact:dos kind:contest platform:code4rena sev:medium tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:dos

**Target:** BaseAuth.recoverSapientSignature in Sequence smart wallet auth module
**Root cause:** recoverSapientSignature validates the signature but unconditionally returns bytes32(uint256(1)) instead of the actual signer imageHash, violating the ISapient interface contract.
**Steps:**
1. Deploy MinimalSapient extending BaseAuth with trivial _updateImageHash/_isValidImage
2. Craft minimal dynamic signature `hex"0000"` (threshold=0, no branch) so signatureValidation passes
3. Call `sap.recoverSapientSignature(payload, innerSig)`
4. Observe return equals `bytes32(uint256(1))` rather than a real imageHash
**How found:** Code review of BaseAuth against the ISapient interface spec; noticed the return value was a hardcoded constant while BaseSig.recoverBranch consumes it as a real imageHash for Merkle leaf construction.
**Insight:** When auditing interface implementations, diff the documented return semantics against the actual return; a hardcoded sentinel that flows into Merkle/hash reconstruction silently breaks any config that nests the contract as a signer.
