/

CVE-2026-22219

Severity:

HIGH RISK

(7.7)

SSRF in Chainlit SQLAlchemy Element Backend

CVE-2026-22219

Analyzed

Vulnerability type

Category:

Server-Side Request Forgery (SSRF)

CWE:

CWE-918

Impact:

Unauthorized access to internal network resources and sensitive metadata via server-initiated HTTP requests

Severity:

HIGH RISK

(7.7)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Chainlit versions prior to 2.9.4 expose a server-side request forgery (SSRF) issue in the /project/element update flow when the SQLAlchemy data layer backend is used.

An authenticated client can supply a user-controlled URL that the server will fetch via HTTP, enabling requests to internal services or cloud metadata endpoints and storing the responses through the configured storage provider.

Affected context

The vulnerability arises in Chainlit deployments that:

  • Use the SQLAlchemy data layer backend for element storage
  • Allow authenticated users to create or update Elements via the /project/element flow
  • Permit a user-controlled url field to be passed into element creation logic

In this context, the Chainlit server performs outbound HTTP GET requests based on the user-controlled URL without sufficient validation or restriction, potentially reaching internal-only hosts or cloud metadata services accessible from the server's network position.

Exploit preconditions

  • Attack surface: Chainlit HTTP API, specifically Element creation/update endpoints (e.g., /project/element) when SQLAlchemy backend is configured.
  • Required access: Authenticated client able to submit or update Element definitions including a url field.
  • Trigger point: Submitting an Element whose url attribute points to an attacker-chosen target host or endpoint.
  • Why exploitation is possible: The element creation logic issues outbound HTTP GET requests to the provided URL without enforcing robust allowlists, network segmentation checks, or metadata endpoint protections, effectively allowing user-controlled server-side requests.

Why this happens

This issue stems from treating user-controlled URLs as trusted destinations for server-initiated HTTP requests within the SQLAlchemy element creation flow.

The backend logic interpolates a URL provided by an authenticated client directly into an outbound HTTP GET operation, without applying strict validation, host restriction, or network-layer isolation.

This pattern corresponds to CWE-918: Server-Side Request Forgery (SSRF), where an attacker can abuse the server's network privileges to reach internal or otherwise inaccessible endpoints by controlling request targets.

Potential impact

  • Access to internal HTTP services that are not exposed publicly but are reachable from the Chainlit server.
  • Retrieval of cloud provider instance metadata, which may include tokens, credentials, or configuration secrets.
  • Discovery of internal network structure and services through response content or error messages.
  • Leveraging stored responses to exfiltrate sensitive data via the configured storage provider.
  • Potential pivoting to further attacks if internal services expose administrative or management interfaces over HTTP.

General mitigation guidance

Effective mitigation focuses on reducing trust in user-supplied URLs and constraining where the server can connect:

  • Apply strict allowlists of permitted domains or endpoints for any server-initiated HTTP fetch operations, rejecting all others by default.
  • Disallow or carefully constrain direct use of user-controlled URLs in backend logic; where URLs must be accepted, validate scheme, host, and port against known-safe patterns.
  • Block access to link-local and internal-only addresses (e.g., 169.254.169.254, RFC1918 ranges, loopback, and Unix socket-based HTTP) at the application layer and, where possible, at the network level.
  • Isolate services performing outbound fetches into restricted network segments with minimal reachable internal resources.
  • Store only the minimal necessary subset of fetched data, and avoid persisting highly sensitive metadata or large unvalidated responses.

How teams detect issues like this

Organizations can look for SSRF indicators and risky patterns using:

  • Static analysis rules that flag HTTP client usage where request targets are derived from user-controllable fields (e.g., request parameters or JSON body fields named url, uri, endpoint).
  • Code review checklists that require reviewers to verify that all outbound HTTP requests have domain restrictions, scheme checks, and address filtering.
  • Runtime monitoring of outbound egress traffic from Chainlit servers, looking for:
  • Connections to link-local or metadata IPs (e.g., 169.254.169.254).
  • Unexpected access to internal private ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16).
  • Web application firewall (WAF) or egress firewall policies that log and optionally block suspicious destinations from the application's network perimeter.
  • Automated security review tools integrated into CI/CD, configured to detect unvalidated URL usage and SSRF-prone patterns in Python/SQLAlchemy-based components.

Sources

SourceLink
github.comgithub.com/Chainlit/chainlit/releases/tag/2.9.4
vulncheck.comvulncheck.com/advisories/chainlit-sqlalchemy-data-layer-ssrf-via-project-element
zafran.iozafran.io/resources/chainleak-critical-ai-framework-vulnerabilities-expose-data-enable-cloud-takeover

Frequently asked

questions

Yes, but only by authenticated clients who can reach the Chainlit API and submit Element updates. Those clients can then cause the server to issue HTTP requests to internal or restricted endpoints that might not be directly reachable from the internet.

The attacker must be able to authenticate to the Chainlit instance and create or modify Elements that include a url property. No direct access to internal services is required, since the server acts as the requester.

The most robust fix is to avoid using arbitrary user-supplied URLs for server-side fetches. Where such functionality is required, enforce strict allowlists of permitted hosts or services, implement thorough validation and address filtering, and block access to internal and metadata endpoints, combined with network egress controls.

Treat all URLs provided by clients as untrusted input, centralize outbound HTTP logic behind a vetted utility or service that enforces domain and address restrictions, and include SSRF-specific checks in both code review and automated security testing. Additionally, configure network-level egress policies to limit where application servers can connect, reducing the blast radius of any SSRF flaw.

Find out what's already
exploitable in your codebase.