Chainlit Critical Vulnerabilities Disclosure
Disclosure date: January 20, 2026
Product: Chainlit – Open-source Python framework for building AI/chatbot interfaces
Affected deployments: Internet-exposed or internal Chainlit applications running versions prior to 2.9.4
Risk level: Critical (combined impact)
Product Overview
Chainlit is commonly used to build interactive AI applications and chat interfaces. It exposes backend APIs that manage conversations, uploaded elements (files, images, data objects), and application state. These APIs are often authenticated but are typically accessible to normal users, developers, or API clients.
The disclosed issues affect how Chainlit processes custom elements and remote file references, allowing attackers to abuse trusted backend behavior.
Vulnerability Summary
Two independent but related vulnerabilities were identified in Chainlit’s element handling logic:
- Arbitrary File Read – allows attackers to read sensitive files from the server filesystem.
- Server-Side Request Forgery (SSRF) – allows attackers to force the server to make internal or cloud-metadata HTTP requests.
Both vulnerabilities:
- Require no user interaction
- Can be exploited by a low-privileged authenticated user
- Can lead to credential leakage, configuration exposure, and cloud compromise
CVE Overview Table
| CVE Name | CVE ID | CVSS Score | Severity | Attack Vector | Privileges Required | User Interaction | Exploit Availability |
|---|---|---|---|---|---|---|---|
| Chainlit Arbitrary File Read | CVE-2026-22218 | 7.1 | High | Network | Low | None | No public weaponized PoC |
| Chainlit SSRF (SQLAlchemy Data Layer) | CVE-2026-22219 | 8.3 | High | Network | Low | None | No public weaponized PoC |
Even without public exploit code, both issues are easy to exploit by anyone familiar with API testing.
CVE-2026-22218 – Arbitrary File Read
What the vulnerability is
Chainlit allows users to create or update custom elements. During this process, a client supplies a file path that the server uses internally.
Due to missing validation:
- Absolute paths and unintended filesystem locations are accepted
- The server reads the file and stores it under an internal key
- The file can then be retrieved using a follow-up API call
This effectively turns the application into a file-reading service for attackers.
How exploitation works
- Attacker authenticates to the application (normal user access is enough)
- Sends a request to the element creation or update API
- Supplies a malicious file path such as:
/etc/passwd/app/.env/proc/self/environ
- The server reads the file and assigns it a generated element key
- Attacker downloads the file using
/project/file/<element_key>
No brute force, no race condition, no user clicks required.
What data can be exposed
- Environment variables (API keys, tokens)
- Database credentials
- OAuth secrets
- Internal application configuration
- Stored conversation history
- Source code files
- SSH keys (if readable by the process)
MITRE Mapping
- CWE-22: Improper Limitation of a Pathname to a Restricted Directory
- ATT&CK:
- Initial Access: Exploit Public-Facing Application
- Discovery: File and Directory Discovery
- Exfiltration: Data from Local System
Detection & Hunting
Log sources to monitor
- Application logs (Chainlit backend)
- API gateway / reverse proxy logs
- File access logs
- Object storage logs (if elements are persisted)
Indicators of exploitation
- Requests to
/project/elementcontaining:- Absolute paths (
/etc/,/proc/,/var/) - Environment file names (
.env,config.yaml)
- Absolute paths (
- Immediate follow-up requests to
/project/file/* - Element creation activity outside normal usage patterns
Example detection logic
IF request_path == "/project/element"
AND request_body CONTAINS ("path":"/")
THEN alert "Possible arbitrary file read attempt"
CVE-2026-22219 – Server-Side Request Forgery (SSRF)
What the vulnerability is
When Chainlit is configured with a SQLAlchemy-based data layer, element creation allows a client to specify a remote URL.
The backend:
- Automatically fetches the URL
- Does not restrict internal or private addresses
- Stores the response as element content
This allows attackers to make the server perform internal HTTP requests.
How exploitation works
- Attacker authenticates normally
- Submits an element creation request with a crafted URL
- Example targets:
- Cloud metadata:
http://169.254.169.254/ - Local services:
http://localhost:8000/admin - Internal APIs:
http://10.x.x.x/internal
- Cloud metadata:
- Chainlit fetches the response
- Attacker retrieves the fetched data
Why this is dangerous
SSRF is often the first step in cloud compromise.
If metadata services are reachable:
- Temporary cloud credentials can be stolen
- Attackers can access cloud APIs
- Full account takeover becomes possible
MITRE Mapping
- CWE-918: Server-Side Request Forgery
- ATT&CK:
- Initial Access: Exploit Public-Facing Application
- Credential Access: Cloud Instance Metadata API
- Lateral Movement / Exfiltration
Detection & Hunting (SSRF)
Log sources to monitor
- Application outbound HTTP logs
- Network firewall / proxy logs
- Cloud flow logs
- Reverse proxy access logs
High-risk indicators
- Outbound traffic to:
169.254.169.254localhost127.0.0.1- RFC1918 private IP ranges
- Element creation requests containing URLs
- Backend making HTTP requests it normally should not
Example detection rule (network)
IF destination_ip == 169.254.169.254
AND process == application_server
THEN alert "Possible SSRF metadata access"
Proof-of-Concept (Educational)
- No widely published exploit scripts at the time of disclosure
- Exploitation requires only standard API calls
- Any API testing tool (curl, Postman) is sufficient
- Attack complexity is low
Mitigation & Remediation
Immediate actions
- Upgrade Chainlit immediately
- Review logs for historical exploitation
- Rotate all credentials stored in environment variables
- Restrict outbound traffic from application servers
- Apply WAF rules for
/project/element
Long-term hardening
- Enforce strict allow-lists for file paths
- Block internal IP ranges in URL fetch logic
- Require IMDSv2 (cloud metadata protection)
- Apply least-privilege permissions to runtime accounts
- Log and alert on element creation abuse
Official Patch / Upgrade Link
Upgrade to Chainlit version 2.9.4 or later
Final Takeaway
These vulnerabilities are silent, low-effort, and high-impact.
Any unpatched Chainlit deployment should be considered at risk of data exposure, especially in cloud environments.
