CVE-2025-49136: Github.com/knadh/listmonk Listmonk's Sprig Template Injection Vulnerability Vulnerability

CRITICAL
Advisory Identifier: GHSA-jc7g-x28f-3v3h
CVSS 9.0
CWE-1336
Published
Advisory Summary

CVE-2025-49136 is a CRITICAL (CVSS 9.0) listmonk's sprig template injection vulnerability vulnerability (CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine) affecting Github.com/knadh/listmonk libraries in the Go ecosystem. The issue involves listmonk's sprig template injection vulnerability leads to reading of environment variable for low privilege user. Remediation is available by upgrading affected packages to version 5.0.2.

CVE-2025-49136 at a Glance

CVE Identifier CVE-2025-49136
GHSA Identifier GHSA-jc7g-x28f-3v3h
Severity CRITICAL
CVSS v3.1 Base Score 9.0
CWE Classification CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine
Affected Product Github.com/knadh/listmonk
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 9.0

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2025-49136

To remediate this vulnerability, upgrade all affected Github.com/knadh/listmonk dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/knadh/listmonk fixed: 5.0.2
Upgrade github.com/knadh/listmonk to 5.0.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/knadh/listmonk

How to Check if You Are Affected

To determine whether your application is affected by CVE-2025-49136, inspect your project dependencies for Github.com/knadh/listmonk:

inspect dependencies for github.com/knadh/listmonk

Analyze the terminal output to locate any version of Github.com/knadh/listmonk in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.0.2), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine, where the product uses a template engine to insert or process externally-influenced input, but it does not neutralize or incorrectly neutralizes special elements or syntax that can be interpreted as template expressions or other code directives when processed by the engine. In Github.com/knadh/listmonk, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary The `env` and `expandenv` template functions which is enabled by default in [Sprig](https://masterminds.github.io/sprig/) enables capturing of env variables on the host. While this may not be a problem on single-user (super admin) installations, on multi-user installations, this allows non-super-admin users with campaign or template permissions to use the `{{ env }}` template expression to capture sensitive environment variables. **Upgrade to [v5.0.2](https://github.com/knadh/listmonk/releases/tag/v5.0.2)** to mitigate. --------- # Demonstration ### Description A critical template injection vulnerability exists in Listmonk's campaign preview functionality that allows authenticated users with minimal privileges (campaigns:get & campaigns:get_all) to extract sensitive system data, including database credentials, SMTP passwords, and admin credentials due to some dangerous function being allowed. ### Proof of Concept - Create a user and give him `campaigns:get` and `campaigns:get_all` privileges ![image](https://github.com/user-attachments/assets/05333695-14d9-498e-9f73-2137d6eca55b) - Now login with that user, go to any campaign, go the Content section and here lies the vulnerability, we're able to execute template content which allows us to get environment variables, execute Sprig functions... - Now in the text field you can input the following and press Preview: ``` {{ env "AWS_KEY" }} {{ env "LISTMONK_db__user" }} {{ env "LISTMONK_db__password" }} ```` ![image](https://github.com/user-attachments/assets/ac963f54-5982-47d4-99d0-59030917f548) # Preview: ![image](https://github.com/user-attachments/assets/99558ca4-81c6-4e1a-bd0d-6bc57830f4d0) I had the AWS_KEY variable set like that to confirm the vulnerability: ![image](https://github.com/user-attachments/assets/16382998-2402-436a-9bb0-db09fb13dd79) ### Impact - Through these environment variables the attacker can access, they can fully compromise the database, cloud accounts, admin credentials, and more depending on what was setup leading to total system takeover and data breach. ### Suggested Fix - Blacklist some function for templates like env, expandEnv and fail as they can be used to leak environment variables which leads to a full takeover.

CVE-2025-49136 Affected Github.com/knadh/listmonk Versions

1 component(s)
Fixed Versions:
5.0.2
Product / Package Ecosystem Affected Versions Fixed Version
github.com/knadh/listmonk
Go
≥ 4.0.0
< 5.0.2
5.0.2

References

Frequently Asked Questions

What is CVE-2025-49136?
CVE-2025-49136 is a security vulnerability in Github.com/knadh/listmonk involving listmonk's Sprig template Injection vulnerability leads to reading of Environment Variable for low privilege user under CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine.
Which Github.com/knadh/listmonk versions are affected?
Affected versions include releases prior to 5.0.2 across affected packages: github.com/knadh/listmonk.
What version fixes CVE-2025-49136?
Upgrading to 5.0.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/knadh/listmonk affected?
Yes, github.com/knadh/listmonk is affected in releases prior to 5.0.2. Upgrade your dependency to 5.0.2 or later.
What is the CVSS score of CVE-2025-49136?
CVE-2025-49136 has a CVSS v3.1 base score of 9.0 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H.
What CWE is associated with CVE-2025-49136?
CVE-2025-49136 is classified under CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine (The product uses a template engine to insert or process externally-influenced input, but it does not neutralize or incorrectly neutralizes special elements or syntax that can be interpreted as template expressions or other code directives when processed by the engine.).
How can I check Go dependencies for CVE-2025-49136?
Run the dependency tree command: 'inspect dependencies for github.com/knadh/listmonk'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-jc7g-x28f-3v3h",
  "modified" : "2025-06-10T19:59:04Z",
  "published" : "2025-06-09T13:09:24Z",
  "aliases" : [ "CVE-2025-49136" ],
  "summary" : "listmonk's Sprig template Injection vulnerability leads to reading of Environment Variable for low privilege user",
  "details" : "### Summary\nThe `env` and `expandenv` template functions which is enabled by default in [Sprig](https://masterminds.github.io/sprig/) enables capturing of env variables on the host. While this may not be a problem on single-user (super admin) installations, on multi-user installations, this allows non-super-admin users with campaign or template permissions to use the `{{ env }}` template expression to capture sensitive environment variables.\n\n**Upgrade to [v5.0.2](https://github.com/knadh/listmonk/releases/tag/v5.0.2)** to mitigate.\n\n---------\n\n# Demonstration\n\n### Description\nA critical template injection vulnerability exists in Listmonk's campaign preview functionality that allows authenticated users with minimal privileges (campaigns:get & campaigns:get_all) to extract sensitive system data, including database credentials, SMTP passwords, and admin credentials due to some dangerous function being allowed.\n\n### Proof of Concept\n\n- Create a user and give him `campaigns:get` and `campaigns:get_all` privileges\n\n![image](https://github.com/user-attachments/assets/05333695-14d9-498e-9f73-2137d6eca55b)\n\n- Now login with that user, go to any campaign, go the Content section and here lies the vulnerability, we're able to execute template content which allows us to get environment variables, execute Sprig functions...\n\n- Now in the text field you can input the following and press Preview:\n```\n{{ env \"AWS_KEY\" }}\n{{ env \"LISTMONK_db__user\" }}\n{{ env \"LISTMONK_db__password\" }}\n````\n\n![image](https://github.com/user-attachments/assets/ac963f54-5982-47d4-99d0-59030917f548)\n\n# Preview:\n\n![image](https://github.com/user-attachments/assets/99558ca4-81c6-4e1a-bd0d-6bc57830f4d0)\n\nI had the AWS_KEY variable set like that to confirm the vulnerability:\n\n![image](https://github.com/user-attachments/assets/16382998-2402-436a-9bb0-db09fb13dd79)\n\n### Impact\n\n- Through these environment variables the attacker can access, they can fully compromise the database, cloud accounts, admin credentials, and more depending on what was setup leading to total system takeover and data breach.\n\n### Suggested Fix\n\n- Blacklist some function for templates like env, expandEnv and fail as they can be used to leak environment variables which leads to a full takeover.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/knadh/listmonk"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.0.0"
      }, {
        "fixed" : "5.0.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/knadh/listmonk/security/advisories/GHSA-jc7g-x28f-3v3h"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-49136"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/knadh/listmonk/commit/d27d2c32cf3af2d0b24e29ea5a686ba149b49b3e"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/knadh/listmonk"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/knadh/listmonk/releases/tag/v5.0.2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1336" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-06-09T13:09:24Z",
    "nvd_published_at" : "2025-06-09T17:15:29Z"
  }
}