T05 · Unauthorized Access and Privilege Escalation
- Location
src/index.ts:956- Finding
Arbitrary User-Supplied Contracts Receive Wallet-Authorized Transfer Actions
- Content
View full analysis
Vulnerability Details
File Location:
src/index.ts:956-959,src/index.ts:1048-1058,src/index.ts:1176-1180,src/index.ts:1470-1473
Vulnerability Type: Insufficient contract validation and excessive signing authority
Risk Level: MediumVulnerable Code
ts // src/index.ts:956-959 { account: fromSpec.contract, name: 'transfer', authorization: [{ actor: account, permission }], data: { from: account, to: 'proton.swaps', quantity: fromQty, memo: '' }, },ts // src/index.ts:1048-1058 { account: params.token1_contract, name: 'transfer', authorization: [{ actor: account, permission }], data: { from: account, to: 'proton.swaps', quantity: params.token1, memo: '' }, }, { account: params.token2_contract, name: 'transfer', authorization: [{ actor: account, permission }], data: { from: account, to: 'proton.swaps', quantity: params.token2, memo: '' }, },ts // src/index.ts:1176-1180 const depositActions = params.from_tokens.map((t: any) => ({ account: t.contract, name: 'transfer', authorization: [{ actor: account, permission }], data: { from: account, to: 'token.escrow', quantity: t.quantity, memo: '' }, }));ts // src/index.ts:1470-1473 { account: lp_contract, name: 'transfer', authorization: [{ actor: account, permission }], data: { from: account, to: 'yield.farms', quantity: lp_amount, memo: '' }, },Technical Analysis
Several write tools accept token contract accounts directly from tool parameters and use those accounts as the target of wallet-authorized
transferactions. The supplied contracts are not consistently resolved from trusted market, pool, escrow, or farm metadata, nor are they checked against an allowlist of supported XPR token contracts.The
confirmed: truegate only confirms the overall operation. It does not establish that the contract account embedded in ...[truncated 1421 chars]- Remediation
View remediation
Remediation Suggestions
- Resolve token contracts from trusted on-chain market, pool, escrow, or farm records rather than accepting arbitrary contract names.
- Maintain an explicit allowlist of supported token contracts, including
eosio.token,xmd.token,loan.token,xtokens, and verified LP-token contracts. - Validate all contract values as valid EOSIO account names.
- Verify that the token symbol and precision match authoritative contract or pool metadata.
- Display the exact contract, action, recipient, quantity, and authorization in a transaction preview before requesting confirmation.
- Use a dedicated XPR permission restricted to the documented contracts and actions instead of the unrestricted
activepermission. - Add negative tests proving that unrecognized contract accounts are rejected before signing.
