
Claude, a new AI assistant, helped discover flaws in the popular text editors Vim and GNU Emacs. These flaws allow attackers to remotely execute code just by having a user open a malicious file.
The AI was able to create and improve working exploit code and even suggest fixes for the problems.
Vim and GNU Emacs are highly customizable text editors favored by programmers and system administrators for tasks like coding, working in terminals, and scripting. Vim is particularly common in DevOps environments and comes pre-installed on many Linux servers, embedded systems, and macOS machines.
Hung Nguyen, a researcher at Calif (a cybersecurity firm specializing in AI red teaming and security), discovered the Vim issues by asking Claude to find a zero-day remote code execution (RCE) vulnerability triggered by opening a file.
Claude analyzed the source code of Vim and found missing security checks and vulnerabilities related to how Vim handles “modelines,” leading to code execution upon file opening.
A modeline is a line of text at the top of a file that gives instructions to Vim on how to handle the file.
Even when code was supposed to be confined to a secure “sandbox,” another bug allowed it to bypass the sandbox and execute commands as the current user.
This vulnerability does not yet have a CVE ID and affects all Vim versions up to and including 9.2.0271.
Nguyen notified the Vim developers, who quickly released a fix in Vim version 9.2.0272. The Vim team emphasized that simply opening a specially crafted file would trigger the vulnerability.
“An attacker who can get a malicious file to a user can run arbitrary commands with the same permissions as the user running Vim,” the security advisory states.
In the case of GNU Emacs, the vulnerability is still present because the developers believe it is Git’s responsibility to fix.
The problem lies in GNU Emacs’ integration with Git for version control (vc-git). When a file is opened, it triggers Git operations via vc-refresh-state. This causes Git to read the .git/config file and run a user-defined program specified by core.fsmonitor, which can be exploited to run any command.
The attack involves creating an archive (like an email attachment or a file on a shared drive) that contains a hidden .git folder. Inside this folder is a config file that tells Git to run a specific script.
When the victim extracts the archive and opens the text file, the malicious script is automatically executed without any obvious warning signs in the default GNU Emacs configuration.
The GNU Emacs developers argue that the issue is with Git, not Emacs, because Emacs is only the trigger for the dangerous action performed by Git, which includes reading the attacker’s config file and executing a program specified within it.
While technically accurate, this view overlooks the user risk. GNU Emacs automatically runs Git on untrusted directories without blocking dangerous Git options, requiring user confirmation, or providing sandbox protection.
Nguyen suggests that GNU Emacs could modify its Git calls to specifically disable ‘core.fsmonitor’ to prevent arbitrary scripts from running automatically when a file is opened.
Because the vulnerability has not been fixed in the latest GNU Emacs, users should be extra careful when opening files from unknown sources or downloaded from the internet.
#claude #code #discovers #execution #exploit #file #flaws #news #opening #rce #remote #triggers #vim/emacs; — News
© Bulletproof Servers. All rights reserved.