YARD is a Ruby Documentation tool. Prior to version 0.9.42, a path traversal vulnerability was discovered in YARD when using yard server to serve documentation. This bug would allow unsanitized HTTP requests to access arbitrary files on the machine of a yard server host under certain conditions. This issue has been patched in version 0.9.42.
YARD Ruby documentation tool versions prior to 0.9.42 contain a path traversal vulnerability (CWE-22) in the yard server component that allows unauthenticated attackers to read arbitrary files from the host system. With a CVSS score of 7.5, this vulnerability poses a significant risk to organizations using YARD for internal documentation serving. The vulnerability requires no authentication and can be exploited through crafted HTTP requests, making it a critical concern for development environments.
Immediate Actions:
1. Identify all instances of YARD server running in your environment using network scanning and asset inventory tools
2. Immediately take YARD servers offline or restrict network access to trusted internal networks only
3. Review access logs for suspicious HTTP requests containing path traversal patterns (../, ..\, encoded variants)
4. Conduct forensic analysis to determine if arbitrary files were accessed
Patching Guidance:
1. Upgrade YARD to version 0.9.42 or later as soon as available
2. For Ruby projects, update the Gemfile: gem 'yard', '~> 0.9.42'
3. Run 'bundle update yard' and redeploy documentation servers
4. Verify patch installation by checking YARD version: yard --version
Compensating Controls (if patching delayed):
1. Implement network-level access controls: restrict YARD server access to specific IP ranges
2. Deploy Web Application Firewall (WAF) rules to block path traversal attempts (../, encoded variants)
3. Run YARD server in a containerized environment with minimal file system permissions
4. Use reverse proxy (nginx/Apache) with strict URL validation before forwarding to YARD
5. Disable yard server functionality and use static HTML documentation instead
Detection Rules:
1. Monitor HTTP requests to YARD servers for patterns: GET requests containing '../', '..\', '%2e%2e', URL-encoded slashes
2. Alert on file access attempts outside documentation directories
3. Log and review any 200 OK responses to suspicious path requests
4. Monitor for access to sensitive files: /etc/passwd, config files, .env, credentials
الإجراءات الفورية:
1. تحديد جميع حالات خادم YARD التي تعمل في بيئتك باستخدام أدوات المسح الشبكي وأدوات جرد الأصول
2. إيقاف خوادم YARD فوراً أو تقييد الوصول الشبكي للشبكات الداخلية الموثوقة فقط
3. مراجعة سجلات الوصول للطلبات المريبة التي تحتوي على أنماط اجتياز المسار
4. إجراء تحليل جنائي لتحديد ما إذا تم الوصول إلى ملفات عشوائية
إرشادات التصحيح:
1. ترقية YARD إلى الإصدار 0.9.42 أو أحدث عند توفره
2. لمشاريع Ruby، حدّث Gemfile: gem 'yard', '~> 0.9.42'
3. قم بتشغيل 'bundle update yard' وأعد نشر خوادم التوثيق
4. تحقق من تثبيت التصحيح بفحص إصدار YARD: yard --version
الضوابط البديلة (إذا تأخر التصحيح):
1. تطبيق ضوابط الوصول على مستوى الشبكة: تقييد وصول خادم YARD على نطاقات IP محددة
2. نشر قواعد جدار حماية تطبيقات الويب (WAF) لحظر محاولات اجتياز المسار
3. تشغيل خادم YARD في بيئة حاوية مع أذونات نظام ملفات محدودة
4. استخدام وكيل عكسي (nginx/Apache) مع التحقق الصارم من عناوين URL
5. تعطيل وظيفة yard server واستخدام التوثيق الثابت بصيغة HTML بدلاً من ذلك
قواعد الكشف:
1. مراقبة طلبات HTTP إلى خوادم YARD للبحث عن الأنماط: طلبات GET تحتوي على '../' أو '..\' أو متغيرات مشفرة
2. تنبيه محاولات الوصول إلى الملفات خارج أدلة التوثيق
3. تسجيل ومراجعة أي استجابات 200 OK لطلبات المسار المريبة
4. مراقبة الوصول إلى الملفات الحساسة: /etc/passwd وملفات التكوين و.env والبيانات الاعتبارية