This issue was addressed with improved checks. This issue is fixed in macOS Monterey 12.4, macOS Big Sur 11.6.6. An attacker may be able to cause unexpected application termination or arbitrary code execution.
https://support.apple.com/en-us/HT213256
https://support.apple.com/kb/HT213258
https://support.apple.com/kb/HT213254