-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 NEFARIOUSPLAN-CANONICAL-V1 {"body_md":"## The warning log was the entire enforcement\n\nRead `meta_ads_mcp/core/http_auth_integration.py` at the 1.0.108 commit, starting at line 249:\n\n```python\nclass AuthInjectionMiddleware(BaseHTTPMiddleware):\n async def dispatch(self, request: Request, call_next):\n logger.debug(f\"HTTP Auth Middleware: Processing request to {request.url.path}\")\n logger.debug(f\"HTTP Auth Middleware: Request headers: {list(request.headers.keys())}\")\n\n auth_token = FastMCPAuthIntegration.extract_token_from_headers(dict(request.headers))\n pipeboard_token = FastMCPAuthIntegration.extract_pipeboard_token_from_headers(dict(request.headers))\n\n if auth_token:\n FastMCPAuthIntegration.set_auth_token(auth_token)\n\n if pipeboard_token:\n FastMCPAuthIntegration.set_pipeboard_token(pipeboard_token)\n\n if not auth_token and not pipeboard_token:\n logger.warning(\"HTTP Auth Middleware: No authentication tokens found in headers\")\n\n try:\n response = await call_next(request)\n return response\n```\n\nThree conditionals. The first two set request-scoped tokens onto the FastMCP integration's thread-local. The third tests for the absence of both. The body of the third conditional is one statement, a WARN-level log line whose message contains the exact words `No authentication tokens found in headers`. The line after the conditional's closing brace is `try:`. The line after that is `await call_next(request)`.\n\n`call_next` is Starlette's hand-off to the next middleware in the stack, which on this server is the FastMCP request handler that dispatches MCP tool calls. The handler is reached unconditionally. A request with `Authorization: Bearer ` reaches it with `auth_token` set on the thread-local. A request with no auth header reaches it with `auth_token` left at `None`. From `dispatch()`'s perspective, the two cases differ in one log line.\n\nThe 1.0.109 patch is fourteen new lines, all of them inside the same conditional:\n\n```diff\n if not auth_token and not pipeboard_token:\n- logger.warning(\"HTTP Auth Middleware: No authentication tokens found in headers\")\n+ logger.warning(\n+ \"HTTP Auth Middleware: rejecting request to %s, no Authorization \"\n+ \"Bearer or X-PIPEBOARD-API-TOKEN header present\", request.url.path,\n+ )\n+ return Response(\n+ content=json.dumps({\n+ \"error\": \"Unauthorized\",\n+ \"message\": (\"Authentication required. Provide an Authorization: \"\n+ \"Bearer header (Meta access token) or an \"\n+ \"X-PIPEBOARD-API-TOKEN header. See \"\n+ \"STREAMABLE_HTTP_SETUP.md.\"),\n+ }),\n+ status_code=401,\n+ media_type=\"application/json\",\n+ headers={\"WWW-Authenticate\": \"Bearer\"},\n+ )\n```\n\nThe conditional did not move. The two variables it tests did not move. The patch is the verb in the new warning, `rejecting` in place of `Not found`, and the `return Response(...)` on the next line. The branch the patch needed to enforce was the branch the source already wrote. The warning was the gate.\n\nThis is the [fail-open-intercept](https://nefariousplan.com/posts/tomcat-encryptinterceptor-fails-open) pattern in the Python conditional dialect. Same shape as Tomcat's `EncryptInterceptor`, where `catch (GeneralSecurityException) { log.warn(...); }` is followed by `super.messageReceived(msg)` outside the try. Same shape as DataEase's `CommunityTokenFilter`, where the catch writes a 401 body and the next line calls `filterChain.doFilter()` regardless. Same shape as Xerte's `connector.php`, where the auth check emits `header('Location: ...')` and PHP execution falls through to the upload dispatcher because `header()` does not terminate. The gate ran. The gate identified the failure. The gate narrated the failure into a logging channel. The gate proceeded to the action it was supposed to refuse.\n\n## META_ACCESS_TOKEN is the implicit operator credential, by precedence\n\nRead `meta_ads_mcp/core/auth.py:443`:\n\n```python\nasync def get_current_access_token() -> Optional[str]:\n \"\"\"Get the current access token from auth manager\"\"\"\n # Check for environment variable first - this takes highest precedence\n env_token = os.environ.get(\"META_ACCESS_TOKEN\")\n if env_token:\n logger.debug(\"Using access token from META_ACCESS_TOKEN environment variable\")\n if len(env_token) < 20:\n logger.error(\"TOKEN VALIDATION FAILED...\")\n return None\n return env_token\n\n # ... fall through to per-request thread-local, then to OAuth manager ...\n```\n\nThe comment is in the source. `META_ACCESS_TOKEN` is checked first. Its presence short-circuits every other token source the project supports, including the per-request thread-local that `AuthInjectionMiddleware` was supposed to populate. The handler the unauthenticated `call_next` reaches calls `get_current_access_token()` to pick a credential, and the first line of that function returns the operator's environment variable.\n\nThis is the intended behavior for stdio mode. The MCP project's primary transport is JSON-over-stdin/stdout, invoked by a local IDE or agent runtime as a child process. In stdio mode, the operator is the caller; trust is bounded by the OS process boundary. `META_ACCESS_TOKEN` is documented as the convenient credential for that case: set it once in your shell rc, every tool call in your session uses it. This is the internal-only-by-convention shape, an env-var whose design context is local IPC, promoted to security-relevant authority on every inbound HTTP request the moment the transport flag flips.\n\n`--transport streamable-http` is the second mode. The same Python process now binds a Starlette ASGI server to a port. The same `get_current_access_token()` runs on the request thread. The same env-var precedence applies. The middleware sitting between the network and the tool handler was the only layer that distinguished \"operator at the local console\" from \"stranger on the network.\" That layer was the one that logged the absence and forwarded the request.\n\n## The error URL handed back the credential\n\nEven if a network-reachable caller could only invoke tools as the operator, the bug would be critical: full Meta Ads API authority over the operator's accounts. Read insights, mutate campaigns, spend budget, exfiltrate the audience graph. The reason the CVSS is 9.1 and not 9.0 is the second half of the chain. The unauthenticated caller does not have to keep using the tool. They can extract the long-lived operator credential and use it directly against Graph from anywhere.\n\nRead `meta_ads_mcp/core/api.py` at v1.0.108, starting around line 132:\n\n```python\nrequest_params = params or {}\nrequest_params[\"access_token\"] = access_token\n# ...\nresponse = await client.get(url, params=encoded_params, headers=headers, timeout=30.0)\n```\n\nThe Graph API token travels as a query-string parameter. This is Meta's documented contract: `GET /v24.0/me/adaccounts?access_token=&fields=...`. The token is in the URL. `httpx` records the URL on the request object as the canonical record of what it sent.\n\nNow read `make_api_request()`'s `httpx.HTTPStatusError` handler at line 285:\n\n```python\nfull_response = {\n \"headers\": dict(e.response.headers),\n \"status_code\": e.response.status_code,\n \"url\": str(e.response.url),\n \"reason\": getattr(e.response, \"reason_phrase\", \"Unknown reason\"),\n \"request_method\": e.request.method,\n \"request_url\": str(e.request.url)\n}\n\nreturn {\n \"error\": {\n \"message\": f\"HTTP Error: {e.response.status_code}\",\n \"details\": error_info,\n \"full_response\": full_response\n }\n}\n```\n\n`e.request.url` is the full outbound URL, query string included. `str()` on an `httpx.URL` returns the URL verbatim. The dictionary is the body of the JSON-RPC error response the MCP caller receives. Any tool invocation that produces a Graph 4xx, a wrong account ID, an invalid campaign ID, an expired token, any of the dozens of error codes the Graph API emits, returns a payload whose `error.details.full_response.request_url` field contains `access_token=`.\n\nThe 1.0.109 patch adds one helper:\n\n```python\n_SENSITIVE_QUERY_PARAMS = frozenset({\"access_token\", \"appsecret_proof\"})\n\ndef _redact_url(url: str) -> str:\n \"\"\"Strip sensitive query params (access_token, appsecret_proof) from a URL.\"\"\"\n if not url:\n return url\n try:\n parts = urlsplit(url)\n if not parts.query:\n return url\n scrubbed = [\n (k, \"REDACTED\" if k in _SENSITIVE_QUERY_PARAMS else v)\n for k, v in parse_qsl(parts.query, keep_blank_values=True)\n ]\n return urlunsplit((parts.scheme, parts.netloc, parts.path,\n urlencode(scrubbed), parts.fragment))\n except Exception:\n return url.split(\"?\", 1)[0]\n```\n\nAnd calls it twice in `full_response`:\n\n```diff\n- \"url\": str(e.response.url),\n+ \"url\": _redact_url(str(e.response.url)),\n \"reason\": ...,\n \"request_method\": e.request.method,\n- \"request_url\": str(e.request.url)\n+ \"request_url\": _redact_url(str(e.request.url))\n```\n\nThe fix is two function calls and one frozenset. The redaction was straightforward. What it tells you is that the project shipped a Graph API client across one hundred and eight minor releases where the error payload carried `request_url` verbatim, and the only mitigation against `access_token` ending up in that field was the operator never receiving a 4xx. The mitigation was the success path.\n\n## The 1.0.109 patch and the 1.0.114 patch are the same patch, written twice\n\nThe 1.0.109 diff puts a `return Response(401)` inside `if not auth_token and not pipeboard_token`. Read `FastMCPAuthIntegration.extract_pipeboard_token_from_headers` at line 98:\n\n```python\n@staticmethod\ndef extract_pipeboard_token_from_headers(headers: dict) -> Optional[str]:\n # Check for Pipeboard token in X-Pipeboard-Token header (duplication API pattern)\n pipeboard_token = headers.get('X-Pipeboard-Token') or headers.get('x-pipeboard-token')\n if pipeboard_token:\n logger.debug(\"Found Pipeboard token in X-Pipeboard-Token header\")\n return pipeboard_token\n\n # Check for legacy Pipeboard token header\n legacy_token = headers.get('X-PIPEBOARD-API-TOKEN') or headers.get('x-pipeboard-api-token')\n if legacy_token:\n return legacy_token\n\n return None\n```\n\n`X-Pipeboard-Token` is a supplementary service header. It exists for the duplication callback, an internal flow where Pipeboard's hosted service makes a downstream call to itself with a non-authenticating routing tag. The header was never a credential. The function's docstring says so. The comment above the first lookup says `duplication API pattern`. The extractor returns the first non-empty value it finds, and the 1.0.109 deny conditional reads the return value as a single boolean.\n\nA request with `X-Pipeboard-Token: x` and no other auth header passes the v1.0.109 gate. `pipeboard_token` is `\"x\"`, truthy, the `not pipeboard_token` clause is false, the whole `and` is false, the deny branch is skipped. Tool handlers downstream see no `auth_token` set, fall back to `META_ACCESS_TOKEN` exactly as in v1.0.108, and the chain runs.\n\nThis is GHSA-2v2f-mvfg-ph56, filed in the same `SECURITY.md` as the 9gw6 entry that names CVE-2026-48039. It does not have a CVE assigned at the time of writing. The fix landed five minor releases later, as 1.0.114:\n\n```diff\n- if not auth_token and not pipeboard_token:\n+ if not auth_token:\n+ # A request must carry a primary access-token credential.\n+ # X-Pipeboard-Token is only a supplementary service token for the\n+ # duplication callback, on its own it establishes no request auth\n+ # context, so it must not admit a request.\n logger.warning(...)\n return Response(..., status_code=401, ...)\n```\n\nThe 1.0.114 patch removes `and not pipeboard_token` from the deny conditional. The conditional the 1.0.108 source had narrated the absence of, the 1.0.109 patch had wired to a 401, and the 1.0.114 patch had to narrow because the 1.0.109 wiring admitted a header whose own extractor describes it as a supplementary service token.\n\nPipeboard is now three security advisories deep on `--transport streamable-http` in seven minor releases: the original middleware fail-open (9gw6, CVE-2026-48039), the middleware-fix bypass (2v2f, unnumbered), and an SSRF in `upload_ad_image` (45gf, unnumbered) in 1.0.115. All three rely on the same operational shape, a Python process designed for stdio mode rebound to a TCP port with the operator's long-lived credential in the environment. The hosted Pipeboard MCP at `*.mcp.pipeboard.co` is not affected by any of the three, because it binds to localhost behind an authenticating proxy and does not set `META_ACCESS_TOKEN`. The advisories are precisely about the self-hosted operator who followed `STREAMABLE_HTTP_SETUP.md`.\n\nThis is the [design-debt-driver](https://nefariousplan.com/patterns/design-debt-driver) shape. The component is the same component across the three advisories. The substrate is the same: stdio-mode credential plumbing reused on a network transport. Each patch closes the specific instance. The next one is one new feature, or one new header, away.\n\n## The conditional was right at 1.0.108\n\nThe pre-patch source did not lack a check. The check was the conditional. The body was the warning. The 1.0.109 patch reads what was already there, recognizes that the test reaches when the result should be a refusal, and writes the refusal. The 1.0.114 patch reads what 1.0.109 wrote, recognizes that one of the two variables it tests is a duplication-callback routing tag, and removes it from the predicate.\n\nv1.0.108 wrote the right conditional and the wrong body. v1.0.109 wrote the right body for the wrong conditional. v1.0.114 finally wrote both.\n\nPoC: [pipeboard-co/meta-ads-mcp](https://github.com/pipeboard-co/meta-ads-mcp/security/advisories/GHSA-9gw6-46qc-99vr) (vendor advisory; no separate public PoC repository; the chain is fully derivable from the 14d7371 fix commit on the upstream repository).","closing_line":"The 1.0.109 patch is what you write when you finally read the conditional you already had.","hook_md":"`meta_ads_mcp/core/http_auth_integration.py` v1.0.108, line 268. The `AuthInjectionMiddleware.dispatch()` method extracts an Authorization Bearer header (with X-META-ACCESS-TOKEN and X-PIPEBOARD-API-TOKEN as alternates) into one local, and X-Pipeboard-Token into a second local. When both come back `None`, the function enters an `if` branch whose body is exactly one statement: `logger.warning(\"HTTP Auth Middleware: No authentication tokens found in headers\")`. The line after the closing brace is `try: response = await call_next(request)`. The MCP tool handler at the other end of that call reads `META_ACCESS_TOKEN` from the operator's environment, appends it to Graph as `access_token=` in the query string, and on every 4xx serializes `e.request.url` verbatim into the JSON-RPC error payload's `full_response.request_url` field. CVE-2026-48039 is what happens when a security middleware's deny branch logs the absence and falls through to the same `call_next` the accept branches use. Pipeboard shipped the fix in v1.0.109, and re-shipped it as v1.0.114 because the v1.0.109 conditional admitted `X-Pipeboard-Token: anything`.","post_id":629,"slug":"meta-ads-mcp-cve-2026-48039-warning-was-the-gate","title":"CVE-2026-48039: meta-ads-mcp Logged \"No Authentication Tokens Found In Headers.\" The Next Line Called call_next.","type":"initial","unreadable_sentence":"v1.0.108 wrote the right conditional and the wrong body. v1.0.109 wrote the right body for the wrong conditional. v1.0.114 finally wrote both."} -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQRf0htP5+SjynlxywneZjl4jgkQJgUCat0R3gAKCRDeZjl4jgkQ Jia9AQC3qnL+XoCFM3e4IoRj1tFyk+wdlFyzvPcTXUErWsw/ugD/fJOgYYVlhPo9 v3YfT3NL4YIqC05iZLHIoYgkZkSTpwA= =A2SO -----END PGP SIGNATURE-----