Description A flaw was found in the libreswan client plugin for NetworkManager (NetkworkManager-libreswan), where it fails to properly sanitize the VPN configuration from the local unprivileged user. In this configuration, composed by a key-value format, the plugin fails to escape special characters, leading the application to interpret values as keys. One of the most critical parameters that could be abused by a malicious user is the `leftupdown`key. This key takes an executable command as a value and is used to specify what executes as a callback in NetworkManager-libreswan to retrieve configuration settings back to NetworkManager. As NetworkManager uses Polkit to allow an unprivileged user to control the system's network configuration, a malicious actor could achieve local privilege escalation and potentially execute code as root in the targeted machine. Exploit NetworkManager-libreswan fails to sanitize the VPN configuration from a local unprivileged user and pass it directly to Libreswan. The libreswan connection configuration is a simple key=value format, but it fails to check for or escape special characters, including newlines, which makes it possible for the user to trick us to treat values as key. So, there's one particular key that takes an executable command as an argument: leftupdown (couldn't find more in ipsec.conf(5)). We normally use it to specify the NetworkManager-libreswan callback, that would pass L3 configuration back to NM. It can be abused to execute arbitrary code. Impact By leveraging this vulnerability, an attacker can inject malicious commands into the VPN configuration, bypassing user privilege boundaries and gaining root access.