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: RESOLVED FIXED
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 [noglsa]
Keywords:
Depends on:
Blocks:
 
Reported: 2024-10-23 13:21 UTC by Hans de Graaff
Modified: 2024-11-12 19:00 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.
Comment 1 Larry the Git Cow gentoo-dev 2024-11-12 19:00:38 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2d0870fdff44da7711c952c08446d7a7cab9327f

commit 2d0870fdff44da7711c952c08446d7a7cab9327f
Author:     Hans de Graaff <graaff@gentoo.org>
AuthorDate: 2024-11-12 19:00:01 +0000
Commit:     Hans de Graaff <graaff@gentoo.org>
CommitDate: 2024-11-12 19:00:30 +0000

    net-vpn/networkmanager-libreswan: drop 1.2.16, 1.2.22
    
    Bug: https://bugs.gentoo.org/942011
    Signed-off-by: Hans de Graaff <graaff@gentoo.org>

 net-vpn/networkmanager-libreswan/Manifest          |  2 -
 .../networkmanager-libreswan-1.2.16.ebuild         | 49 ----------------------
 .../networkmanager-libreswan-1.2.22.ebuild         | 49 ----------------------
 3 files changed, 100 deletions(-)