CVE-2025-1691 MongoDB Shell may be susceptible to Control Character Injection via autocomplete
An attacker controlling a MongoDB cluster can inject malicious commands via autocomplete, leading to code execution when users trigger tab completion.
- Exploited in the wild
- Not known
- Login needed
- An administrator
- Attackable
- Over the internet
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is CVE-2025-1691?
CVE-2025-1691 is a high-severity command injection vulnerability in MongoDB Inc mongosh, published on 27 Feb 2025. An attacker needs administrator access to exploit it, and only if a user opens a file or follows a link.
Official description
The MongoDB Shell may be susceptible to control character injection where an attacker with control of the mongosh autocomplete feature, can use the autocompletion feature to input and run obfuscated malicious text. This requires user interaction in the form of the user using ‘tab’ to autocomplete text that is a prefix of the attacker’s prepared autocompletion. This issue affects mongosh versions prior to 2.3.9.
The vulnerability is exploitable only when mongosh is connected to a cluster that is partially or fully controlled by an attacker.
Weakness: CWE-74
Which versions are affected by CVE-2025-1691?
2 open source packages ship an affected version, including mongosh. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
mongosh npm | All versions | 2.3.9 |
mongosh npm | All versions | 2.3.9 |
Products include Mongodb Mongosh.
How do I fix CVE-2025-1691?
Upgrade mongosh to 2.3.9 or later.
Upgrade, and pass arguments to programs as a list instead of through a shell. More about Command injection.
Is CVE-2025-1691 being exploited?
There is no known exploitation of CVE-2025-1691 in the wild and no public exploit code.
Other vulnerabilities in MongoDB Inc mongosh
Sources
Also known as GHSA-43g5-2wr2-q7vj.