T09 · Insecure Skill Coding Practices
- Location
SKILL.md:215- Finding
Invalid model names can silently resolve to ship index zero
- Content
View full analysis
{ const b = Buffer.alloc(8); b.writeBigUInt64LE(amountLamports); return b; })() ]); ``` ### Technical Analysis `SHIPS` is a fixed mapping of supported model names to numeric ship identifiers. If `shipName` is not a recognized key, the lookup returns `undefined`. The code does not check this condition before passing the value to `Buffer.from([ship])`. When an invalid numeric value such as `undefined` is converted into an unsigned byte by the typed-buffer machinery, it can be coerced to zero. Consequently, a misspelled, malformed, or unsupported model name may be serialized as ship index `0`, which represents OpenAI, rather than causing the operation to fail. The transaction is then presented for signing and submitted as a valid financial operation. On-chain validation of the ship range would not prevent this outcome because zero is a valid ship index. ### Attack Path 1. A user or calling agent supplies a misspelled, unsupported, or attacker-influenced model name. 2. `SHIPS[shipName.toLowerCase()]` evaluates to `undefined`. 3. The undefined value is converted while constructing `Buffer.from([ship])`. 4. The resulting instruction may contain ship index zero. 5. The wallet signs and broadcasts the transaction. 6. SOL is placed on OpenAI even though the user intended another model or expected in ...[truncated 411 chars]- Remediation
View remediation
