A security flaw has been discovered in NousResearch hermes-agent up to 2026.4.30. Affected by this issue is the function _sanitize_env_lines of the file hermes_cli/config.py. The manipulation results in injection. It is possible to launch the attack remotely. The attack requires a high level of complexity. The exploitation is known to be difficult. The exploit has been released to the public and may be used for attacks. The vendor was contacted early about this disclosure but did not respond in any way.
CVE-2026-10222 is a medium-severity injection vulnerability in NousResearch hermes-agent affecting versions up to 2026.4.30. The flaw exists in the _sanitize_env_lines function of hermes_cli/config.py, allowing remote code injection through environment variable manipulation. While exploitation requires high complexity and no active exploits are currently known, the lack of vendor response and public disclosure of the vulnerability warrant immediate attention from Saudi organizations using this tool.
Immediate Actions:
1. Inventory all systems running NousResearch hermes-agent versions up to 2026.4.30
2. Isolate affected systems from production environments if possible
3. Review environment variable configurations for suspicious modifications
4. Monitor system logs for unusual environment variable access patterns
Patching Guidance:
1. Contact NousResearch for security updates or workarounds
2. If no patch is available, consider upgrading to the latest version when released
3. Implement strict access controls on configuration files (hermes_cli/config.py)
4. Restrict file permissions to read-only for non-administrative users
Compensating Controls:
1. Implement input validation and sanitization at the application level
2. Use environment variable whitelisting to restrict allowed variables
3. Deploy Web Application Firewalls (WAF) to detect injection attempts
4. Enable comprehensive logging and monitoring of configuration file access
5. Implement network segmentation to limit lateral movement if compromise occurs
Detection Rules:
1. Monitor for unusual environment variable modifications in hermes_cli/config.py
2. Alert on attempts to execute commands through environment variables
3. Track access to configuration files outside normal operational patterns
4. Monitor for suspicious process spawning from hermes-agent processes
الإجراءات الفورية:
1. حصر جميع الأنظمة التي تقوم بتشغيل NousResearch hermes-agent بإصدارات حتى 2026.4.30
2. عزل الأنظمة المتأثرة عن بيئات الإنتاج إن أمكن
3. مراجعة تكوينات متغيرات البيئة للتعديلات المريبة
4. مراقبة سجلات النظام للأنماط غير العادية في الوصول إلى متغيرات البيئة
إرشادات التصحيح:
1. التواصل مع NousResearch للحصول على تحديثات أمان أو حلول بديلة
2. إذا لم يكن هناك تصحيح متاح، فكر في الترقية إلى أحدث إصدار عند إصداره
3. تنفيذ ضوابط وصول صارمة على ملفات التكوين (hermes_cli/config.py)
4. تقييد أذونات الملفات للقراءة فقط للمستخدمين غير الإداريين
الضوابط البديلة:
1. تنفيذ التحقق من صحة المدخلات والتطهير على مستوى التطبيق
2. استخدام القائمة البيضاء لمتغيرات البيئة لتقييد المتغيرات المسموحة
3. نشر جدران الحماية لتطبيقات الويب (WAF) للكشف عن محاولات الحقن
4. تفعيل السجلات الشاملة ومراقبة الوصول إلى ملفات التكوين
5. تنفيذ تقسيم الشبكة لتحديد الحركة الجانبية في حالة الاختراق
قواعد الكشف:
1. مراقبة تعديلات متغيرات البيئة غير العادية في hermes_cli/config.py
2. التنبيه على محاولات تنفيذ الأوامر من خلال متغيرات البيئة
3. تتبع الوصول إلى ملفات التكوين خارج أنماط التشغيل العادية
4. مراقبة توليد العمليات المريبة من عمليات hermes-agent