BatBadBut: Rust Library Bug Puts Windows Systems at Risk of Command Injection

by | Apr 10, 2024 | News




Join our Patreon Channel and Gain access to 70+ Exclusive Walkthrough Videos.

Patreon
Reading Time: 3 Minutes

Critical Vulnerability in Rust Library Enables Command Injection on Windows

A critical security vulnerability in the Rust standard library (CVE-2024-24576) has been identified, posing a significant threat to Windows systems by enabling command injection attacks.

This flaw, rated as critical by GitHub with a CVSS base score of 10/10, stems from weaknesses in OS command and argument handling. Attackers can exploit this vulnerability remotely and execute unexpected and potentially malicious commands without user interaction.

According to the Rust Security Response Working Group, the issue arises from improper argument escaping when invoking batch files (with the bat and cmd extensions) on Windows using the Command API. By controlling the arguments passed to the spawned process, attackers can execute arbitrary shell commands by bypassing escaping mechanisms.

 

See Also: So, you want to be a hacker?
Offensive Security, Bug Bounty Courses




Discover your weakest link. Be proactive, not reactive. Cybercriminals need just one flaw to strike.

The impact of this vulnerability is critical for programs invoking batch files on Windows with untrusted arguments. Rust versions before 1.77.2 on Windows are affected if a program’s code or dependencies execute batch files with untrusted inputs.

The Rust security team faced challenges due to the complexity of cmd.exe, leading to improvements in escaping code and modifications to the Command API to mitigate the risk of command injection.




Engineer Ryotak, who discovered the flaw (dubbed BatBadBut), noted that similar vulnerabilities affect other programming languages such as Erlang, Go, Haskell, Java, Node.js, PHP, Python, and Ruby. While some languages have released patches or documentation updates, others remain vulnerable.

To mitigate this risk, Ryotak advises moving batch files to directories not included in the PATH environment variable to prevent unexpected execution.

This vulnerability underscores the importance of adopting memory-safe programming languages like Rust, aligning with initiatives such as the White House’s recommendation to enhance software security by minimizing memory safety vulnerabilities. Vigilance and prompt updates are crucial to safeguarding against command injection threats on Windows systems.

Are u a security researcher? Or a company that writes articles about Cyber Security, Offensive Security (related to information security in general) that match with our specific audience and is worth sharing? If you want to express your idea in an article contact us here for a quote: [email protected]

Source: bleepingcomputer.com

Source Link

Merch

Recent News

Offensive Security & Ethical Hacking Course

Begin the learning curve of hacking now!


Information Security Solutions

Find out how Pentesting Services can help you.


Join our Community

Share This