{"id":"CVE-2026-44884","aliases":["CVE-2026-44884","GHSA-cqpq-2fgr-8mvc","GO-2026-5333"],"related":[],"kind":"vulnerability","state":"published","title":"Portainer: Missing authorization on custom template file endpoint exposes template content","summary":"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/custom_templates/{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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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/custom_templates/{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.","source":"cvelist"},{"lang":"en","text":"## Summary\nA missing authorization vulnerability in the Custom Template file endpoint (`GET /api/custom_templates/{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.\n\n## Severity\n\n**Medium**\n\n**CWE-862** — Missing Authorization\n\nExploitation requires an authenticated user account and at least one custom template to exist. Template files are returned verbatim and may contain embedded credentials.\n\n## Affected Versions\n\nThe vulnerability exists in every Portainer release since custom templates were introduced — the `customTemplateFile` handler has never performed an authorization check.\n\nFixes are included in the following releases:\n\n| Branch              | First vulnerable | Fixed in   |\n|---------------------|------------------|------------|\n| 2.33.x (LTS)        | 2.33.0           | **2.33.8** |\n| 2.39.x (LTS)        | 2.39.0           | **2.39.1** |\n\nPortainer 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.\n\n## Workarounds\n\nThere is no runtime configuration that blocks the vulnerable endpoint directly. Administrators who cannot immediately upgrade can reduce exposure by:\n\n- **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.\n- **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.\n\nNeither replaces the fix.\n\n## Affected Code\nThe `customTemplateFile` handler in `api/http/handler/customtemplates/customtemplate_file.go` (lines 30-53) retrieves a custom template by its numeric ID and returns the file content without performing any authorization check.\n\nAll other custom template endpoints properly verify access:\n\n| Endpoint | Method | Authorization Check |\n|----------|--------|-------------------|\n| `/api/custom_templates/{id}` | GET (inspect) | `userCanEditTemplate()` + `UserCanAccessResource()` |\n| `/api/custom_templates/{id}` | PUT (update) | `userCanEditTemplate()` |\n| `/api/custom_templates/{id}` | DELETE | `userCanEditTemplate()` |\n| `/api/custom_templates` | GET (list) | `FilterAuthorizedCustomTemplates()` |\n| **`/api/custom_templates/{id}/file`** | **GET** | **None** |\n\n**Vulnerable code** (`customtemplate_file.go:30-53`):\n```go\nfunc (handler *Handler) customTemplateFile(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {\n    customTemplateID, _ := request.RetrieveNumericRouteVariableValue(r, \"id\")\n    customTemplate, _ := handler.DataStore.CustomTemplate().Read(portainer.CustomTemplateID(customTemplateID))\n    // NO AUTHORIZATION CHECK\n    fileContent, _ := handler.FileService.GetFileContent(customTemplate.ProjectPath, entryPath)\n    return response.JSON(w, &fileResponse{FileContent: string(fileContent)})\n}\n```\n\n**Secure reference** (`customtemplate_inspect.go:50-75`):\n```go\ncanEdit := userCanEditTemplate(customTemplate, securityContext)\nhasAccess := authorization.UserCanAccessResource(securityContext.UserID, teamIDs, resourceControl)\nif !canEdit && !hasAccess {\n    return httperror.Forbidden(\"Access denied to resource\", httperrors.ErrResourceAccessDenied)\n}\n```\n\n## Impact\nAny 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.\n\n## Timeline\n\n- 2026-02-11: Reported via GitHub Security Advisory by **duddnr0615k**.\n- 2026-03-04: Fix merged to `develop` and cherry-picked to `release/2.39`.\n- 2026-03-19: 2.39.1 released with fix.\n- 2026-03-25: 2.40.0 released with fix already present from branch cut.\n- 2026-05-07: 2.33.8 released.\n\n## Credit\n\n- **duddnr0615k** — identified and reported the missing authorization check on the custom template file endpoint.","format":"markdown","source":"ghsa"},{"lang":"en","text":"Portainer missing authorization on custom template file endpoint, which exposes template content in github.com/portainer/portainer.\n\nNOTE: The source advisory for this report contains additional versions that could not be automatically mapped to standard Go module versions.\n\n(If this is causing false-positive reports from vulnerability scanners, please suggest an edit to the report.)\n\nThe additional affected modules and versions are: github.com/portainer/portainer from v2.33.0 before v2.33.8, from v2.39.0 before v2.39.1.","format":"markdown","source":"go"},{"lang":"es","text":"Portainer Community Edition es una plataforma ligera de entrega de servicios para aplicaciones contenerizadas que puede utilizarse para gestionar entornos Docker, Swarm, Kubernetes y ACI. Desde la versión 2.33.0 hasta antes de la 2.33.8 y la 2.39.1, una vulnerabilidad de autorización faltante en el endpoint de archivo de plantilla personalizada (GET /API/custom_templates/{id}/file) permite a cualquier usuario autenticado leer el contenido del archivo de cualquier plantilla personalizada enumerando IDs enteros secuenciales, eludiendo las restricciones de acceso de Resource Control. Los archivos de plantilla pueden contener valores específicos del entorno, como cadenas de conexión, tokens de API o credenciales de registro que los administradores no esperarían que los usuarios estándar leyeran. Esta vulnerabilidad está corregida en las versiones 2.33.8 y 2.39.1.","source":"nvd"}],"published":"2026-05-14T16:34:02.000Z","modified":"2026-07-21T10:10:00.103Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N","score":6,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N","score":6,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N","score":6.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N","rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N","score":6.5,"rating":"MEDIUM"}],"cwes":["CWE-862"],"affected":[{"ranges":[{"version":">= 2.33.0, < 2.33.8","status":"affected"},{"version":">= 2.39.0, < 2.39.1","status":"affected"}],"vendor":"portainer","product":"portainer","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"2.33.0","status":"affected","fixed":"2.33.8"}],"ecosystem":"Go","package":"github.com/portainer/portainer","purl":"pkg:golang/github.com/portainer/portainer","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"2.39.0","status":"affected","fixed":"2.39.1"}],"ecosystem":"Go","package":"github.com/portainer/portainer","purl":"pkg:golang/github.com/portainer/portainer","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected"}],"ecosystem":"Go","package":"github.com/portainer/portainer","purl":"pkg:golang/github.com/portainer/portainer","source":"go"},{"ranges":[{"status":"affected","introduced":"2.33.0","fixed":"2.33.8"},{"status":"affected","introduced":"2.39.0","fixed":"2.39.1"}],"vendor":"portainer","product":"portainer","cpe":"cpe:2.3:a:portainer:portainer:*:*:*:*:community:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/portainer/portainer/security/advisories/GHSA-cqpq-2fgr-8mvc","tags":["advisory","exploit","third-party-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-44884","tags":["advisory"],"sources":["ghsa","go"]},{"url":"https://github.com/portainer/portainer","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/portainer/portainer/releases/tag/2.33.8","tags":["web"],"sources":["ghsa","go"]},{"url":"https://github.com/portainer/portainer/releases/tag/2.39.2","tags":["web"],"sources":["ghsa","go"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-05-29T13:55:28.420Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-44884","url":"https://www.cve.org/CVERecord?id=CVE-2026-44884","licence":"CVE Terms of Use","modified":"2026-05-29T13:55:35.420Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-cqpq-2fgr-8mvc","url":"https://github.com/advisories/GHSA-cqpq-2fgr-8mvc","licence":"CC-BY-4.0","modified":"2026-06-25T19:56:37.031Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-5333","url":"https://pkg.go.dev/vuln/GO-2026-5333","licence":"CC-BY-4.0","modified":"2026-06-25T19:45:31.922Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-44884","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-44884","licence":"Public domain","modified":"2026-07-21T10:10:00.103Z"}],"updatedAt":"2026-11-25T22:59:23.238Z","epss":{"score":0.0022,"percentile":0.13359,"date":"2026-12-01T12:00:22.000Z"}}