OpenClaw before 2026.4.20 fails to properly reserve the OPENCLAW_ runtime-control environment namespace in workspace dotenv files, allowing attackers to override critical runtime variables. Malicious workspaces can set variables like OPENCLAW_GIT_DIR to manipulate trusted OpenClaw runtime behavior during source-update or installer flows.
OpenClaw before version 2026.4.20 contains an environment variable namespace collision vulnerability (CWE-184) that allows attackers to override critical runtime variables through malicious workspace dotenv files. This enables manipulation of trusted OpenClaw runtime behavior during source-update and installer flows, potentially leading to arbitrary code execution or supply chain compromise. The vulnerability affects Node.js-based OpenClaw deployments with a CVSS score of 7.8 (high severity) and requires immediate patching.
IMMEDIATE ACTIONS:
1. Identify all OpenClaw installations in your environment and verify versions prior to 2026.4.20
2. Audit all workspace dotenv files for suspicious OPENCLAW_* variable definitions
3. Review git logs and deployment history for unauthorized changes during source-update and installer flows
4. Isolate affected OpenClaw instances from production environments if version < 2026.4.20
PATCHING GUIDANCE:
1. Upgrade OpenClaw to version 2026.4.20 or later immediately
2. Test patches in non-production environments first
3. Restart all OpenClaw services after patching
4. Verify patch application by checking version output
COMPENSATING CONTROLS (if immediate patching not possible):
1. Implement strict file system permissions on dotenv files (read-only for OpenClaw process)
2. Use environment variable whitelisting — only allow approved OPENCLAW_* variables
3. Implement workspace access controls — restrict who can modify dotenv files
4. Monitor dotenv file modifications with file integrity monitoring (FIM) tools
5. Disable automatic source-update and installer flows until patched
DETECTION RULES:
1. Monitor for dotenv files containing OPENCLAW_GIT_DIR, OPENCLAW_INSTALL_DIR, or other OPENCLAW_* variables
2. Alert on unexpected modifications to workspace dotenv files
3. Log all OpenClaw runtime variable overrides
4. Monitor git operations initiated by OpenClaw for suspicious repository paths
5. Implement SIEM rules: (dotenv modification) AND (OPENCLAW_* variable) = HIGH priority alert
الإجراءات الفورية:
1. حدد جميع تثبيتات OpenClaw في بيئتك وتحقق من الإصدارات السابقة للإصدار 2026.4.20
2. قم بتدقيق جميع ملفات dotenv في مساحة العمل بحثًا عن تعريفات متغيرات OPENCLAW_* المريبة
3. راجع سجلات git وسجل النشر للتغييرات غير المصرح بها أثناء تدفقات تحديث المصدر والمثبت
4. عزل مثيلات OpenClaw المتأثرة عن بيئات الإنتاج إذا كان الإصدار < 2026.4.20
إرشادات التصحيح:
1. قم بترقية OpenClaw إلى الإصدار 2026.4.20 أو أحدث على الفور
2. اختبر التصحيحات في بيئات غير الإنتاج أولاً
3. أعد تشغيل جميع خدمات OpenClaw بعد التصحيح
4. تحقق من تطبيق التصحيح بفحص إخراج الإصدار
الضوابط البديلة (إذا لم يكن التصحيح الفوري ممكنًا):
1. تطبيق أذونات نظام ملفات صارمة على ملفات dotenv (قراءة فقط لعملية OpenClaw)
2. استخدام القائمة البيضاء لمتغيرات البيئة — السماح فقط بمتغيرات OPENCLAW_* المعتمدة
3. تطبيق ضوابط الوصول إلى مساحة العمل — تقييد من يمكنه تعديل ملفات dotenv
4. مراقبة تعديلات ملفات dotenv باستخدام أدوات مراقبة سلامة الملفات (FIM)
5. تعطيل تدفقات تحديث المصدر والمثبت التلقائية حتى يتم التصحيح
قواعد الكشف:
1. مراقبة ملفات dotenv التي تحتوي على OPENCLAW_GIT_DIR أو OPENCLAW_INSTALL_DIR أو متغيرات OPENCLAW_* أخرى
2. تنبيه عند التعديلات غير المتوقعة على ملفات dotenv في مساحة العمل
3. تسجيل جميع تجاوزات متغيرات وقت تشغيل OpenClaw
4. مراقبة عمليات git التي يبدأها OpenClaw للمسارات المريبة
5. تطبيق قواعل SIEM: (تعديل dotenv) و (متغير OPENCLAW_*) = تنبيه ذو أولوية عالية