AgentbeamBeta
AI agent vulnerability · LocalAI

CVE-2024-9900: LocalAI Cross-Site Scripting (XSS) vulnerability in its search functionality

mediumCVSS 3.0 5.4GHSA-w6hh-w36c-vxmw

LocalAI before 2.22.0 has a cross-site scripting flaw in its web UI search, caused by unsanitized user input. A victim who opens a crafted link runs the attacker's JavaScript in the LocalAI page. Upgrade github.com/mudler/LocalAI to 2.22.0 or later.

Published Mar 20, 2025 · Updated Apr 4, 2025 · Analysis Nov 10, 2026

What an attacker can do

The search function of the built-in web UI writes user text into the page without neutralizing it (CWE-79). An attacker builds a link or form submission carrying a script in the search value. When a user of the LocalAI web interface opens it, the script runs in that origin, in the user's browser. The advisory lists stealing session cookies, redirecting the user and changing the page as outcomes.

The attacker needs no account but needs the victim to follow the link, which matches the user-interaction flag in the CVSS vector. The rating is medium (5.4), with low confidentiality and integrity impact. The upstream fix, PR 3794, applies the bluemonday strict sanitizer to text rendered in the gallery, model list, error messages and the 403 handler in auth.go. LocalAI instances without strong login often hold nothing in the session, so the main prize is whatever the UI lets the victim do, such as installing models from the gallery.

Who is affected

LocalAI below 2.22.0. The report was filed against v2.21.1. Check:

go list -m github.com/mudler/LocalAI
local-ai --version

For container installs, read the image tag. Only instances that serve the web UI to users are relevant.

github.com/mudler/LocalAI

Ecosystem
Go
Affected
< 2.22.0
Fixed in
2.22.0
Check
go list -m github.com/mudler/LocalAI

How to fix it

Upgrade to LocalAI 2.22.0 or later. The fix commit a1634b2 sanitizes untrusted text with bluemonday.StrictPolicy() in core/http/elements/gallery.go, the OpenAI assistant and file error responses, the auth 403 response and core/http/routes/ui.go. The sources list no workaround. Until you upgrade, do not click search links from untrusted sources and keep the UI off public networks.

How to tell if you were hit

Search access logs for requests to the UI search route with a query containing angle brackets, script, onerror, javascript: or URL-encoded forms of them (%3Cscript). Check referrers for unfamiliar sites linking into your LocalAI UI.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

mudler/localai version v2.21.1 contains a Cross-Site Scripting (XSS) vulnerability in its search functionality. The vulnerability arises due to improper sanitization of user input, allowing the injection and execution of arbitrary JavaScript code. This can lead to the execution of malicious scripts in the context of the victim's browser, potentially compromising user sessions, stealing session cookies, redirecting users to malicious websites, or manipulating the DOM.

Questions

Which LocalAI version fixes CVE-2024-9900?

2.22.0. Versions below it are affected, and the report was made against v2.21.1.

Does the attacker need to log in?

No, but a victim must open the crafted link, so user interaction is required.

How serious is it?

Medium, CVSS 3.0 score 5.4, with low confidentiality and integrity impact.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More LocalAI vulnerabilities

All LocalAI entries