LiquidJS is a Shopify / GitHub Pages compatible template engine in pure JavaScript. Prior to 10.25.3, for {% include %}, {% render %}, and {% layout %}, LiquidJS checks whether the candidate path is inside the configured partials or layouts roots before reading it. That check is path-based, not realpath-based. Because of that, a file like partials/link.liquid passes the directory containment check as long as its pathname is under the allowed root. If link.liquid is actually a symlink to a file outside the allowed root, the filesystem follows the symlink when the file is opened and LiquidJS renders the external target. So the restriction is applied to the path string that was requested, not to the file that is actually read. This matters in environments where an attacker can place templates or otherwise influence files under a trusted template root, including uploaded themes, extracted archives, mounted content, or repository-controlled template trees. This vulnerability is fixed in 10.25.3.
LiquidJS versions prior to 10.25.3 contain a path traversal vulnerability in template inclusion functions that allows attackers to read arbitrary files through symlink exploitation. An attacker who can place files or symlinks in template directories can bypass path-based containment checks and access sensitive files outside the configured template root. This vulnerability is particularly critical in multi-tenant environments and content management systems common in Saudi Arabia's digital transformation initiatives.
IMMEDIATE ACTIONS:
1. Identify all Node.js applications using LiquidJS by reviewing package.json and npm dependency trees across your infrastructure
2. Audit file permissions and access controls on template directories to restrict write access to trusted administrators only
3. Disable symlink following in template directories using filesystem-level controls (mount with nofollow option on Linux)
4. Implement strict input validation on any user-uploaded templates or theme files
PATCHING GUIDANCE:
1. Upgrade LiquidJS to version 10.25.3 or later immediately
2. Test upgrades in non-production environments first, particularly for e-commerce and CMS platforms
3. Verify template rendering functionality after patching
COMPENSATING CONTROLS (if immediate patching not possible):
1. Implement filesystem-level access controls using SELinux or AppArmor to restrict template engine file access
2. Use chroot jails or containers to isolate template processing with minimal filesystem exposure
3. Monitor file access patterns using auditd or similar tools to detect symlink traversal attempts
4. Implement Web Application Firewall (WAF) rules to detect suspicious template inclusion patterns
DETECTION RULES:
1. Monitor for symlink creation in template directories: auditctl -w /path/to/templates -p wa -k template_changes
2. Alert on file access outside configured template roots from LiquidJS processes
3. Log all include/render/layout directive calls with their resolved file paths
4. Monitor for readlink() or realpath() syscalls followed by file access outside expected directories
الإجراءات الفورية:
1. تحديد جميع تطبيقات Node.js التي تستخدم LiquidJS من خلال مراجعة package.json وأشجار التبعيات عبر البنية التحتية
2. تدقيق أذونات الملفات والتحكم في الوصول على مجلدات القوالب لتقييد الوصول للكتابة للمسؤولين الموثوقين فقط
3. تعطيل متابعة الروابط الرمزية في مجلدات القوالب باستخدام عناصر التحكم على مستوى نظام الملفات
4. تنفيذ التحقق الصارم من المدخلات على أي قوالب أو ملفات مواضيع يتم تحميلها من قبل المستخدم
إرشادات التصحيح:
1. ترقية LiquidJS إلى الإصدار 10.25.3 أو أحدث على الفور
2. اختبار الترقيات في بيئات غير الإنتاج أولاً، خاصة لمنصات التجارة الإلكترونية وأنظمة إدارة المحتوى
3. التحقق من وظيفة عرض القالب بعد التصحيح
عناصر التحكم التعويضية:
1. تنفيذ عناصر التحكم في الوصول على مستوى نظام الملفات باستخدام SELinux أو AppArmor
2. استخدام أقفاص chroot أو الحاويات لعزل معالجة القوالب
3. مراقبة أنماط الوصول إلى الملفات باستخدام auditd
4. تنفيذ قواعد جدار حماية تطبيقات الويب للكشف عن أنماط تضمين القوالب المريبة
قواعد الكشف:
1. مراقبة إنشاء الروابط الرمزية في مجلدات القوالب
2. التنبيه على الوصول إلى الملفات خارج جذور القوالب المكونة
3. تسجيل جميع استدعاءات التوجيهات مع مساراتها المحللة
4. مراقبة استدعاءات النظام المريبة المتعلقة بالروابط الرمزية