Skip to content
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

Unsafe use of eval in Report::Store #234

Open
mpurg opened this issue Mar 25, 2024 · 0 comments
Open

Unsafe use of eval in Report::Store #234

mpurg opened this issue Mar 25, 2024 · 0 comments

Comments

@mpurg
Copy link

mpurg commented Mar 25, 2024

Describe the bug

The dynamic loading of the backend module uses an unsafe form of eval without sanitizing the module name from the config file.

eval "use $module"; ## no critic (Eval)

This can lead to code injection via a malicious configuration file, for example:

[report_store]
backend = SQL; print `whoami`;

Because the configuration file is loaded first from the current working directory (as mentioned in a previous issue: #231), the code injection could be abused to gain privileges on a system where the library is executed as a privileged user in a world-writable directory (e.g. /tmp).

Although the above is a somewhat unlikely scenario, I would still advise to switch to Module::Load for safer dynamic loading and to avoid loading the configuration file from the current working directory (maybe instead use $HOME/.mail-dmarc.ini).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant