T09 · Insecure Skill Coding Practices
- Location
SKILL.md:15- Finding
Automatic retries can duplicate non-idempotent operations
- Content
View full analysis
controller.abort(), timeout); const response = await fetch(url, { ...options, signal: controller.signal }); clearTimeout(timeoutId); if (response.status === 429 || response.status >= 500) { await new Promise(r => setTimeout(r, retryDelay * Math.pow(2, attempt))); continue; } return response; } catch (err) { if (attempt === maxRetries) throw err; await new Promise(r => setTimeout(r, retryDelay * Math.pow(2, attempt))); } } ``` ### Technical Analysis The helper retries requests solely according to network errors and response status. It does not examine the HTTP method or require an idempotency mechanism. Consequently, requests using methods such as `POST` or `PATCH` are retried in the same manner as safe or idempotent requests. A server can successfully commit a state-changing operation and then return a 5xx response, or the connection can fail before the client receives confirmation. The helper interprets either condition as a failed operation and sends the request again. Because the original operation may already have succeeded, the retry can repeat its side effects. ### Attack Path 1. A caller uses `fetchWithRetry` for a state-changing request, such as a payment, message submission, or account update. 2. The destination processes and commits the request. 3. An unstable or attacker-influenced endpoint or intermediary resets the connection or causes a 5xx response after processing. 4. The helper automatically submits the same request again. 5. If the server does not independently deduplicate requests, the state-changing operation is performed multiple ti ...[truncated 349 chars]- Remediation
View remediation
