Summary
The mcp-from-openapi library in FrontMCP dereferences $ref pointers in OpenAPI specifications without restricting which URLs or file paths can be accessed.
When an untrusted OpenAPI spec is processed, a malicious actor can embed $ref values that cause the server to make internal network requests or read local files, enabling SSRF and local file disclosure during the initialize() call.
Affected context
This vulnerability appears in applications that:
- Integrate FrontMCP's mcp-from-openapi library
- Accept or process OpenAPI specifications from external or partially trusted sources
- Allow mcp-from-openapi to automatically dereference $ref pointers using default json-schema-ref-parser behavior
The risk is most pronounced when the MCP implementation runs in an environment with access to internal services, cloud metadata endpoints, or sensitive files on disk.
Exploit preconditions
- Attack surface: The code path that ingests and initializes OpenAPI specifications via mcp-from-openapi (e.g., API upload endpoints, configuration loading, or dynamic connector setup).
- Required access: Ability to supply or influence the OpenAPI specification consumed by the server (authenticated or unauthenticated, depending on the application).
- Trigger point: Invocation of the library's initialize() (or equivalent) routine, which triggers dereferencing of $ref entries using json-schema-ref-parser.
- Why exploitation is possible: The dereferencer follows arbitrary URLs and file paths without:
- Restricting schemes, hosts, or paths, or
- Using custom resolvers to enforce a safe allowlist/denylist.
As a result, $ref values can point to internal URLs (e.g., http://127.0.0.1, VPC-only hosts, metadata services) or local resources (e.g., file:///etc/passwd), and the server will fetch them on the attacker's behalf.
Why this happens
The underlying issue is the lack of trust boundary enforcement in automated reference resolution of structured specifications.
The mcp-from-openapi library delegates $ref dereferencing to @apidevtools/json-schema-ref-parser with default behavior, which treats all referenced locations as equally trustworthy and reachable.
This maps to CWE-918: Server-Side Request Forgery (SSRF) because the server is coerced into issuing arbitrary outbound requests based on attacker-controlled input.
Additionally, because the dereferencer supports local file and non-network schemes, the same flaw leads to unintended local file read, turning what should be a pure data interpretation step into a generalized retrieval primitive that crosses security boundaries.
Potential impact
- An attacker could induce requests to internal HTTP(S) services, potentially:
- Enumerating internal endpoints and ports
- Accessing admin-only or management interfaces not exposed to the public internet
- Bypassing network ACLs and IP-based access controls
- The server could be tricked into calling cloud provider metadata endpoints, which may:
- Expose temporary credentials and access tokens
- Reveal environment-specific secrets or configuration
- Local file paths may be dereferenced, which can:
- Disclose sensitive configuration files (keys, tokens, database credentials)
- Leak source code or environment-specific secrets
- Combined with other issues (such as overly verbose error messages or response reflection), this behavior may facilitate:
- Lateral movement within the infrastructure
- Further privilege escalation and data exfiltration
General mitigation guidance
Effective mitigation focuses on constraining what the dereferencing step is allowed to reach and how untrusted OpenAPI content is handled:
- Treat all externally supplied OpenAPI specifications as untrusted data unless explicitly vetted.
- Configure JSON Schema/OpenAPI dereferencing libraries with:
- Strict allowlists of permitted protocols (e.g., only https://) and hostnames
- Explicit denylists for loopback, link-local, and metadata IP ranges (e.g., 127.0.0.0/8, 169.254.169.254, 10.0.0.0/8)
- Disabling file:// or other non-HTTP schemes when they are not strictly required.
- Prefer using custom resolvers that:
- Resolve $ref only from a controlled, pre-fetched set of documents
- Avoid performing arbitrary outbound network requests at dereference time.
- Isolate services that process untrusted OpenAPI definitions:
- Run them in constrained network segments with minimal internal reachability
- Apply least-privilege OS permissions to limit access to local files.
- Normalize workflows so that specification upload/consumption is decoupled from production credentials and sensitive infrastructure, reducing the blast radius if dereferencing is abused.
How teams detect issues like this
Detection efforts should aim to identify both the insecure dereferencing pattern in code and unusual access patterns at runtime:
- Static analysis and code review:
- Look for uses of @apidevtools/json-schema-ref-parser (or similar tools) that call dereference() or resolve() on untrusted data without:
- Custom resolvers
- Scheme/host restrictions
- Any explicit network or file access policies.
- Flag places where external OpenAPI specifications are accepted and immediately fed into automatic dereferencing routines.
- Integrate secure coding guidelines into pull request templates, calling out SSRF risks when using schema dereferencers.
- Configuration and policy checks:
- Implement linting rules or CI checks that disallow default dereferencing behavior on untrusted specs.
- Enforce infrastructure policies that block outbound traffic to metadata IPs and restrict egress to defined destinations.
- Runtime monitoring:
- Monitor server logs and egress traffic for unexpected outbound requests triggered during OpenAPI processing.
- Set alerts for requests to loopback (127.0.0.1), link-local, or known cloud metadata endpoints.
- Automated security testing tools (DAST/SAST) can be configured to:
- Submit malicious OpenAPI documents containing internal/metadata $ref targets
- Detect whether the application attempts to fetch those endpoints during initialization.

