-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Add Listmonk Template Function Environment Variable Disclosure Auxiliary Module (CVE-2025-49136) #20579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Listmonk Template Function Environment Variable Disclosure Auxiliary Module (CVE-2025-49136) #20579
Conversation
documentation/modules/auxiliary/gather/listmonk_env_disclosure.md
Outdated
Show resolved
Hide resolved
Thanks for the thorough review! I've addressed all the feedback in the following commits: Main improvements:
All conversation threads have been resolved. Please let me know if anything needs further adjustment! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the module @nakkouchtarek! Looks like it's almost ready to go, just two comments.
Testing
msf auxiliary(gather/listmonk_env_disclosure) > rexploit
[*] Reloading module...
[*] Running module against 127.0.0.1
[*] Targeting http://127.0.0.1:9000/
[*] Using default environment variable list (6 variables)
[+] Login successful
[*] Executing template to extract environment variables...
[+] Environment variable(s) extracted:
LISTMONK_db__host: listmonk_db
LISTMONK_db__port: 5432
LISTMONK_db__user: listmonk
LISTMONK_db__password: listmonk
LISTMONK_db__database: listmonk
LISTMONK_app__address: 0.0.0.0:9000
[*] Auxiliary module execution completed
msf auxiliary(gather/listmonk_env_disclosure) > set ENVVAR path
ENVVAR => path
msf auxiliary(gather/listmonk_env_disclosure) > run
[*] Running module against 127.0.0.1
[*] Targeting http://127.0.0.1:9000/
[*] Targeting specific environment variables: PATH
[+] Login successful
[*] Executing template to extract environment variables...
[+] Environment variable(s) extracted:
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[*] Auxiliary module execution completed
documentation/modules/auxiliary/gather/listmonk_env_disclosure.md
Outdated
Show resolved
Hide resolved
@nakkouchtarek also would you mind squashing your commits down once you addressed the final comments? I did really appreciated how organized your commits were during the review process, made reviewing very nice! |
7ffaf22
to
7c840a1
Compare
@jheysel-r7 Hi, glad you found the commits helpful! I definitely had you guys in mind when making changes, so I made sure to keep each change separate, especially looking at the amount of changes. All final issues have been addressed and I've squashed everything to one commit. Let me know if there's anything else to change, glad to be of help! |
Release NotesThis adds an auxiliary scanner module for an insecure template function vulnerability in Listmonk versions >= v4.0.0 and < v5.0.2. This allows authenticated users with minimal permissions to read arbitrary environment variables on the host system through campaign template previews. Environment variables in Listmonk deployments often contain sensitive information such as database credentials, SMTP passwords, API keys, and admin credentials, leading to potential full system compromise. |
Description
This PR adds an auxiliary scanner module for an insecure template function vulnerability in in Listmonk versions >= v4.0.0 and < v5.0.2.. The issue exists in the campaign preview functionality, where dangerous Sprig template functions (
env
andexpandenv
) are enabled by default. This allows authenticated users with minimal campaign permissions (campaigns:get
andcampaigns:get_all
) to read arbitrary environment variables on the host system through campaign template previews. Environment variables in Listmonk deployments often contain sensitive information such as database credentials, SMTP passwords, API keys, and admin credentials, leading to potential full system compromise.Required Privileges
For this exploit to work, the authenticated user must have the following privileges:
campaigns:get
- Permission to get and view campaigns belonging to permitted listscampaigns:get_all
- Permission to get and view campaigns across all listsThese are minimal privileges that can be assigned to non-admin users in multi-user Listmonk
installations, making this vulnerability particularly dangerous as it allows privilege escalation
through environment variable disclosure.
Docker Installation (Vulnerable Version)
To install the vulnerable version, run the following command :
Vulnerable Versions
Patched Versions
Verification Steps
use auxiliary/gather/listmonk_env_disclosure
set RHOSTS [target]
set USERNAME [username]
set PASSWORD [password]
set ENVVAR [comma-separated environment variables]
run
Options
USERNAME
The Listmonk username for authentication. This must be a valid user account with
the required
campaigns:get
andcampaigns:get_all
permissions.PASSWORD
The Listmonk password for authentication.
ENVVAR
A comma-separated list of environment variable names to extract. If not specified,
the module will automatically attempt to extract a default list of common sensitive
environment variables.
Default variables extracted (when ENVVAR is not set):
LISTMONK_db__host
- Database hostLISTMONK_db__port
- Database portLISTMONK_db__user
- Database usernameLISTMONK_db__password
- Database passwordLISTMONK_db__database
- Database nameLISTMONK_app__address
- Application addressExamples of custom variables to target:
LISTMONK_app__admin_username
,LISTMONK_app__admin_password
- Admin credentialsSMTP_HOST
,SMTP_PORT
,SMTP_USER
,SMTP_PASSWORD
- Email server credentialsAWS_ACCESS_KEY_ID
,AWS_SECRET_ACCESS_KEY
- Cloud provider credentialsDATABASE_URL
,REDIS_URL
- Connection stringsSECRET_KEY
,API_KEY
- Application secretsPATH
,HOME
,USER
- System environment variablesCAMPAIGN_NAME
Optional campaign name to use for the temporary campaign created during extraction.
If not specified, a random name will be generated to avoid collisions when running
the module multiple times. The campaign is automatically deleted after extraction.
Scenarios
Running Check to Verify Target is Vulnerable
Extract Default Environment Variables
Running the module without specifying ENVVAR will automatically extract the default
list of common Listmonk environment variables:
Extract Specific Environment Variables
You can target specific environment variables by providing a comma-separated list:
Extract Single Environment Variable