CVE-2026-44884: Portainer: Missing authorization on custom template file endpoint exposes template content
Summary A missing authorization vulnerability in the Custom Template file endpoint (GET /api/customtemplates/{id}/file) allows any authenticated user to read the file content of any custom template by enumerating sequential integer IDs, bypassing Resource Control access restrictions. Template files may contain environment-specific values such as connection strings, API tokens, or registry credentials that administrators would not expect standard users to read.
Severity
Medium
CWE-862 — Missing Authorization
Exploitation requires an authenticated user account and at least one custom template to exist. Template files are returned verbatim and may contain embedded credentials.
Affected Versions
The vulnerability exists in every Portainer release since custom templates were introduced — the customTemplateFile handler has never performed an authorization check.
Fixes are included in the following releases:
| Branch | First vulnerable | Fixed in | |---------------------|------------------|------------| | 2.33.x (LTS) | 2.33.0 | 2.33.8 | | 2.39.x (LTS) | 2.39.0 | 2.39.1 |
Portainer 2.40.0 and later are not affected — the fix was already on develop when the 2.40.x STS line branched. Portainer LTS branches receive fixes for 6 months plus a 3-month overlap after the next LTS ships. All releases prior to 2.33.0 are end-of-life and will not receive a fix; users on EOL versions should upgrade to a supported release.
Workarounds
There is no runtime configuration that blocks the vulnerable endpoint directly. Administrators who cannot immediately upgrade can reduce exposure by:
- Avoiding storing secrets in custom templates until the patched release is deployed. Move sensitive configuration values to Portainer environment variables or an external secret store. - Reviewing existing custom templates for embedded secrets. Assume any secret previously stored in a custom template on an unpatched instance has been exposed to every authenticated user and rotate accordingly.
Neither replaces the fix.
Affected Code The customTemplateFile handler in api/http/handler/customtemplates/customtemplatefile.go (lines 30-53) retrieves a custom template by its numeric ID and returns the file content without performing any authorization check.
All other custom template endpoints properly verify access:
| Endpoint | Method | Authorization Check | |----------|--------|-------------------| | /api/customtemplates/{id} | GET (inspect) | userCanEditTemplate() + UserCanAccessResource() | | /api/customtemplates/{id} | PUT (update) | userCanEditTemplate() | | /api/customtemplates/{id} | DELETE | userCanEditTemplate() | | /api/customtemplates | GET (list) | FilterAuthorizedCustomTemplates() | | /api/customtemplates/{id}/file | GET | None |
Vulnerable code (customtemplatefile.go:30-53): go func (handler Handler) customTemplateFile(w http.ResponseWriter, r http.Request) httperror.HandlerError { customTemplateID, := request.RetrieveNumericRouteVariableValue(r, "id") customTemplate, := handler.DataStore.CustomTemplate().Read(portainer.CustomTemplateID(customTemplateID)) // NO AUTHORIZATION CHECK fileContent, := handler.FileService.GetFileContent(customTemplate.ProjectPath, entryPath) return response.JSON(w, &fileResponse{FileContent: string(fileContent)}) }
Secure reference (customtemplateinspect.go:50-75): go canEdit := userCanEditTemplate(customTemplate, securityContext) hasAccess := authorization.UserCanAccessResource(securityContext.UserID, teamIDs, resourceControl) if !canEdit && !hasAccess { return httperror.Forbidden("Access denied to resource", httperrors.ErrResourceAccessDenied) }
Impact Any authenticated user (including the lowest-privilege standard user) can read the file content of every custom template in the instance. Custom templates commonly contain Docker Compose configuration, which may include environment-specific secrets such as database connection strings, API tokens, or registry credentials.
Timeline
- 2026-02-11: Reported via GitHub Security Advisory by duddnr0615k. - 2026-03-04: Fix merged to develop and cherry-picked to release/2.39. - 2026-03-19: 2.39.1 released with fix. - 2026-03-25: 2.40.0 released with fix already present from branch cut. - 2026-05-07: 2.33.8 released.
Credit
- duddnr0615k — identified and reported the missing authorization check on the custom template file endpoint.
Other sources
Portainer Community Edition is a lightweight service delivery platform for containerized applications that can be used to manage Docker, Swarm, Kubernetes and ACI environments. From 2.33.0 to before 2.33.8 and 2.39.1, a missing authorization vulnerability in the Custom Template file endpoint (GET /api/customtemplates/{id}/file) allows any authenticated user to read the file content of any custom template by enumerating sequential integer IDs, bypassing Resource Control access restrictions. Template files may contain environment-specific values such as connection strings, API tokens, or registry credentials that administrators would not expect standard users to read. This vulnerability is fixed in 2.33.8 and 2.39.1.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
go/github.com/portainer/portainerto a version that resolves this vulnerability.Fixed in 2.39.1 - Upgrade
Upgrade
go/github.com/portainer/portainerto a version that resolves this vulnerability.Fixed in 2.33.8 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 2.33.8 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 2.39.1 - Configuration
Move sensitive configuration values out of custom template file contents and into Portainer environment variables or an external secret store. This does not replace applying the fix, but reduces exposure from any template content read.
Portainer Move sensitive configuration values = Portainer environment variables or an external secret store - Compensating control
If you cannot immediately upgrade, reduce exposure by minimizing/limiting authenticated access to the custom template file endpoint’s underlying data—note that any authenticated user can read file contents by enumerating sequential integer template IDs, and there is no runtime configuration that blocks the vulnerable endpoint directly.
- Operational
Review existing custom templates for embedded secrets (e.g., Docker Compose env vars, connection strings, API tokens, registry credentials). Assume any secret previously stored in a custom template on an unpatched instance has been exposed to every authenticated user and rotate accordingly.
Event History
Frequently Asked Questions
What is the severity of CVE-2026-44884?
CVE-2026-44884 is considered a critical severity vulnerability due to its potential impact on unauthorized data access.
How do I fix CVE-2026-44884?
To mitigate CVE-2026-44884, upgrade to Portainer version 2.39.2 or 2.33.8 to address the missing authorization vulnerability.
Who is affected by CVE-2026-44884?
CVE-2026-44884 affects authenticated users of Portainer versions prior to 2.39.2 and 2.33.8.
What kind of data can be accessed due to CVE-2026-44884?
Due to CVE-2026-44884, attackers may access the file content of any custom template by enumerating template IDs.
Is there a workaround for CVE-2026-44884 until I can update?
Currently, there are no effective workarounds, and it is recommended to update to a secured version as soon as possible.