esm.sh is a no-build content delivery network (CDN) for web development. Prior to Go pseeudoversion 0.0.0-20260116051925-c62ab83c589e, the software has a path traversal vulnerability due to an incomplete fix. `path.Clean` normalizes a path but does not prevent absolute paths in a malicious tar file. Commit https://github.com/esm-dev/esm.sh/commit/9d77b88c320733ff6689d938d85d246a3af9af16, corresponding to pseudoversion 0.0.0-20260116051925-c62ab83c589e, fixes this issue.
esm.sh CDN contains a path traversal vulnerability (CVE-2026-23644) allowing attackers to extract files outside intended directories via malicious tar archives. The vulnerability affects versions prior to pseudoversion 0.0.0-20260116051925-c62ab83c589e and has publicly available exploits. Organizations using esm.sh for JavaScript module delivery face risks of arbitrary file extraction and potential code injection attacks.
Immediate Actions:
1. Identify all applications and services using esm.sh CDN across your infrastructure
2. Review dependency manifests and package.json files for esm.sh references
3. Implement network monitoring to detect suspicious tar file extraction patterns
Patching Guidance:
1. Update esm.sh to pseudoversion 0.0.0-20260116051925-c62ab83c589e or later
2. Rebuild and redeploy all applications using updated esm.sh dependencies
3. Verify patch application by checking commit hash in deployment logs
Compensating Controls (if immediate patching not possible):
1. Implement strict input validation on tar file processing
2. Use containerization with restricted filesystem permissions to limit path traversal impact
3. Deploy Web Application Firewall (WAF) rules to detect malicious tar payloads
4. Restrict esm.sh CDN access to whitelisted IP ranges only
5. Monitor file system access logs for unexpected file creation outside designated directories
Detection Rules:
1. Alert on tar extraction attempts with absolute paths (starting with /)
2. Monitor for file creation in unexpected system directories from CDN processes
3. Track esm.sh version mismatches between declared and actual deployments
4. Implement YARA rules to detect malicious tar signatures in network traffic
الإجراءات الفورية:
1. تحديد جميع التطبيقات والخدمات التي تستخدم شبكة توصيل esm.sh عبر البنية التحتية الخاصة بك
2. مراجعة ملفات البيانات الوصفية للمشروع وملفات package.json للبحث عن مراجع esm.sh
3. تنفيذ مراقبة الشبكة للكشف عن أنماط استخراج ملفات tar المريبة
إرشادات التصحيح:
1. تحديث esm.sh إلى الإصدار الزائف 0.0.0-20260116051925-c62ab83c589e أو أحدث
2. إعادة بناء ونشر جميع التطبيقات باستخدام تبعيات esm.sh المحدثة
3. التحقق من تطبيق التصحيح بفحص بصمة الالتزام في سجلات النشر
الضوابط البديلة (إذا لم يكن التصحيح الفوري ممكناً):
1. تنفيذ التحقق الصارم من صحة المدخلات على معالجة ملفات tar
2. استخدام الحاويات مع أذونات نظام الملفات المقيدة لتحديد تأثير اجتياز المسار
3. نشر قواعد جدار الحماية لتطبيقات الويب (WAF) للكشف عن حمولات tar الضارة
4. تقييد وصول شبكة توصيل esm.sh إلى نطاقات IP المدرجة في القائمة البيضاء فقط
5. مراقبة سجلات الوصول إلى نظام الملفات للكشف عن إنشاء ملفات غير متوقعة خارج الدلائل المخصصة
قواعد الكشف:
1. تنبيهات على محاولات استخراج tar بمسارات مطلقة (تبدأ بـ /)
2. مراقبة إنشاء الملفات في دلائل النظام غير المتوقعة من عمليات شبكة التوصيل
3. تتبع عدم تطابق إصدار esm.sh بين الإصدارات المعلنة والفعلية
4. تنفيذ قواعد YARA للكشف عن توقيعات tar الضارة في حركة المرور على الشبكة