Zerobyte: Stored XSS via SAML spMetadata on the Metadata Endpoint
An organization administrator stores a script in samlConfig.spMetadata.metadata; the metadata endpoint serves it without authentication on the application origin, where it runs in the session of every visitor.
Advisory ID: TP-2026-142
Product: Zerobyte (self-hosted backup management built on restic)
Vulnerability type: Stored cross-site scripting (CWE-79)
CVE: requested (GitHub CNA), assignment pending
CVSS 3.1: 8.1 (High) · CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:N
Vendor advisory: GHSA-89m7-gr88-x2wh
Affected versions: up to and including 0.43.2 (verified live: commit b3d6cc27)
Fixed in: 0.44.0
Reported: 29 October 2026
Summary
Zerobyte is a self-hosted backup management application built on restic, with organizations and single sign-on over OIDC and SAML. The field samlConfig.spMetadata.metadata of a SAML provider is stored verbatim and served verbatim by the endpoint GET /api/auth/sso/saml2/sp/metadata?providerId=<id>. The endpoint requires no authentication and answers on the application origin with Content-Type: application/xml and no Content-Security-Policy. A script element in the XHTML namespace therefore runs in the browser of every visitor who opens the URL. An organization administrator executes JavaScript in the session of users of other organizations and reads their session through same-origin requests.
Root cause
Line numbers refer to commit b3d6cc27. app/server/modules/sso/sso.integration.ts:192-197 registers four beforeMiddlewares, none of which inspects samlConfig.spMetadata; the identifier spMetadata does not occur in app/ or packages/.
Three of these middlewares act only when ctx.path === "/sso/register" (app/server/modules/sso/middlewares/authorize-registration.ts:7, app/server/modules/sso/middlewares/validate-provider-id.ts:6, app/server/modules/sso/middlewares/validate-registration-issuer.ts:6), the fourth only on /sign-in/sso (app/server/modules/sso/middlewares/validate-callback-urls.ts:23), where it validates other URL fields of the same body.
The value passes unchanged into the service provider of the SSO library, whose metadata endpoint returns it without a session check; app/server/modules/sso/sso.integration.ts:182-185 merely limits provider creation to organization administrators through providersLimit.
app/server/app.ts:89-111 forwards every request under /api/auth/* to the library with a deny list of three path prefixes, so POST /api/auth/sso/update-provider reaches the field without any Zerobyte middleware.
Zerobyte's own edit route, by contrast, rejects samlConfig through the updateSsoProviderBody schema with .partial().strict() (app/lib/sso-configuration.ts:8-17).
Proof of Concept
POST /api/auth/sso/register HTTP/1.1
Content-Type: application/json
{"providerId":"<id>", ..., "samlConfig":{..., "spMetadata":{"metadata":"<EntityDescriptor ...><html:script xmlns:html=\"http://www.w3.org/1999/xhtml\">window.fired=1; fetch(\"/api/auth/get-session\",{credentials:\"include\"}).then(...)</html:script></EntityDescriptor>"}}}
HTTP/1.1 200 OK
GET /api/auth/sso/saml2/sp/metadata?providerId=<id> HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/xml
X-Content-Type-Options: nosniff
<html:script xmlns:html="http://www.w3.org/1999/xhtml">window.fired=1; ...</html:script>
The attacker sends the first request as the owner of their own organization; the second needs no cookie and no Authorization header. Verified on commit b3d6cc27 in Docker with the default configuration: Chrome 152 executes the script on the application origin (document.contentType is application/xml), and the script reads the /api/auth/get-session response of a logged-in victim from a different organization. A provider without spMetadata returns generated XML with no script element, as the control.
Impact
- Session token theft from every visitor who opens the link, including users of other organizations.
- Same-origin requests as the victim: reading and changing repositories, volumes and backup configuration.
- The victim needs no account in the attacker's organization, and the endpoint requires no authentication.
- Through
POST /api/auth/sso/update-providerorganization administrators already reach the field, while registering a provider requires owner rights.
References
Is Something Like This in Your Software?
Our team found this vulnerability during its work. Have your applications tested by the same specialists, with a penetration test from turingpoint.
