T09 · Insecure Skill Coding Practices
- Location
scripts/create-token.ts:114- Finding
Untrusted Server-Provided Transaction Is Signed Without Validation
- Content
View full analysis
''); throw new Error(`API request failed: ${res.status} ${res.statusText}\n${text}`); } const json = await res.json() as { data: { transaction: string; signature: string; dbc_config: string; dbc_pool: string; base_mint: string; name: string; symbol: string; uri: string; royalty_party: string; }; common: Record; }; const { transaction: txBase58, dbc_config, dbc_pool, base_mint, uri } = json.data; if (!txBase58) { throw new Error('API returned empty transaction. Response: ' + JSON.stringify(json)); } console.error(` base_mint: ${base_mint}`); console.error(` dbc_config: ${dbc_config}`); console.error(` dbc_pool: ${dbc_pool}`); console.error(` uri: ${uri}`); // ── Step 2: Deserialize and sign transaction ────────────────────────── const txBytes = bs58.decode(txBase58); const tx = VersionedTransaction.deserialize(txBytes); tx.sign([keypair]); // ── Step 3: Send to Solana RPC ──────────────────────────────────────── console.error('Sending transaction ...'); const txHash = await connection.sendRawTransaction(tx.serialize(), { skipPreflight: false, maxRetries: 3, }); ``` ### Technical Analysis The remote API at `https://gate.game.com/v3/hotfun/agent/create_pool_with_config` fully controls the serialized Solana transaction returned to the client. The script decodes and deserializes that transaction, signs it with the wallet key supplied through `PRIVATE_KEY`, and broadcasts it without inspecting its contents. The script does not verify: - The transaction fee payer. - The invoked Solana program IDs. - The transactio ...[truncated 2023 chars]- Remediation
View remediation
