DisclosurePaul White5 November 20267 min read

Unauthenticated remote code execution in LocalAI via external-backend install

On a default install, LocalAI installs an attacker-supplied backend from an OCI image with no authentication and no signature check, then runs its code as the server process. On the official container image that process is root.

LocalAI is a self-hosted, OpenAI-compatible inference server. On a default install it exposes an unauthenticated HTTP endpoint that installs an attacker-supplied “backend” from an OCI image, with no signature or provenance check, and then executes code from that backend as the server process. On the official container image that process runs as root. On a stock install this is unauthenticated remote code execution.

We reported this privately to the project’s published security contact on 9 July 2026, followed up on 20 August, and set a coordinated-disclosure date of 7 October. The vendor did not respond. There is no vendor advisory and no fix. We confirmed the vulnerable code is unchanged in the current release (v4.12.1), so this is neither late nor a duplicate. We are holding the working exploit, so there is no copy-paste payload here.

Two defaults

This is two defaults rather than one bug. Together they form a pre-authentication code-execution path.

The backend-install endpoint is unauthenticated on a default install. The route POST /api/backends/install-external is registered behind an admin middleware. That middleware is a no-op whenever no authentication is configured, which is the default state and the state of the official container image. So on a stock install the gate in front of the endpoint does nothing.

External backends install without integrity verification. The setting that would require a signature or checksum, RequireBackendIntegrity, defaults to false. An OCI backend with no verification policy is installed anyway; the server logs a warning (“installing OCI backend without signature verification”) and proceeds.

both defaults, in v4.12.1

// core/http/app.go — the admin gate is a no-op when no auth is configured
var adminMiddleware echo.MiddlewareFunc
if application.AuthDB() != nil {
    adminMiddleware = auth.RequireAdmin()
} else {
    adminMiddleware = auth.NoopMiddleware()   // the default install
}

// core/cli/run.go — external backends install without an integrity check by default
RequireBackendIntegrity bool `... default:"false"`

A LocalAI “backend” is a directory containing an executable run script that LocalAI launches as a child process. So an attacker who can install an arbitrary backend, with no credentials and no integrity check, can get LocalAI to run their code.

The chain

  • An unauthenticated client posts to /api/backends/install-external with an OCI image reference it controls. The server returns 200 and installs the backend. No credentials are needed on a default install.
  • The install proceeds with no signature or provenance check, becauseRequireBackendIntegrity is false by default. The server logs the warning and carries on.
  • The attacker loads a model bound to that backend, through the same unauthenticated surface, which starts the backend.
  • LocalAI makes the backend’s run script executable and runs it as a child process, with the privileges of the LocalAI process. On the official container image that is uid 0, so the payload runs as root.

We verified this end to end on the official image, default configuration, with no authentication: the unsigned OCI backend installed through LocalAI’s own extraction path, the signature-verification warning appeared, the install returned 200 with no credentials, and the backend’s run script executed as uid=0(root) when the backend started.

“But v4.9.0 added auth by default”

LocalAI v4.9.0 shipped a change titled “protect HTTP routes by default.” The title suggests this is fixed. It is not. The change makes the authentication middleware classify routes more safely when authentication is enabled: unknown routes require credentials instead of a fail-open path, which helps authenticated deployments. On a stock install it changes nothing, because a stock install has no API key and no auth database, so the middleware enforces nothing and the admin gate stays a no-op. The endpoint is still reachable with no credentials, before and after that change.

We confirmed this in source on v4.9.0 and again on v4.12.1, the latest release at the time of writing. The route is still behind the admin middleware, the admin middleware is still a no-op when no auth is configured, and RequireBackendIntegrity still defaults to false. The chain is intact in the current release.

There is a separate, real hardening change in the v4.x line: a start-up refusal when LocalAI would bind directly to a public address with no auth backend. That helps a bare-metal process bound to a public IP. It does not change this finding. The official container sees only its private container interface, so publishing the port does not trip that guard, and anything reached through a reverse proxy or from the local network is unaffected.

On the word “root”

Successful exploitation runs attacker code with the privileges of the LocalAI process. On the official container image that process runs as uid 0, so on that image this is unauthenticated remote root code execution. “root” is a property of the official image, not of every deployment. If you run LocalAI as a non-root user, the attacker’s code still executes, but with that user’s privileges instead. The authentication and integrity gaps are the vulnerability; the root level comes from the default image.

We score it CVSS 3.1 9.8 (Critical), CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H, with weaknesses CWE-306 (missing authentication for a critical function) and CWE-494 (download of code without integrity check). A CVE identifier has been requested from MITRE as a numbering authority of last resort, since the project is not itself a CNA and did not engage.

If you run LocalAI

Until there is a vendor fix:

  • Set an API key (or configure the auth database) so the admin surface, including the backend-install endpoints, requires authentication. On a default install it does not.
  • Set RequireBackendIntegrity to true so backends without a verification policy or checksum are rejected rather than installed with a warning.
  • Do not expose the LocalAI HTTP port to untrusted networks. Put it behind a reverse proxy that enforces authentication, or bind it to a trusted interface only. The service listens on all interfaces on port 8080 by default.
  • Consider running the container as a non-root user, so that even if the chain fires the payload does not run as root.

Disclosure

Reported privately on 9 July 2026 with a full write-up and a runnable proof of concept. Followed up on 20 August with a coordinated-disclosure date of 7 October, and an offer to move the report into a GitHub Security Advisory draft. That date passed with no response and no fix. The latest release, v4.12.1 on 23 October, left the vulnerable code unchanged. The project’s own policy states that reports are acknowledged within 48 hours and coordinated through an advisory; neither happened.

If you want to recompute the severity for your own deployment, our free CVSS calculator scores 3.1 and 4.0 from the base metrics. How we approach coordinated disclosure is on our disclosure page.

← All posts