This issue was addressed through improved state management. This issue is fixed in Safari 18, visionOS 2, watchOS 11, macOS Sequoia 15, iOS 18 and iPadOS 18, tvOS 18. Processing maliciously crafted web content may lead to universal cross site scripting.
https://support.apple.com/en-us/121250
https://support.apple.com/en-us/121249
https://support.apple.com/en-us/121248
https://support.apple.com/en-us/121241