listmonk's Sprig template Injection vulnerability leads to reading of Environment Variable for low privilege user
GHSA-jc7g-x28f-3v3h · CVE-2025-49136 · GO-2025-3745
Published · Modified
AI SAST
Find this class of vulnerability in your own code
Corgea's AI-native static analysis detects vulnerabilities like this one across your repositories, ranks them by exploitability, and returns review-ready fixes.
Description
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: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:getandcampaigns:get_allprivileges
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" }}
Preview:
I had the AWS_KEY variable set like that to confirm the vulnerability:
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.
References
- WEB https://github.com/knadh/listmonk/security/advisories/GHSA-jc7g-x28f-3v3h
- ADVISORY https://nvd.nist.gov/vuln/detail/CVE-2025-49136
- WEB https://github.com/knadh/listmonk/commit/d27d2c32cf3af2d0b24e29ea5a686ba149b49b3e
- PACKAGE https://github.com/knadh/listmonk
- WEB https://github.com/knadh/listmonk/releases/tag/v5.0.2
Ready to move
Start Securing
Free, no credit card | First findings in minutes