GHSA-jc7g-x28f-3v3h

Suggest an improvement
Source
https://github.com/advisories/GHSA-jc7g-x28f-3v3h
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/06/GHSA-jc7g-x28f-3v3h/GHSA-jc7g-x28f-3v3h.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-jc7g-x28f-3v3h
Aliases
Related
Published
2025-06-09T13:09:24Z
Modified
2025-06-10T19:59:04Z
Severity
  • 9.0 (Critical) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H CVSS Calculator
Summary
listmonk's Sprig template Injection vulnerability leads to reading of Environment Variable for low privilege user
Details

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:get and campaigns:get_all 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 "AWS_KEY" }}
    {{ env "LISTMONK_db__user" }}
    {{ env "LISTMONK_db__password" }}
    
    

image

Preview:

image

I had the AWS_KEY 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.
Database specific
{
    "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"
}
References

Affected packages

Go / github.com/knadh/listmonk

Package

Name
github.com/knadh/listmonk
View open source insights on deps.dev
Purl
pkg:golang/github.com/knadh/listmonk

Affected ranges

Type
SEMVER
Events
Introduced
4.0.0
Fixed
5.0.2