Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 942011 (CVE-2024-9050) - <net-vpn/networkmanager-libreswan-1.2.24: privilege escalation
Summary: <net-vpn/networkmanager-libreswan-1.2.24: privilege escalation
Status: CONFIRMED
Alias: CVE-2024-9050
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Security
URL:
Whiteboard: ~1 [cleanup noglsa]
Keywords:
Depends on:
Blocks:
 
Reported: 2024-10-23 13:21 UTC by Hans de Graaff
Modified: 2024-10-23 13:22 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hans de Graaff gentoo-dev Security 2024-10-23 13:21:31 UTC
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.