CERT Recently Published Vulnerability Notes 2024年07月06日
VU#123335: Multiple programming languages fail to escape arguments properly in Microsoft Windows
index_new5.html
../../../zaker_core/zaker_tpl_static/wap/tpl_guoji1.html

 

多种编程语言在 Windows 环境中执行命令时存在命令注入漏洞。攻击者可以利用此漏洞将恶意代码伪装成命令参数,从而执行任意代码。此漏洞源于编程语言在处理命令参数时缺乏适当的验证和转义机制,导致 Windows 命令解释器错误地将参数解析为命令,从而引发漏洞。

💻 **缺乏验证和转义机制:** 许多编程语言在处理命令参数时缺乏适当的验证和转义机制,导致攻击者可以构造恶意参数,绕过安全检查并执行任意代码。

🛡️ **Windows 命令解释器:** Windows 命令解释器(cmd.exe)在处理命令参数时存在一些安全隐患,如果参数没有经过适当的转义,攻击者可以利用这些隐患执行恶意代码。

🆘 **影响范围广泛:** 此漏洞影响多种编程语言,包括 Go、PHP、Rust、Python、Node.js、Haskell 等。攻击者可以利用此漏洞攻击使用这些语言开发的应用程序,获取敏感信息或控制系统。

💪 **防御措施:** 开发人员需要仔细检查代码,确保在执行命令时对所有参数进行严格的验证和转义,以防止攻击者利用漏洞执行恶意代码。

📢 **厂商更新:** 相关厂商已发布安全更新,建议用户及时更新编程语言版本和相关组件,以修复漏洞。

⚠️ **手动转义:** 如果无法及时更新,用户需要手动对命令参数进行转义,以防止攻击者利用漏洞执行恶意代码。

Overview

Various programming languages lack proper validation mechanisms for commands and in some cases also fail to escape arguments correctly when invoking commands within a Microsoft Windows environment. The command injection vulnerability in these programming languages, when running on Windows, allows attackers to execute arbitrary code disguised as arguments to the command. This vulnerability may also affect the application that executes commands without specifying the file extension.

Description

Programming languages typically provide a way to execute commands (for e.g., os/exec in Golang) on the operating system to facilitate interaction with the OS. Typically, the programming languages also allow for passing arguments which are considered data (or variables) for the command to be executed. The arguments themselves are expected to be not executable and the command is expected to be executed along with properly escaped arguments, as inputs to the command. Microsoft Windows typically processes these commands using a CreateProcess function that spawns a cmd.exe for execution of the command. Microsoft Windows has documented some of the concerns related to how these should be properly escaped before execution as early as 2011. See https://learn.microsoft.com/en-us/archive/blogs/twistylittlepassagesallalike/everyone-quotes-command-line-arguments-the-wrong-way.

A vulnerability was discovered in the way multiple programming languages fail to properly escape the arguments in a Microsoft Windows command execution environment. This can lead confusion at execution time where an expected argument for a command could be executed as another command itself. An attacker with knowledge of the programming language can carefully craft inputs that will be processed by the compiled program as commands. This unexpected behavior is due to lack of neutralization of arguments by the programming language (or its command execution module) that initiates a Windows execution environment. The researcher has found multiple programming languages, and their command execution modules fail to perform such sanitization and/or validation before processing these in their runtime environment.

Impact

Successful exploitation of this vulnerability permits an attacker to execute arbitrary commands. The complete impact of this vulnerability depends on the implementation that uses a vulnerable programming language or such a vulnerable module.

Solution

Updating the runtime environment

Please visit the Vendor Information section so see if your programming language Vendor has released the patch for this vulnerability and update the runtime environment that can prevent abuse of this vulnerability.

Update the programs and escape manually

If the runtime of your application doesn't provide a patch for this vulnerability and you want to execute batch files with user-controlled arguments, you will need to perform the escaping and neutralization of the data to prevent any intended command execution.

Security researcher has more detailed information in the blog post which provides details on specific languages that were identified and their Status.

Acknowledgements

Thanks to the reporter, RyotaK.This document was written by Timur Snoke.

Vendor Information

One or more vendors are listed for this advisory. Please reference the full report for more information.

Other Information

CVE IDs: CVE-2024-3566 CVE-2024-22423 CVE-2024-24576 CVE-2024-1874
Date Public: 2024-04-10
Date First Published: 2024-04-10
Date Last Updated: 2024-05-13 13:18 UTC
Document Revision: 8

Fish AI Reader

Fish AI Reader

AI辅助创作,多种专业模板,深度分析,高质量内容生成。从观点提取到深度思考,FishAI为您提供全方位的创作支持。新版本引入自定义参数,让您的创作更加个性化和精准。

FishAI

FishAI

鱼阅,AI 时代的下一个智能信息助手,助你摆脱信息焦虑

联系邮箱 441953276@qq.com

相关标签

命令注入 漏洞 Windows 编程语言 安全
相关文章