Zen C is a systems programming language that compiles to human-readable GNU C/C11. Prior to version 0.4.2, a command injection vulnerability (CWE-78) in the Zen C compiler allows local attackers to execute arbitrary shell commands by providing a specially crafted output filename via the `-o` command-line argument. The vulnerability existed in the `main` application logic (specifically in `src/main.c`), where the compiler constructed a shell command string to invoke the backend C compiler. This command string was built by concatenating various arguments, including the user-controlled output filename, and was subsequently executed using the `system()` function. Because `system()` invokes a shell to parse and execute the command, shell metacharacters within the output filename were interpreted by the shell, leading to arbitrary command execution. An attacker who can influence the command-line arguments passed to the `zc` compiler (like through a build script or a CI/CD pipeline configuration) can execute arbitrary commands with the privileges of the user running the compiler. The vulnerability has been fixed in version 0.4.2 by removing `system()` calls, implementing `ArgList`, and internal argument handling. Users are advised to update to Zen C version v0.4.2 or later.
Zen C compiler versions prior to 0.4.2 contain a command injection vulnerability in the -o output filename parameter that allows local attackers to execute arbitrary shell commands. The vulnerability stems from unsafe concatenation of user-controlled input into a shell command executed via the system() function.
ثغرة حقن أوامر في مترجم Zen C تسمح للمهاجمين المحليين بتنفيذ أوامر shell عشوائية من خلال معامل اسم الملف -o. تحدث الثغرة لأن المترجم يدمج اسم الملف الذي يتحكم فيه المستخدم مباشرة في أمر shell يتم تنفيذه باستخدام دالة system() غير الآمنة.
مترجم Zen C الإصدارات السابقة للإصدار 0.4.2 تحتوي على ثغرة حقن أوامر في معامل اسم الملف -o تسمح للمهاجمين المحليين بتنفيذ أوامر shell عشوائية. تنشأ الثغرة من الدمج غير الآمن للمدخلات التي يتحكم فيها المستخدم في أمر shell يتم تنفيذه عبر دالة system().
Update Zen C compiler to version 0.4.2 or later immediately. Implement input validation and sanitization for all command-line arguments, particularly the -o parameter. Replace system() calls with safer alternatives like execve() that do not invoke a shell. Apply principle of least privilege to compiler processes.
قم بتحديث مترجم Zen C إلى الإصدار 0.4.2 أو أحدث فوراً. قم بتطبيق التحقق من صحة المدخلات وتنظيفها لجميع معاملات سطر الأوامر، خاصة معامل -o. استبدل استدعاءات system() ببدائل أكثر أماناً مثل execve() التي لا تستدعي shell. طبق مبدأ أقل امتياز على عمليات المترجم.