Skip to content

Security: Prevent client-side DoS by adding default timeout to REST client#126

Open
rahul-kumar-362 wants to merge 1 commit intocoinbase:masterfrom
rahul-kumar-362:fix-missing-timeout
Open

Security: Prevent client-side DoS by adding default timeout to REST client#126
rahul-kumar-362 wants to merge 1 commit intocoinbase:masterfrom
rahul-kumar-362:fix-missing-timeout

Conversation

@rahul-kumar-362
Copy link
Copy Markdown

Target: github.com/coinbase/coinbase-advanced-py (Coinbase Advanced Python SDK)
Vulnerability Type: Denial of Service (DoS)

Description

While using the official Coinbase Advanced Python SDK, a vulnerability exists in how it handles HTTP requests. The SDK uses the popular requests library to make API calls to Coinbase but fails to set a default timeout.

In Python's requests library, if timeout is left as None, the application will wait indefinitely for a response. If the Coinbase API experiences an outage, or if network traffic is interrupted, the developer's entire application will hang permanently, leading to a complete Denial of Service (DoS).

Proof of Concept in the Code

In coinbase/rest/rest_base.py, the timeout argument in the initialization of the RESTClient defaults to None. This variable is then passed directly as timeout=self.timeout to the requests library:

response = self.session.request(
    http_method,
    url,
    params=params,
    json=data,
    headers=headers,
    timeout=self.timeout, # <--- Will be None, causing infinite hang
)

@cb-heimdall
Copy link
Copy Markdown

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 1
Sum 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants