CVE-2020-15690
📋 TL;DR
CVE-2020-15690 is a CRLF injection vulnerability in Nim's asyncftpclient library that allows attackers to inject arbitrary commands into FTP sessions by sending messages containing newline characters. This affects any application using the vulnerable asyncftpclient library in Nim versions before 1.2.6. Attackers can potentially execute unauthorized commands on FTP servers.
💻 Affected Systems
- Nim programming language standard library asyncftpclient
📦 What is this software?
Nim by Nim Lang
⚠️ Risk & Real-World Impact
Worst Case
Complete compromise of FTP server allowing arbitrary command execution, data exfiltration, or server takeover.
Likely Case
Unauthorized file operations, directory traversal, or information disclosure through FTP command injection.
If Mitigated
Limited impact with proper input validation and network segmentation in place.
🎯 Exploit Status
Public proof-of-concept available, exploitation requires network access to vulnerable FTP client applications.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Nim 1.2.6 and later
Vendor Advisory: https://github.com/nim-lang/Nim/security/advisories
Restart Required: Yes
Instructions:
1. Update Nim to version 1.2.6 or later. 2. Recompile all applications using asyncftpclient. 3. Redeploy patched applications.
🔧 Temporary Workarounds
Input validation wrapper
allAdd custom validation to check for newline characters before passing data to asyncftpclient functions.
Implement input sanitization in application code before calling asyncftpclient methods
🧯 If You Can't Patch
- Implement network segmentation to isolate FTP traffic
- Use alternative FTP client libraries with proper input validation
🔍 How to Verify
Check if Vulnerable:
Check if application uses Nim's asyncftpclient library and Nim version is below 1.2.6
Check Version:
nim --version
Verify Fix Applied:
Verify Nim version is 1.2.6 or later and application has been recompiled with updated library
📡 Detection & Monitoring
Log Indicators:
- Unusual FTP command sequences
- Multiple failed FTP connections with malformed data
Network Indicators:
- FTP traffic containing newline characters in command parameters
- Unusual FTP command patterns
SIEM Query:
source="ftp_logs" AND (message="*\n*" OR message="*\r*" OR command="*injection*")
🔗 References
- http://www.openwall.com/lists/oss-security/2021/02/04/3
- https://consensys.net/diligence/vulnerabilities/nim-asyncftpd-crlf-injection/
- https://github.com/nim-lang/Nim/blob/dc5a40f3f39c6ea672e6dc6aca7f8118a69dda99/lib/pure/asyncftpclient.nim#L145
- https://github.com/nim-lang/Nim/compare/v1.2.4...v1.2.6
- https://github.com/tintinweb/pub/tree/master/pocs/cve-2020-15690
- http://www.openwall.com/lists/oss-security/2021/02/04/3
- https://consensys.net/diligence/vulnerabilities/nim-asyncftpd-crlf-injection/
- https://github.com/nim-lang/Nim/blob/dc5a40f3f39c6ea672e6dc6aca7f8118a69dda99/lib/pure/asyncftpclient.nim#L145
- https://github.com/nim-lang/Nim/compare/v1.2.4...v1.2.6
- https://github.com/tintinweb/pub/tree/master/pocs/cve-2020-15690