Remote code execution (RCE) due to disabled GPG verification in Ansible dnf

Critical Risk infrastructure-security

What it is

Remote code execution (RCE) is possible by installing tampered packages, leading to full system compromise and persistent attacker control.

Why it happens

Setting disable_gpg_check: true in dnf tasks to bypass package signature verification for convenience.

Root causes

Disabled GPG Verification

Setting disable_gpg_check: true in dnf tasks to bypass package signature verification for convenience.

Missing Repository Keys

Disabling GPG checks as a workaround for repositories with missing or expired GPG keys.

Development Environment Practices

Using disable_gpg_check during development and accidentally deploying it to production.

Fixes

1

Enable GPG Verification

Remove disable_gpg_check: true or explicitly set it to false in all dnf tasks.

2

Import Repository Keys

Use rpm_key module to properly import and trust GPG keys for all repositories before installing packages.

3

Validate Package Sources

Only use packages from trusted repositories with valid GPG signatures and reject unsigned packages.

Detect This Vulnerability in Your Code

Sourcery automatically identifies remote code execution (rce) due to disabled gpg verification in ansible dnf and many other security issues in your codebase.