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://support.apple.com/en-us/HT213941
https://security.gentoo.org/glsa/202401-33