Gogs is an open source self-hosted Git service. In version 0.13.3 and prior, a path traversal vulnerability exists in the updateWikiPage function of Gogs. The vulnerability allows an authenticated user with write access to a repository's wiki to delete arbitrary files on the server by manipulating the old_title parameter in the wiki editing form. This issue has been patched in versions 0.13.4 and 0.14.0+dev.
Gogs versions 0.13.3 and prior contain a path traversal vulnerability in wiki page editing that allows authenticated users with repository write access to delete arbitrary files on the server. This high-severity vulnerability (CVSS 8.1) poses significant risk to organizations using self-hosted Gogs instances for source code management and documentation. Immediate patching to version 0.13.4 or 0.14.0+ is critical to prevent unauthorized file deletion and potential system compromise.
IMMEDIATE ACTIONS:
1. Identify all Gogs instances in your environment running version 0.13.3 or earlier using: grep -r 'version' /path/to/gogs/conf/app.ini or check admin panel
2. Restrict wiki write access to trusted users only; review repository permissions immediately
3. Implement network segmentation to limit Gogs server access
4. Enable audit logging for all wiki operations
PATCHING GUIDANCE:
1. Upgrade to Gogs version 0.13.4 or 0.14.0+ immediately
2. Backup all repositories and wiki data before patching
3. Test patches in non-production environment first
4. Schedule maintenance window for production upgrades
COMPENSATING CONTROLS (if immediate patching not possible):
1. Disable wiki functionality temporarily via app.ini: ENABLE_WIKI = false
2. Implement file integrity monitoring (FIM) on Gogs server directories
3. Restrict Gogs process permissions using AppArmor/SELinux profiles
4. Monitor file deletion events: auditctl -w /path/to/gogs -p wa -k gogs_changes
DETECTION RULES:
1. Monitor HTTP POST requests to /wiki/edit with suspicious old_title parameters containing ../ or absolute paths
2. Alert on unexpected file deletions in Gogs data directories
3. Log all wiki page edit operations and correlate with file system changes
4. Monitor for path traversal patterns: old_title=.*\.\..*|old_title=^/
الإجراءات الفورية:
1. حدد جميع نسخ Gogs في بيئتك التي تعمل بالإصدار 0.13.3 أو أقدم باستخدام: grep -r 'version' /path/to/gogs/conf/app.ini أو تحقق من لوحة المسؤول
2. قيد وصول كتابة الويكي للمستخدمين الموثوقين فقط؛ راجع أذونات المستودع فوراً
3. طبق تقسيم الشبكة لتحديد وصول خادم Gogs
4. فعّل تسجيل التدقيق لجميع عمليات الويكي
إرشادات التصحيح:
1. قم بالترقية إلى إصدار Gogs 0.13.4 أو 0.14.0+ فوراً
2. قم بعمل نسخة احتياطية من جميع المستودعات وبيانات الويكي قبل التصحيح
3. اختبر التصحيحات في بيئة غير الإنتاج أولاً
4. جدول نافذة صيانة لترقيات الإنتاج
الضوابط البديلة (إذا لم يكن التصحيح الفوري ممكناً):
1. عطّل وظيفة الويكي مؤقتاً عبر app.ini: ENABLE_WIKI = false
2. طبق مراقبة سلامة الملفات (FIM) على دلائل خادم Gogs
3. قيد أذونات عملية Gogs باستخدام ملفات تعريف AppArmor/SELinux
4. راقب أحداث حذف الملفات: auditctl -w /path/to/gogs -p wa -k gogs_changes
قواعد الكشف:
1. راقب طلبات HTTP POST إلى /wiki/edit مع معاملات old_title مريبة تحتوي على ../ أو مسارات مطلقة
2. أصدر تنبيهات عند حذف ملفات غير متوقعة في دلائل بيانات Gogs
3. سجل جميع عمليات تحرير صفحات الويكي وربطها بتغييرات نظام الملفات
4. راقب أنماط اجتياز المسار: old_title=.*\.\..*|old_title=^/