Insecure WebSocket Usage in curl Documentation and Examples (CWE-319: Cleartext Transmission of Sensitive Information)
The curl documentation and example code use the insecure ws:// WebSocket protocol instead of wss://, without warning developers. This could lead developers to implement cleartext WebSocket connections, exposing users to eavesdropping and man-in-the-middle attacks.
- Disclosed after under an hour
The curl source repository contains official documentation and example code that demonstrate WebSocket connections using the insecure ws:// protocol instead of the secure wss://. This misleading guidance may encourage developers to implement cleartext WebSocket endpoints, exposing users and infrastructure to eavesdropping, MITM (Man-in-the-Middle) attacks, and session hijacking. Failing to promote secure defaults in a popular open-source project creates systemic risks for downstream adopters.
This report and its analysis were enhanced and generated using an AI assistant to ensure a comprehensive security review and reproducibility. Affected version
Verified on the curl master branch as of August 2025. Insecure usage appears in historical releases as well. Example tested version:
curl 8.1.2 (x86_64-pc-linux-gnu) libcurl/8.1.2 OpenSSL/3.0.7 zlib/1.2.13 brotli/1.0.9 zstd/1.5.2 libidn2/2.3.4 nghttp2/1.51.0 Release-Date: 2023-06-12 Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp ws wss Platform: Linux 5.15.0-83-generic x86_64
Steps To Reproduce:
Clone or download the curl GitHub repository.
Search for insecure WebSocket URIs by running:
grep -rn 'ws://' ./docs/ ./examples/
Review the documentation (docs/WEBSOCKETS.md, etc.) and example code (e.g., examples/websocket-client.c) to confirm insecure ws:// references are present and no explicit security warning is provided.
Validate that instructions or sample code do not require, prefer, or warn about secure WebSocket (wss://) usage.
Supporting Material/References:
File: docs/WEBSOCKETS.md (e.g., line 15: curl "ws://echo.websocket.org")
File: examples/websocket-client.c (e.g., line 42: #define WS_URL "ws://test.websocket.org")
Manual and Semgrep findings for insecure protocol patterns
curl/curl GitHub repository
Impact
Summary:
By demonstrating and failing to warn against insecure WebSocket usage (ws://), curl's documentation may lead developers to implement applications that transmit data over unencrypted channels. This enables attackers to:
Eavesdrop on user data in transit
Hijack sessions or inject malicious payloads
Perform MiTM attacks against production services and infrastructure
For a widely adopted open source tool, propagating insecure defaults has downstream and supply chain impact, potentially affecting thousands of projects. Severity is High, and the most relevant CWE is CWE-319: Cleartext Transmission of Sensitive Information.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the documentation and examples were written for simplicity and never updated to use or recommend the secure wss:// scheme.
Impact
Developers following the examples could build applications that send data in cleartext, allowing attackers to eavesdrop, hijack sessions, or perform man-in-the-middle attacks.
What the attacker needed
Access to curl repository; developer follows examples
How it was found
- Clone or download the curl GitHub repository.
- Search for insecure WebSocket URIs in the docs and examples directories.
- Review the documentation and example code to confirm insecure ws:// references are present and no security warning is given.
- Check that instructions or sample code do not require, prefer, or warn about secure wss:// usage.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
WebSocket is a way for a browser and server to keep a two-way connection open. The 'ws://' version sends data without encryption, so anyone on the network can read or change it; 'wss://' is the encrypted version. This report says curl's own examples use the unencrypted version without warning, which might teach developers to do the same.
What is Misconfiguration?
Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.