CVE-2024-38514 Overview
CVE-2024-38514 is a Server-Side Request Forgery (SSRF) vulnerability in NextChat, a cross-platform ChatGPT/Gemini web UI. The flaw exists in the WebDav API endpoint, which fails to validate the endpoint GET parameter. Attackers can abuse this weakness to issue arbitrary HTTPS requests from the vulnerable instance using MKCOL, PUT, and GET methods. The vulnerability also allows targeting NextChat users by forcing their browsers to execute arbitrary JavaScript. The maintainers patched the issue in version 2.12.4. The vulnerability is tracked under [CWE-918].
Critical Impact
Unauthenticated attackers can pivot through vulnerable NextChat instances to reach internal services or deliver arbitrary JavaScript to users.
Affected Products
- NextChat (ChatGPT-Next-Web) versions prior to 2.12.4
- Self-hosted NextChat deployments exposing the WebDav API route
- Multi-user NextChat instances accessible over the network
Discovery Timeline
- 2024-06-28 - CVE-2024-38514 published to NVD
- 2026-04-15 - Last updated in NVD database
Technical Details for CVE-2024-38514
Vulnerability Analysis
The vulnerability resides in the WebDav API handler at app/api/webdav/[...path]/route.ts. NextChat reads the endpoint GET parameter and uses it as the destination URL for upstream WebDav requests. The original code did not parse or validate the URL structure or verify the destination against an allowlist. As a result, attackers can supply arbitrary hosts and protocols.
An attacker can issue server-side HTTPS requests to internal services using MKCOL, PUT, and GET methods. This enables internal network reconnaissance, interaction with cloud metadata services, and writes to attacker-controlled endpoints. The same parameter can be set to a hostile URL whose response contains JavaScript, which is then rendered in the victim user's browser session.
The EPSS score sits at 2.186% with a percentile of 80.012, indicating moderate observed interest relative to other CVEs.
Root Cause
The handler trusts user-controlled input in the endpoint query parameter without normalizing it through a URL parser or comparing it against config.allowedWebDevEndpoints. Missing input validation on a server-side fetch primitive is a textbook [CWE-918] pattern.
Attack Vector
The attack vector is network-based and requires no authentication or user interaction for the SSRF primitive. An attacker sends a crafted HTTP request to the NextChat WebDav route with a malicious endpoint parameter. To weaponize the client-side variant, the attacker tricks a NextChat user into loading a URL that returns attacker-controlled JavaScript through the proxied request.
// Patch excerpt: app/api/webdav/[...path]/route.ts
...config.allowedWebDevEndpoints,
].filter((domain) => Boolean(domain.trim()));
+const normalizeUrl = (url: string) => {
+ try {
+ return new URL(url);
+ } catch (err) {
+ return null;
+ }
+};
+
async function handle(
req: NextRequest,
{ params }: { params: { path: string[] } },
Source: GitHub Commit dad1221. The patch introduces a normalizeUrl helper that parses the supplied endpoint with the WHATWG URL constructor. Inputs that fail to parse return null, and the handler can then reject the request or check the parsed origin against the allowlist.
Detection Methods for CVE-2024-38514
Indicators of Compromise
- Inbound HTTP requests to /api/webdav/* carrying an endpoint query parameter that points to internal IP ranges, 169.254.169.254, localhost, or non-allowlisted domains.
- Outbound HTTPS connections from the NextChat host using MKCOL or PUT methods to unfamiliar destinations.
- NextChat application logs showing WebDav proxy calls with unusual URL schemes or hostnames not present in allowedWebDevEndpoints.
Detection Strategies
- Inspect reverse proxy and WAF logs for query strings containing endpoint= paired with URLs targeting RFC1918 ranges or cloud metadata IPs.
- Correlate the NextChat container's egress traffic against the configured allowlist and alert on deviations.
- Hunt for response bodies returned to NextChat clients that contain <script> tags or unexpected JavaScript sourced through the WebDav route.
Monitoring Recommendations
- Enable structured logging on the WebDav route and ship logs to a centralized analytics pipeline for query-parameter analysis.
- Alert when NextChat initiates connections to hosts outside the documented WebDav backend.
- Track the deployed NextChat version in asset inventory and flag instances below 2.12.4.
How to Mitigate CVE-2024-38514
Immediate Actions Required
- Upgrade all NextChat deployments to version 2.12.4 or later, which contains the validated normalizeUrl logic.
- Audit the allowedWebDevEndpoints configuration and remove unused or wildcard entries.
- Restrict outbound network access from NextChat containers to only the WebDav backends in use.
Patch Information
The fix is delivered in NextChat 2.12.4. The change is recorded in commit dad1221 and described in GHSA-gph5-rx77-3pjg. Operators running container images should pull the updated tag and redeploy.
Workarounds
- Place NextChat behind a reverse proxy that strips or validates the endpoint query parameter against an explicit allowlist.
- Apply egress firewall rules that block requests from NextChat to internal subnets and cloud metadata endpoints such as 169.254.169.254.
- Disable the WebDav integration entirely if it is not required by users.
# Example egress restriction with iptables on the NextChat host
iptables -A OUTPUT -d 169.254.169.254 -j REJECT
iptables -A OUTPUT -d 10.0.0.0/8 -p tcp --dport 443 -j REJECT
iptables -A OUTPUT -d 192.168.0.0/16 -p tcp --dport 443 -j REJECT
iptables -A OUTPUT -d 172.16.0.0/12 -p tcp --dport 443 -j REJECT
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

