T09 · Insecure Skill Coding Practices
- Location
ronin-worker.mjs:263- Finding
Automatic acknowledgement of unverified payment claims
- Content
View full analysis
Vulnerability Details
File Location:
ronin-worker.mjs:263-280andronin-worker.mjs:315-320
Vulnerability Type: Unverified payment acknowledgement
Risk Level: HighTechnical Analysis
The worker automatically signs a
RECEIVEDevent whenauto_receiveis enabled. The example configuration enables this behavior by default atronin-worker.example.json:21.The
receivefunction verifies only that the amount and currency in the hub-provided event template match values in the task. It does not verify that funds reached the seller through the relevant payment rail:js async function receive(key, t) { const tpl = (t.next ?? []).find((n) => n.kind === K.RECEIVED); if (!tpl) return; const amount = tpl.tags.find((x) => x[0] === 'amount')?.[1]; const currency = tpl.tags.find((x) => x[0] === 'currency')?.[1]; // What this task can ask for: the full price, a deposit up front, or the balance after one. const dep = Number(t.upfront?.amount ?? 0); const expected = [t.price, ...(t.upfront?.required ? [dep, Number((t.price - dep).toFixed(8))] : [])].map(String); if (!expected.includes(String(Number(amount))) || String(currency).toUpperCase() !== String(t.currency).toUpperCase()) { human(`task ${t.task}: buyer recorded ${amount} ${currency}, offer was ${t.price} ${t.currency}; not acknowledging, check your rail`); log('receive_skipped', { task: t.task, paid: `${amount} ${currency}`, offer: `${t.price} ${t.currency}` }); return; } const r = await post(sign({ kind: tpl.kind, tags: tpl.tags, content: '' }, key.secret)); log(r.body.ok ? 'received' : 'receive_refused', { task: t.task, amount, currency, error: r.body.error }); }The worker invokes this function automatically for completed tasks whose settlement state is reported as pending:
js } else if (t.status === 'complete' && t.settlement === 'pending' && cfg.auto_receive) { queue.push(() => receive(key, t)); }The supplied example configuration enab ...[truncated 1769 chars]
- Remediation
View remediation
Remediation Suggestions
- Change the default value of
auto_receivetofalse, including in the example configuration. - For Base USDC payments, require a transaction proof and call the existing verification logic before signing:
- Verify the transaction succeeded.
- Verify the token contract.
- Verify the destination address belongs to the seller.
- Verify the transferred amount is at least the required amount.
- Require an appropriate confirmation or finality threshold.
- For payment rails that cannot be verified programmatically, require explicit operator confirmation before posting
RECEIVED. - Distinguish between “buyer recorded payment” and “seller verified receipt” in task state and user-facing messages.
- Persist the verified transaction identifier or payment-provider reference in the acknowledgement for later auditing.
- Add tests proving that a matching amount and currency without valid payment evidence cannot trigger a signed acknowledgement.
- Change the default value of
