T09 · Insecure Skill Coding Practices
Error
- Location
- http_retry.h:96
- Finding
- Fabricated HTTP Success Responses Cause Fail-Open Behavior<![CDATA[ ## Vulnerability Details **File Location**: `http_retry.h`, lines 96-103 and 137-140 **Vulnerability Type**: Fail-open response fabrication **Risk Level**: High ### Vulnerable Code ```c // Execute request (placeholder - integrate with actual HTTP library) // HttpErrorCode error = config->request_func(url, config->user_context); // For demo purposes, simulate success HttpErrorCode error = HTTP_SUCCESS; response.status_code = 200; if (error == HTTP_SUCCESS) { ``` ```c HttpResponse http_post_retry(const char* url, const char* data) { // Similar to GET, but with POST method return http_get_retry(url); // Placeholder } ``` ### Technical Analysis The HTTP request callback is commented out and never invoked. Instead, the implementation unconditionally assigns `HTTP_SUCCESS` and status code `200`, irrespective of the URL, network state, server response, or configured callback. Consequently, the function does not perform an HTTP request but reports success to its caller. The POST wrapper also discards the `data` argument and delegates to the same stubbed GET implementation. The documented timeout, retry, connection-pool, rate-limit, and transient-error behavior is therefore not implemented. This is a fail-open integrity vulnerability. Software using this component may treat a required remote operation as completed even though no data was transmitted and no response was received. ### Attack Path 1. An application uses `http_request_with_retry()` or `http_post_retry()` for a security-relevant remote operation. 2. The operation may involve authentication, authorization, notification delivery, data upload, payment processing, audit logging, or another required server-side action. 3. The implementation does not invoke `config->request_func` and discards POST data. 4. It sets `error` to `HTTP_SUCCESS` and `status_code` to `200`. 5. The calling application receives a fabricated succes ...[truncated 773 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Invoke the configured transport callback instead of assigning a hardcoded success value. 2. Return an explicit configuration or unsupported-operation error when `request_func` is absent. 3. Require the transport layer to return the real status code, response body, response size, and normalized error code. 4. Implement separate method-aware behavior so that POST data is transmitted rather than discarded. 5. Apply the configured timeout to the actual network operation. 6. Retry only failures classified as transient, and preserve the final real error when all attempts fail. 7. Never synthesize status code `200` unless a transport implementation has received and validated that response. 8. Add tests proving that: - The callback is invoked. - URLs and request bodies reach the transport. - Connection failures cannot become successful responses. - Missing callbacks fail closed. - POST and GET operations retain their intended semantics. ]]>
