CVE-2024-3033 (published 2024-06-06T18:15Z)

An improper authorization vulnerability exists in the mintplex-labs/anything-llm application, specifically within the '/api/v/' endpoint and its sub-routes. This flaw allows unauthenticated users to perform destructive actions on the VectorDB, including resetting the database and deleting specific namespaces, without requiring any authorization or permissions. The issue affects all versions up to and including the latest version, with a fix introduced in version 1.0.0. Exploitation of this vulnerability can lead to complete data loss of document embeddings across all workspaces, rendering workspace chats and embeddable chat widgets non-functional. Additionally, attackers can list all namespaces, potentially exposing private workspace names.


Weakness information:
cwe_id: CWE-285
cwe_name: Improper Authorization
description: The product does not perform or incorrectly performs an authorization check when an actor attempts to access a resource or perform an action.
extended_description: 
            Assuming a user with a given identity, authorization is the process of determining whether that user can access a given resource, based on the user's privileges and any permissions or other access-control specifications that apply to the resource.
            When access control checks are not applied consistently - or not at all - users are able to access data or perform actions that they should not be allowed to perform. This can lead to a wide range of problems, including information exposures, denial of service, and arbitrary code execution.
         
         

Fix information:
repo_url: https://github.com/mintplex-labs/anything-llm
commit_details: repo_url: https://github.com/mintplex-labs/anything-llm
author: timothycarambat
author_date: 2024-03-27 13:19:28-07:00
msg: move vector db debug endpoint to dev only
repository: repo_url: https://github.com/mintplex-labs/anything-llm
repo_name: Mintplex-Labs/anything-llm
description: The all-in-one Desktop & Docker AI application with full RAG and AI Agent capabilities.
repo_language: JavaScript
owner: mintplex-labs
file_changes: filename: index.js
change_type: ModificationType.MODIFY
diff: @@ -51,34 +51,6 @@ developerEndpoints(app, apiRouter);
 // Externally facing embedder endpoints
 embeddedEndpoints(apiRouter);
 
-apiRouter.post("/v/:command", async (request, response) => {
-  try {
-    const VectorDb = getVectorDbClass();
-    const { command } = request.params;
-    if (!Object.getOwnPropertyNames(VectorDb).includes(command)) {
-      response.status(500).json({
-        message: "invalid interface command",
-        commands: Object.getOwnPropertyNames(VectorDb),
-      });
-      return;
-    }
-
-    try {
-      const body = reqBody(request);
-      const resBody = await VectorDb[command](body);
-      response.status(200).json({ ...resBody });
-    } catch (e) {
-      // console.error(e)
-      console.error(JSON.stringify(e));
-      response.status(500).json({ error: e.message });
-    }
-    return;
-  } catch (e) {
-    console.log(e.message, e);
-    response.sendStatus(500).end();
-  }
-});
-
 if (process.env.NODE_ENV !== "development") {
   app.use(
     express.static(path.resolve(__dirname, "public"), { extensions: ["js"] })
@@ -92,6 +64,35 @@ if (process.env.NODE_ENV !== "development") {
     response.type("text/plain");
     response.send("User-agent: *\nDisallow: /").end();
   });
+} else {
+  // Debug route for development connections to vectorDBs
+  apiRouter.post("/v/:command", async (request, response) => {
+    try {
+      const VectorDb = getVectorDbClass();
+      const { command } = request.params;
+      if (!Object.getOwnPropertyNames(VectorDb).includes(command)) {
+        response.status(500).json({
+          message: "invalid interface command",
+          commands: Object.getOwnPropertyNames(VectorDb),
+        });
+        return;
+      }
+
+      try {
+        const body = reqBody(request);
+        const resBody = await VectorDb[command](body);
+        response.status(200).json({ ...resBody });
+      } catch (e) {
+        // console.error(e)
+        console.error(JSON.stringify(e));
+        response.status(500).json({ error: e.message });
+      }
+      return;
+    } catch (e) {
+      console.log(e.message, e);
+      response.sendStatus(500).end();
+    }
+  });
 }
 
 app.all("*", function (_, response) {

programming_language: TypeScript