CVE-2022-24278
📋 TL;DR
CVE-2022-24278 is a directory traversal vulnerability in convert-svg-core that allows attackers to read arbitrary files on the server by uploading specially crafted SVG files. This affects applications using convert-svg-core for SVG processing, particularly web applications that accept user-uploaded SVG files. The vulnerability stems from improper sanitization of SVG tags that can contain path traversal sequences.
💻 Affected Systems
- convert-svg-core
📦 What is this software?
Convert Svg by Convert Svg Project
⚠️ Risk & Real-World Impact
Worst Case
Complete server file system disclosure including sensitive configuration files, credentials, and source code, potentially leading to full system compromise.
Likely Case
Unauthorized access to application files, configuration data, and potentially sensitive user data stored on the server.
If Mitigated
Limited file access restricted to the application's directory if proper file permissions and sandboxing are implemented.
🎯 Exploit Status
Exploitation requires the ability to upload or provide SVG files to the vulnerable application. The vulnerability is well-documented with public proof-of-concept examples available.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 0.6.4 and later
Vendor Advisory: https://github.com/neocotic/convert-svg/security/advisories/GHSA-7vpr-3q9h-5hx6
Restart Required: No
Instructions:
1. Update convert-svg-core to version 0.6.4 or later using npm update convert-svg-core. 2. Verify the update with npm list convert-svg-core. 3. Test SVG processing functionality after update.
🔧 Temporary Workarounds
Input Validation and Sanitization
allImplement server-side validation to reject SVG files containing suspicious path traversal patterns before processing.
// Example Node.js validation: if (svgContent.includes('..') || svgContent.includes('/etc') || svgContent.includes('/var')) { rejectFile(); }
File Processing Sandbox
linuxRun SVG processing in a containerized or sandboxed environment with restricted file system access.
docker run --read-only -v /tmp:/tmp:ro node-app
🧯 If You Can't Patch
- Disable SVG file upload functionality entirely in the application
- Implement strict file type validation and only allow trusted, pre-verified SVG files
🔍 How to Verify
Check if Vulnerable:
Check package.json for convert-svg-core version: grep -A2 -B2 convert-svg-core package.json
Check Version:
npm list convert-svg-core
Verify Fix Applied:
Verify installed version is 0.6.4 or higher: npm list convert-svg-core | grep convert-svg-core
📡 Detection & Monitoring
Log Indicators:
- Unusual file access patterns from SVG processing, multiple failed SVG upload attempts, error logs showing path traversal attempts
Network Indicators:
- Large SVG file uploads containing encoded path traversal sequences, unusual outbound file transfers following SVG processing
SIEM Query:
source="application.logs" AND ("convert-svg" OR "svg processing") AND (".." OR "/etc" OR "/var" OR "path traversal")
🔗 References
- https://github.com/neocotic/convert-svg/commit/2bbc498c5029238637206661dbac9e44d37d17c5
- https://github.com/neocotic/convert-svg/issues/86
- https://github.com/neocotic/convert-svg/pull/87
- https://snyk.io/vuln/SNYK-JS-CONVERTSVGCORE-2859830
- https://github.com/neocotic/convert-svg/commit/2bbc498c5029238637206661dbac9e44d37d17c5
- https://github.com/neocotic/convert-svg/issues/86
- https://github.com/neocotic/convert-svg/pull/87
- https://snyk.io/vuln/SNYK-JS-CONVERTSVGCORE-2859830