The issue was addressed with improved handling of caches. This issue is fixed in macOS Sonoma 14.1, iOS 16.7.2 and iPadOS 16.7.2. Visiting a malicious website may reveal browsing history.
https://support.apple.com/kb/HT213984
https://support.apple.com/kb/HT213981
https://support.apple.com/en-us/HT213984
https://support.apple.com/en-us/HT213981