melange allows users to build apk packages using declarative pipelines. In version 0.11.3 to before 0.40.3, an attacker who can influence the tar stream from a QEMU guest VM could write files outside the intended workspace directory on the host. The retrieveWorkspace function extracts tar entries without validating that paths stay within the workspace, allowing path traversal via ../ sequences. This issue has been patched in version 0.40.3.
CVE-2026-24843 is a path traversal vulnerability in Melange (versions 0.11.3-0.40.2) that allows attackers to write files outside the intended workspace directory through malicious tar streams from QEMU guest VMs. With a CVSS score of 8.2, this vulnerability poses significant risk to organizations using Melange for container image building and package management. The vulnerability is particularly concerning in CI/CD pipelines where untrusted or compromised VM images could be leveraged for supply chain attacks.
IMMEDIATE ACTIONS:
1. Identify all systems running Melange versions 0.11.3 through 0.40.2 in your environment
2. Isolate affected build systems from production networks if possible
3. Review recent build logs and artifacts for signs of compromise
4. Audit QEMU VM images used in build pipelines for unauthorized modifications
PATCHING:
1. Upgrade Melange to version 0.40.3 or later immediately
2. Verify patch application by checking version output: melange version
3. Re-validate all build artifacts created with vulnerable versions
COMPENSATING CONTROLS (if immediate patching not possible):
1. Implement strict input validation on tar streams before processing
2. Run Melange builds in isolated containers with restricted filesystem access
3. Use AppArmor or SELinux profiles to restrict file write operations outside workspace
4. Implement file integrity monitoring (FIM) on workspace directories
5. Restrict QEMU VM image sources to trusted, signed repositories only
DETECTION:
1. Monitor for tar extraction operations with path traversal patterns (../ sequences)
2. Alert on file writes outside designated workspace directories
3. Log all QEMU guest-to-host communications
4. Implement auditd rules: auditd -w /path/to/workspace -p wa -k melange_workspace
5. Search logs for error messages related to path validation failures
الإجراءات الفورية:
1. تحديد جميع الأنظمة التي تقوم بتشغيل إصدارات Melange من 0.11.3 إلى 0.40.2 في بيئتك
2. عزل أنظمة البناء المتأثرة عن شبكات الإنتاج إن أمكن
3. مراجعة سجلات البناء الحديثة والقطع الأثرية للبحث عن علامات الاختراق
4. تدقيق صور QEMU VM المستخدمة في خطوط أنابيب البناء للتعديلات غير المصرح بها
التصحيح:
1. ترقية Melange إلى الإصدار 0.40.3 أو أحدث على الفور
2. التحقق من تطبيق التصحيح بفحص إخراج الإصدار: melange version
3. إعادة التحقق من صحة جميع القطع الأثرية المبنية بالإصدارات الضعيفة
الضوابط البديلة (إذا لم يكن التصحيح الفوري ممكناً):
1. تنفيذ التحقق الصارم من المدخلات على تدفقات tar قبل المعالجة
2. تشغيل بناء Melange في حاويات معزولة مع وصول نظام الملفات المقيد
3. استخدام ملفات تعريف AppArmor أو SELinux لتقييد عمليات الكتابة خارج مساحة العمل
4. تنفيذ مراقبة سلامة الملفات (FIM) على أدلة مساحة العمل
5. تقييد مصادر صور QEMU VM إلى المستودعات الموثوقة والموقعة فقط
الكشف:
1. مراقبة عمليات استخراج tar مع أنماط عبور المسار (تسلسلات ../)
2. التنبيه على كتابة الملفات خارج أدلة مساحة العمل المعينة
3. تسجيل جميع الاتصالات من ضيف QEMU إلى المضيف
4. تنفيذ قواعد auditd: auditd -w /path/to/workspace -p wa -k melange_workspace
5. البحث في السجلات عن رسائل الخطأ المتعلقة بفشل التحقق من المسار