Skip to content

fix: MCPSecurityPolicy missing 0.0.0.0/8 and ::/128 CIDR blocks #6908

@jongio

Description

@jongio

Summary

BlockPrivateNetworks() in pkg/azdext/mcp_security.go is missing two CIDR blocks that were present in the original azd-rest SSRF protection:

  • 0.0.0.0/8 — "this" network, reaches loopback on Linux/macOS
  • ::/128 — IPv6 unspecified address, reaches loopback on some systems

Impact

Moderate severity, low practical risk.

The 0.0.0.0/8 gap is a known SSRF bypass technique — requests to 0.0.0.1 reach loopback on Linux/macOS, bypassing a 127.0.0.0/8-only block. However, practical exploitability is limited because:

  1. Only azd-rest is affected (the only extension making outbound HTTP from user-provided URLs)
  2. azd-rest runs locally as a CLI extension, not as a server
  3. DefaultMCPSecurityPolicy() also enforces HTTPS, which independently blocks http://0.0.0.1 requests

The ::/128 gap is negligible — most systems map :: to ::1 which is already blocked.

Fix

PR #6907 adds both missing CIDRs and extends test coverage with IPv6 cases.

How it happened

When SSRF protection was extracted from azd-rest into the SDK (PR #6856), 2 of 9 CIDR entries were dropped from the list.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions