goshs is a SimpleHTTPServer written in Go. From 2.0.0-beta.4 to 2.0.0-beta.5, goshs contains a cross-site request forgery issue in its state-changing HTTP GET routes. An external attacker can cause an already authenticated browser to trigger destructive actions such as ?delete and ?mkdir because goshs relies on HTTP basic auth alone and performs no CSRF, Origin, or Referer validation for those routes. This vulnerability is fixed in 2.0.0-beta.6.
goshs versions 2.0.0-beta.4 through 2.0.0-beta.5 contain a critical CSRF vulnerability allowing unauthenticated attackers to trigger destructive file operations (delete, mkdir) on authenticated user sessions. The vulnerability exploits the absence of CSRF tokens and origin validation on state-changing GET requests, enabling remote attackers to manipulate file systems through social engineering. This poses significant risk to organizations using goshs for file serving in development or internal environments.
IMMEDIATE ACTIONS:
1. Identify all instances of goshs 2.0.0-beta.4 and 2.0.0-beta.5 in your environment using network scanning and asset inventory tools
2. Restrict network access to goshs instances using firewall rules - limit to trusted internal networks only
3. Disable state-changing GET operations (?delete, ?mkdir) if possible through configuration
4. Implement reverse proxy with CSRF token validation (nginx/Apache) in front of goshs instances
PATCHING GUIDANCE:
1. Upgrade immediately to goshs 2.0.0-beta.6 or later when available
2. If upgrade not immediately possible, apply compensating controls below
COMPENSATING CONTROLS:
1. Deploy WAF rules to block requests containing ?delete or ?mkdir parameters from external sources
2. Implement HTTP Referer and Origin header validation at reverse proxy level
3. Use SameSite cookie attributes (Strict) if goshs supports cookie configuration
4. Enforce network segmentation - isolate goshs to internal networks only
5. Implement request logging and alerting for suspicious GET requests with state-changing parameters
DETECTION RULES:
1. Monitor for GET requests containing ?delete or ?mkdir parameters
2. Alert on requests with mismatched Origin/Referer headers
3. Track authentication followed by immediate destructive operations from different source IPs
4. Log all file deletion and directory creation events with source IP and user agent
الإجراءات الفورية:
1. تحديد جميع نسخ goshs 2.0.0-beta.4 و 2.0.0-beta.5 في بيئتك باستخدام أدوات المسح والجرد
2. تقييد الوصول إلى شبكة goshs باستخدام قواعد جدار الحماية - حصر الوصول للشبكات الداخلية الموثوقة فقط
3. تعطيل عمليات GET التي تغير الحالة (?delete, ?mkdir) إن أمكن من خلال الإعدادات
4. تطبيق reverse proxy مع التحقق من رموز CSRF (nginx/Apache) أمام نسخ goshs
إرشادات التصحيح:
1. الترقية الفورية إلى goshs 2.0.0-beta.6 أو إصدار أحدث عند توفره
2. إذا لم يكن الترقية ممكنة فوراً، طبق الضوابط البديلة أدناه
الضوابط البديلة:
1. نشر قواعد WAF لحجب الطلبات التي تحتوي على معاملات ?delete أو ?mkdir من مصادر خارجية
2. تطبيق التحقق من رؤوس HTTP Referer و Origin على مستوى reverse proxy
3. استخدام سمات ملفات تعريف الارتباط SameSite (Strict) إذا كانت goshs تدعم إعدادات ملفات تعريف الارتباط
4. فرض تقسيم الشبكة - عزل goshs على الشبكات الداخلية فقط
5. تطبيق تسجيل الطلبات والتنبيهات للطلبات المريبة التي تحتوي على معاملات تغيير الحالة
قواعد الكشف:
1. مراقبة طلبات GET التي تحتوي على معاملات ?delete أو ?mkdir
2. التنبيه على الطلبات ذات رؤوس Origin/Referer غير المتطابقة
3. تتبع المصادقة متبوعة بعمليات مدمرة فورية من عناوين IP مختلفة
4. تسجيل جميع أحداث حذف الملفات وإنشاء المجلدات مع عنوان IP ووكيل المستخدم