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.
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.
campaigns:get
and campaigns:get_all
privilegesNow 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" }}
I had the AWS_KEY variable set like that to confirm the vulnerability:
{ "nvd_published_at": "2025-06-09T17:15:29Z", "cwe_ids": [ "CWE-1336" ], "severity": "CRITICAL", "github_reviewed": true, "github_reviewed_at": "2025-06-09T13:09:24Z" }