A flaw was found in ansible-core. The ansible-galaxy role install command processes dependency specifications from a role's meta/requirements.yml file. Due to improper neutralization of argument delimiters, a malicious role author can inject arbitrary git configuration flags through the src field. This allows arbitrary code execution on the machine of a user who installs the role via ansible-galaxy role install.
A critical vulnerability in Ansible Galaxy allows arbitrary code execution through malicious role dependencies. Attackers can inject git configuration flags via the src field in meta/requirements.yml, enabling remote code execution when users install compromised roles. This poses significant risk to Saudi organizations using Ansible for infrastructure automation and configuration management.
IMMEDIATE ACTIONS:
1. Audit all Ansible Galaxy roles installed in your environment, particularly from untrusted or newly discovered sources
2. Review meta/requirements.yml files in all installed roles for suspicious src field values containing git flags (--config, --exec-path, etc.)
3. Restrict ansible-galaxy role install commands to trusted internal repositories only
4. Implement network segmentation to limit outbound git connections
COMPENSATING CONTROLS (until patch available):
5. Use Ansible execution environments with read-only filesystems where possible
6. Run ansible-galaxy commands in isolated containers with minimal privileges
7. Implement code review processes for all role dependencies before installation
8. Use git credential helpers instead of embedded credentials in role sources
9. Monitor git process execution for suspicious flags: grep -r "--config\|--exec-path\|--upload-pack" /etc/ansible/
10. Disable ansible-galaxy role install functionality where not essential; use pre-downloaded roles instead
DETECTION RULES:
- Monitor for ansible-galaxy processes with git configuration flag arguments
- Alert on unexpected child processes spawned from ansible-galaxy
- Log all role installations with source validation
- Implement file integrity monitoring on Ansible configuration directories
الإجراءات الفورية:
1. تدقيق جميع أدوار Ansible Galaxy المثبتة في بيئتك، خاصة من مصادر غير موثوقة أو مكتشفة حديثاً
2. مراجعة ملفات meta/requirements.yml في جميع الأدوار المثبتة للبحث عن قيم حقل src المريبة التي تحتوي على أعلام git
3. تقييد أوامر ansible-galaxy role install على المستودعات الداخلية الموثوقة فقط
4. تنفيذ تقسيم الشبكة لتحديد اتصالات git الصادرة
الضوابط التعويضية (حتى توفر التصحيح):
5. استخدام بيئات تنفيذ Ansible مع أنظمة ملفات للقراءة فقط حيث أمكن
6. تشغيل أوامر ansible-galaxy في حاويات معزولة بامتيازات محدودة
7. تنفيذ عمليات مراجعة الأكواد لجميع تبعيات الأدوار قبل التثبيت
8. استخدام مساعدات بيانات اعتماد git بدلاً من بيانات الاعتماد المضمنة
9. مراقبة تنفيذ عمليات git للبحث عن أعلام مريبة
10. تعطيل وظيفة ansible-galaxy role install حيث لا تكون ضرورية؛ استخدم الأدوار المحملة مسبقاً بدلاً من ذلك