This issue was addressed with improved iframe sandbox enforcement. This issue is fixed in Safari 17. An attacker with JavaScript execution may be able to execute arbitrary code.
https://webkitgtk.org/security/WSA-2023-0009.html
https://support.apple.com/en-us/HT213941
https://security.gentoo.org/glsa/202401-33