Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: malicious recovery detection #3834

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ describe('recovery-state', () => {
const safeAbi = getSafeSingletonDeployment({ network: chainId, version })!.abi
const safeInterface = new Interface(safeAbi)

const multiSendDeployment = getMultiSendCallOnlyDeployment({ network: chainId })!
const multiSendDeployment = getMultiSendCallOnlyDeployment({ network: chainId, version })!
const multiSendInterface = new Interface(multiSendDeployment.abi)

const multiSendData = encodeMultiSendData([
Expand Down Expand Up @@ -177,7 +177,11 @@ describe('recovery-state', () => {
const safeAbi = getSafeSingletonDeployment({ network: chainId, version })!.abi
const safeInterface = new Interface(safeAbi)

const multiSendDeployment = getMultiSendCallOnlyDeployment({ network: chainId })!
const multiSendDeployment = getMultiSendCallOnlyDeployment({
network: chainId,
// The safe-core-sdk uses the 1.3.0 MultisendCallOnly for Pre multisend call only Safes
version: '1.3.0',
})!
const multiSendInterface = new Interface(multiSendDeployment.abi)

const multiSendData = encodeMultiSendData([
Expand Down
11 changes: 10 additions & 1 deletion src/features/recovery/services/recovery-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { trimTrailingSlash } from '@/utils/url'
import { sameAddress } from '@/utils/addresses'
import { isMultiSendCalldata } from '@/utils/transaction-calldata'
import { decodeMultiSendTxs } from '@/utils/transactions'
import { LATEST_SAFE_VERSION } from '@/config/constants'

export const MAX_RECOVERER_PAGE_SIZE = 100

Expand Down Expand Up @@ -52,7 +53,15 @@ export function _isMaliciousRecovery({
return !sameAddress(transaction.to, safeAddress)
}

const multiSendDeployment = getMultiSendCallOnlyDeployment({ network: chainId })
const multiSendDeployment =
getMultiSendCallOnlyDeployment({
network: chainId,
version: version ?? LATEST_SAFE_VERSION,
}) ??
getMultiSendCallOnlyDeployment({
network: chainId,
version: LATEST_SAFE_VERSION,
})

if (!multiSendDeployment) {
return true
Expand Down
Loading