Add Linux Gather Environment Variable Secrets module#21216
Open
bcoles wants to merge 1 commit intorapid7:masterfrom
Open
Add Linux Gather Environment Variable Secrets module#21216bcoles wants to merge 1 commit intorapid7:masterfrom
bcoles wants to merge 1 commit intorapid7:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new Metasploit post module to enumerate /proc/<pid>/environ on Linux, analyze environment variables for potential secrets, and save both raw environment data and a flagged-secrets report as loot.
Changes:
- Introduces
post/linux/gather/enum_env_secrets, implementing name heuristics, provider token regex matching, and entropy-based detection. - Stores two loot artifacts: full environment variables and a filtered secrets report with confidence levels.
- Adds user-facing module documentation including options and example output.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| modules/post/linux/gather/enum_env_secrets.rb | New post module that enumerates /proc environments and flags likely secrets via 3-layer detection. |
| documentation/modules/post/linux/gather/enum_env_secrets.md | Documentation for usage, options, and sample output for the new module. |
Contributor
Author
|
Broken tests are not my fault. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Metasploit post module implementation of envex.
Extracts environment variables from all accessible processes via
/proc/<pid>/environon Linux and flags potential secrets using athree-layer detection engine: name heuristics, value pattern matching,
and Shannon entropy analysis.
Environment variables are a primary vector for secret exposure in modern
infrastructure. Processes receive sensitive values such as API keys,
database credentials, and tokens through their environment. These persist
in
/proc/<pid>/environfor the lifetime of the process and are readableby any process with the same UID (or by root).
In practice, many hardened environments that block memory inspection
still permit reading
/proc/<pid>/environfor same-user processes.Verification Steps
use post/linux/gather/enum_env_secretsset SESSION <session_id>run