This issue was addressed with improved permissions checking. This issue is fixed in macOS Sonoma 14.5, iOS 17.5 and iPadOS 17.5. A malicious app may be able to gain root privileges.
https://support.apple.com/kb/HT214106
https://support.apple.com/kb/HT214101