This issue was addressed with improved checks. This issue is fixed in Xcode 15, tvOS 17, watchOS 10, iOS 17 and iPadOS 17, macOS Sonoma 14. An app may be able to gain elevated privileges.
https://support.apple.com/en-us/HT213940
https://support.apple.com/en-us/HT213939
https://support.apple.com/en-us/HT213938
https://support.apple.com/en-us/HT213937
https://support.apple.com/en-us/HT213936
http://seclists.org/fulldisclosure/2023/Oct/9
http://seclists.org/fulldisclosure/2023/Oct/8
http://seclists.org/fulldisclosure/2023/Oct/7