As detailed on Apple’s website, Safari 17.4.1 fixes an exploit in WebRTC that allowed arbitrary code to be executed when processing images. Apple says that an “out-of-bounds write issue was addressed ...
Offhand, maybe you could run the Safari technology preview, but it’s limited to Ventura and Sonoma, so it wouldn’t help if you’re specifically looking for a way to update Safari on an older version.