CVE-2025-49136: listmonk's Sprig template Injection vulnerability leads to reading of Environment Variable for low privilege user
Summary The env and expandenv template functions which is enabled by default in 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 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:getall) 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:getall privileges
!image
- 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 "AWSKEY" }} {{ env "LISTMONKdbuser" }} {{ env "LISTMONKdbpassword" }}
!image
Preview:
!image
I had the AWSKEY variable set like that to confirm the vulnerability:
!image
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.
Other sources
listmonk is a standalone, self-hosted, newsletter and mailing list manager. Starting in version 4.0.0 and prior to version 5.0.2, the env and expandenv template functions which is enabled by default in Sprig enables capturing of env variables on 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. Users should upgrade to v5.0.2 to mitigate the issue.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
go/github.com/knadh/listmonkto a version that resolves this vulnerability.Fixed in 5.0.2 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in v5.0.2 - Configuration
Blacklist the env, expandEnv, and fail template functions so they cannot be used to leak environment variables or execute dangerous template behavior.
Listmonk Sprig templates allowed template functions = Blacklist env, expandEnv, and fail
Event History
Frequently Asked Questions
What is the severity of CVE-2025-49136?
The severity of CVE-2025-49136 is considered high due to potential exposure of sensitive environment variables in multi-user installations.
How do I fix CVE-2025-49136?
To fix CVE-2025-49136, you should upgrade to version 5.0.2 or later of the Listmonk application.
What vulnerabilities does CVE-2025-49136 introduce?
CVE-2025-49136 can lead to information disclosure by allowing unauthorized access to environment variables.
Who is affected by CVE-2025-49136?
Users of Listmonk versions between 4.0.0 and 5.0.1 in multi-user environments may be affected by CVE-2025-49136.
What are the implications of CVE-2025-49136 in a multi-user environment?
In a multi-user environment, CVE-2025-49136 can compromise the security of user data by leaking environment variables.