Samba Remote Code Execution Vulnerability — Samba contains a remote code execution vulnerability, allowing a malicious client to upload a shared library to a writable share and then cause the server to load and execute it.
CVE-2017-7494 is a critical remote code execution vulnerability in Samba (versions 3.5.0 and later) that allows an authenticated attacker to upload a malicious shared library to a writable share and force the server to load and execute it. Known as 'SambaCry' or 'EternalRed,' this vulnerability has publicly available exploits and has been actively exploited in the wild, including for cryptocurrency mining and ransomware deployment. With a CVSS score of 9.0, this vulnerability poses an extreme risk to any organization running unpatched Samba file-sharing services. Immediate patching is critical as exploitation requires only write access to any share on the target system.
IMMEDIATE ACTIONS:
1. Identify all Samba installations across the environment using network scanning tools (nmap -p 445 --script smb-vuln-cve-2017-7494)
2. Apply Samba security patches immediately — update to Samba 4.6.4, 4.5.10, or 4.4.14 or later
3. If patching is not immediately possible, add 'nt pipe support = no' to the [global] section of smb.conf and restart Samba as a temporary workaround (note: this may break some Windows client functionality)
PATCHING GUIDANCE:
- For RHEL/CentOS: yum update samba
- For Ubuntu/Debian: apt-get update && apt-get upgrade samba
- For SUSE: zypper update samba
- Verify patch application by checking samba version: smbd --version
COMPENSATING CONTROLS:
1. Remove write permissions from all Samba shares where not strictly necessary
2. Restrict Samba access to trusted network segments only using firewall rules (block TCP 445 from untrusted networks)
3. Enable SELinux/AppArmor to limit Samba process capabilities
4. Implement network segmentation to isolate file servers
5. Disable anonymous/guest access to all shares
DETECTION RULES:
1. Monitor for unusual .so file uploads to Samba shares
2. Alert on Samba (smbd) process spawning unexpected child processes
3. IDS/IPS signature: Monitor for named pipe requests containing path traversal patterns on SMB
4. YARA rules for known SambaCry payloads
5. Monitor Samba logs for unusual IPC$ and pipe connection attempts
الإجراءات الفورية:
1. تحديد جميع تثبيتات Samba في البيئة باستخدام أدوات فحص الشبكة (nmap -p 445 --script smb-vuln-cve-2017-7494)
2. تطبيق تحديثات أمان Samba فوراً — التحديث إلى الإصدار 4.6.4 أو 4.5.10 أو 4.4.14 أو أحدث
3. في حال عدم إمكانية التحديث الفوري، أضف 'nt pipe support = no' إلى قسم [global] في ملف smb.conf وأعد تشغيل Samba كحل مؤقت (ملاحظة: قد يؤثر على بعض وظائف عملاء Windows)
إرشادات التحديث:
- لأنظمة RHEL/CentOS: yum update samba
- لأنظمة Ubuntu/Debian: apt-get update && apt-get upgrade samba
- لأنظمة SUSE: zypper update samba
- التحقق من التحديث بفحص الإصدار: smbd --version
الضوابط التعويضية:
1. إزالة صلاحيات الكتابة من جميع المجلدات المشتركة حيث لا تكون ضرورية
2. تقييد الوصول إلى Samba على شرائح الشبكة الموثوقة فقط باستخدام قواعد جدار الحماية (حظر TCP 445 من الشبكات غير الموثوقة)
3. تفعيل SELinux/AppArmor للحد من صلاحيات عملية Samba
4. تطبيق تجزئة الشبكة لعزل خوادم الملفات
5. تعطيل الوصول المجهول/الضيف لجميع المجلدات المشتركة
قواعد الكشف:
1. مراقبة تحميل ملفات .so غير عادية إلى مجلدات Samba المشتركة
2. التنبيه عند إنشاء عملية Samba (smbd) لعمليات فرعية غير متوقعة
3. توقيعات IDS/IPS: مراقبة طلبات الأنابيب المسماة التي تحتوي على أنماط اجتياز المسار على SMB
4. قواعد YARA للحمولات المعروفة لـ SambaCry
5. مراقبة سجلات Samba لمحاولات اتصال IPC$ والأنابيب غير العادية