sbt is a build tool for Scala, Java, and others. From version 0.9.5 to before version 1.12.7, on Windows, sbt uses Process("cmd", "/c", ...) to run VCS commands (git, hg, svn). The URI fragment (branch, tag, revision) is user-controlled via the build definition and passed to these commands without validation. Because cmd /c interprets &, |, and ; as command separators, a malicious fragment can execute arbitrary commands. This issue has been patched in version 1.12.7.
sbt (Scala Build Tool) versions 0.9.5 through 1.12.6 on Windows are vulnerable to command injection through unvalidated VCS URI fragments. Attackers can execute arbitrary commands by crafting malicious git/hg/svn branch, tag, or revision parameters in build definitions. This affects development environments and CI/CD pipelines using sbt on Windows systems. Patch to version 1.12.7 or later is critical.
IMMEDIATE ACTIONS:
1. Identify all Windows systems running sbt versions 0.9.5-1.12.6 across development, CI/CD, and build environments
2. Audit build.sbt and build.scala files for user-controlled VCS URI fragments (git/hg/svn references)
3. Restrict build definition modifications to trusted developers only
PATCHING:
1. Upgrade sbt to version 1.12.7 or later immediately on all affected systems
2. Update sbt launcher scripts and wrapper configurations
3. Verify patch installation: sbt --version should show 1.12.7+
4. Test builds post-upgrade to ensure compatibility
COMPENSATING CONTROLS (if immediate patching delayed):
1. Disable VCS integration in sbt builds where possible
2. Use explicit, hardcoded branch/tag references instead of dynamic fragments
3. Implement input validation: sanitize branch/tag names to alphanumeric + hyphens/underscores only
4. Run sbt builds in isolated containers/VMs with minimal privileges
5. Restrict Windows command execution permissions on build servers
DETECTION:
1. Monitor sbt build logs for unusual cmd.exe invocations with special characters (&, |, ;)
2. Alert on build.sbt modifications containing dynamic VCS fragments
3. Implement file integrity monitoring on build definition files
4. Log all sbt process executions with command-line arguments
5. Search for patterns: Process("cmd", "/c") with unsanitized variables in codebase
الإجراءات الفورية:
1. تحديد جميع أنظمة Windows التي تقوم بتشغيل إصدارات sbt من 0.9.5-1.12.6 عبر بيئات التطوير و CI/CD والبناء
2. تدقيق ملفات build.sbt و build.scala للبحث عن معاملات VCS التي يتحكم بها المستخدم
3. تقييد تعديلات تعريف البناء للمطورين الموثوقين فقط
التصحيح:
1. ترقية sbt إلى الإصدار 1.12.7 أو أحدث فوراً على جميع الأنظمة المتأثرة
2. تحديث نصوص مشغل sbt وتكوينات المجمع
3. التحقق من تثبيت التصحيح: sbt --version يجب أن يظهر 1.12.7+
4. اختبار البناء بعد الترقية لضمان التوافق
الضوابط البديلة (إذا تأخر التصحيح الفوري):
1. تعطيل تكامل VCS في بناء sbt حيث أمكن
2. استخدام مراجع فرع/علامة صريحة ومشفرة بدلاً من الأجزاء الديناميكية
3. تنفيذ التحقق من الإدخال: تنظيف أسماء الفروع/العلامات إلى أحرف وأرقام فقط
4. تشغيل بناء sbt في حاويات/أجهزة افتراضية معزولة بامتيازات محدودة
5. تقييد أذونات تنفيذ أوامر Windows على خوادم البناء
الكشف:
1. مراقبة سجلات بناء sbt للبحث عن استدعاءات cmd.exe غير العادية بأحرف خاصة
2. التنبيه على تعديلات build.sbt التي تحتوي على أجزاء VCS ديناميكية
3. تنفيذ مراقبة سلامة الملفات على ملفات تعريف البناء
4. تسجيل جميع عمليات sbt مع معاملات سطر الأوامر
5. البحث عن الأنماط: Process("cmd", "/c") مع متغيرات غير منظفة في قاعدة الأكواد