{"id":"CVE-2025-1686","aliases":["CVE-2025-1686","GHSA-p75g-cxfj-7wrx"],"related":["CVE-2025-27137"],"kind":"vulnerability","state":"published","title":"Pebble has Arbitrary Local File Inclusion (LFI) Vulnerability via `include` macro","summary":"Versions of the package io.pebbletemplates:pebble from 0 and before 4.1.0 are vulnerable to External Control of File Name or Path via the include tag. A high privileged attacker can access sensitive local files by crafting malicious notification templates that leverage this tag to include files like /etc/passwd or /proc/1/environ.\n\n Workaround\n\nThis vulnerability can be mitigated by disabling the include macro in Pebble Templates:\n\njava\nnew PebbleEngine.Builder()\n            .registerExtensionCustomizer(new DisallowExtensionCustomizerBuilder()\n                    .disallowedTokenParserTags(List.of(\"include\"))\n                    .build())\n            .build();","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Versions of the package io.pebbletemplates:pebble from 0 and before 4.1.0 are vulnerable to External Control of File Name or Path via the include tag. A high privileged attacker can access sensitive local files by crafting malicious notification templates that leverage this tag to include files like /etc/passwd or /proc/1/environ.\n\n Workaround\n\nThis vulnerability can be mitigated by disabling the include macro in Pebble Templates:\n\njava\nnew PebbleEngine.Builder()\n            .registerExtensionCustomizer(new DisallowExtensionCustomizerBuilder()\n                    .disallowedTokenParserTags(List.of(\"include\"))\n                    .build())\n            .build();","source":"cvelist"},{"lang":"en","text":"### Summary\n\nIf untrusted user input is used to dynamically create a `PebbleTemplate` with the method `PebbleEngine#getLiteralTemplate`, then an attacker can include arbitrary local files from the file system into the generated template, leaking potentially sensitive information into the output of `PebbleTemplate#evaluate`. This is done via the `include` macro.\n\n### Details\n\nThe `include` macro calls `PebbleTempateImpl#resolveRelativePath` with the `relativePath` argument passed within the template:\n\nExample template:\n```\n{% include [relativePath] %}\n```\nWhen `resolveRelativePath` is called, the `relativePath`  is resolved against the `PebbleTemplateImpl.name` variable.\n\n```java\n  /**\n   * This method resolves the given relative path based on this template file path.\n   *\n   * @param relativePath the path which should be resolved.\n   * @return the resolved path.\n   */\n  public String resolveRelativePath(String relativePath) {\n    String resolved = this.engine.getLoader().resolveRelativePath(relativePath, this.name);\n    if (resolved == null) {\n      return relativePath;\n    } else {\n      return resolved;\n    }\n  }\n```\nhttps://github.com/PebbleTemplates/pebble/blob/82ad7fcf9e9eaa45ee82ae3335a1409d19c10263/pebble/src/main/java/io/pebbletemplates/pebble/template/PebbleTemplateImpl.java#L380\n\nUnfortunately, when the template is created from a string, as is the case when `PebbleEngine#getLiteralTemplate` is used, the `PebbleTemplateImpl.name` variable is actually the entirety of the contents of the template, not a filename as the logic expects. The net result is that the `relativePath` is resolved against the system root directory. As a result, files accessible from the root directory of the filesystem can be included into a template. \n\n### PoC\n\nThe following test demonstrates the vulnerability:\n\n```java\nPebbleEngine e = new PebbleEngine.Builder().build();\n\nString templateString = \"\"\"\n        {% include '/etc/passwd' %}\n        \"\"\";\nPebbleTemplate template = e.getLiteralTemplate(templateString);\n\ntry (final Writer writer = new StringWriter()) {\n    template.evaluate(writer, new HashMap<>());\n    System.out.println(writer);\n}\n```\n\nAs an attacker, the following malicious template demonstrates the vulnerability:\n\n```\n{% include '/etc/passwd' %}\n```\n\n### Impact\n\nThis is an arbitrary  Local File Inclusion (LFI) vulnerability. It can allow attackers to exfiltrate the contents of the local filesystem, including sensitive files into `PebbleTemplate` output. This can also be used to access the `/proc` filesystem which can give an attacker access to environment variables.\n\n### Fix\n\nThere exists no published fix for this vulnerability. The best way to mitigate this vulnerability is to disable the `include` macro in Pebble Templates.\n\nThe following can safeguard your application from this vulnerability:\n\n```java\nnew PebbleEngine.Builder()\n            .registerExtensionCustomizer(new DisallowExtensionCustomizerBuilder()\n                    .disallowedTokenParserTags(List.of(\"include\"))\n                    .build())\n            .build();\n```\n\n### Report Timeline\n\nVulnerability was reported under the Open Source Security Foundation (OpenSSF) [Model Outbound Vulnerability Disclosure Policy: Version 0.1](https://openssf.org/about/vulnerability-disclosure-policy/).\n\n - [Jul 15, 2024](https://github.com/PebbleTemplates/pebble/issues/680#issue-2409727829) Maintainer Contacted to enable private vulnerability reporting\n - [Jul 18, 2024](https://github.com/PebbleTemplates/pebble/issues/680#issuecomment-2236970984) I opened a GHSA \n to report this vulnerability to the maintainer https://github.com/PebbleTemplates/pebble/security/advisories/GHSA-7c6h-hmf9-7wj7 (private link)\n - Jul 29, 2024 GHSA updated to ping maintainer about vulnerability, no response\n - Oct 1, 2024 GHSA updated to ping maintainer about vulnerability, no response\n - Nov 15, 2024 GHSA updated to inform maintainer that disclosure timeline had lapsed, no response.\n - Feb 19, 2025 GHSA updated to inform maintainer that disclosure would occur imminently, no response.\n - Feb 24, 2025 this GHSA was created to disclose this vulnerability **without a patch available**.\n\nFor further discussion, see this issue: https://github.com/PebbleTemplates/pebble/issues/688\n\n### Credit\n\nThis vulnerability was discovered by @JLLeitschuh while at [Chainguard Labs](https://www.chainguard.dev). Jonathan is currently independent.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Todas las versiones del paquete io.pebbletemplates:pebble son vulnerables al control externo del nombre o la ruta de archivo a través de la etiqueta include. Un atacante con privilegios elevados puede acceder a archivos locales confidenciales mediante la manipulación de plantillas de notificación maliciosas que aprovechen esta etiqueta para incluir archivos como /etc/passwd o /proc/1/environ. Solución alternativa Esta vulnerabilidad se puede mitigar deshabilitando la macro include en las plantillas Pebble: java new PebbleEngine.Builder() .registerExtensionCustomizer(new DisallowExtensionCustomizerBuilder() .disallowedTokenParserTags(List.of(\"include\")) .build()) .build();","source":"nvd"}],"published":"2025-02-27T05:00:05.848Z","modified":"2026-09-10T03:50:22.817Z","severity":{"scorer":"snyk","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:N/VI:N/VA:N/SC:H/SI:N/SA:N/E:P","score":6.1,"rating":"MEDIUM"},"severities":[{"scorer":"snyk","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:N/VI:N/VA:N/SC:H/SI:N/SA:N/E:P","score":6.1,"rating":"MEDIUM"},{"scorer":"snyk","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:N/A:N/E:P","score":6.8,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:N/A:N","score":6.8,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:N/VI:H/VA:H/SC:L/SI:N/SA:N","rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:N/A:N","score":4.9,"rating":"MEDIUM"}],"cwes":["CWE-73"],"affected":[{"ranges":[{"type":"semver","introduced":"0","fixed":"4.1.0","status":"affected"}],"product":"io.pebbletemplates:pebble","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","lastAffected":"3.2.3"}],"ecosystem":"Maven","package":"io.pebbletemplates:pebble","purl":"pkg:maven/io.pebbletemplates/pebble","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"4.1.0"}],"vendor":"pebbletemplates","product":"pebble_templates","cpe":"cpe:2.3:a:pebbletemplates:pebble_templates:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://security.snyk.io/vuln/SNYK-JAVA-IOPEBBLETEMPLATES-8745594","tags":["exploit","third-party-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/PebbleTemplates/pebble/issues/680","tags":["issue-tracking","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://pebbletemplates.io/wiki/tag/include","tags":["product","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/PebbleTemplates/pebble/issues/688","tags":["issue-tracking","vendor-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/PebbleTemplates/pebble/commit/b3451c8f305a1a248fbcc2363fd307d0baaee329","tags":["patch","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/PebbleTemplates/pebble/pull/715","tags":["issue-tracking","patch","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/JLLeitschuh/security-research/security/advisories/GHSA-p75g-cxfj-7wrx","tags":["web"],"sources":["ghsa"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-1686","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/PebbleTemplates/pebble","tags":["package"],"sources":["ghsa"]}],"credits":["Jonathan Leitschuh"],"assigner":"snyk","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2025-02-27T14:44:07.532Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-1686","url":"https://www.cve.org/CVERecord?id=CVE-2025-1686","licence":"CVE Terms of Use","modified":"2026-04-19T07:54:57.303Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-p75g-cxfj-7wrx","url":"https://github.com/advisories/GHSA-p75g-cxfj-7wrx","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:22.817Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-1686","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-1686","licence":"Public domain","modified":"2026-06-17T08:39:35.997Z"}],"updatedAt":"2026-11-25T22:58:54.574Z","epss":{"score":0.00847,"percentile":0.59189,"date":"2026-12-01T12:00:22.000Z"}}