CVE-2021-4034 in polkit's pkexec is not an environment variable injection vulnerability—it's a NULL pointer dereference triggered by an argc edge case. When pkexec runs as a setuid binary with zero arguments, argc equals zero and argv[0] becomes NULL. The code then iterates into environ instead, treating attacker-controlled environment variables as program arguments. This distinction changes your response: you don't need to sanitize environment variables, you need an argc check.

The vulnerability existed undetected for twelve years (introduced circa 2009). That's not because one developer made an isolated mistake—it's because the entire C ecosystem encodes the same implicit assumption that argv[0] is never NULL. Static analyzers don't flag this pattern because the standard library itself reliably populates argv[0] in normal execution. The one-line fix (if (argc == 0) return;) gates the bug rather than eliminating the underlying antipattern. Future developers inheriting that code now have explicit documentation of where the edge case lives.

What you should do: audit any setuid binaries in your environment for argv[0] assumptions without NULL checks. Prioritize polkit-adjacent components since pkexec's upstream position means it shipped as a dependency in systemd, GNOME, KDE, and virtually every Linux desktop stack. The real exposure window wasn't just the twelve-year pre-discovery dormancy—it's the post-disclosure gap between when the fix shipped upstream and when it reached your specific distribution's repositories. That's the compounding risk: the vulnerability is now public, weaponized, and your systems may still be running unpatched versions while the supply chain propagates the one-line fix downstream.