https://sw.kovidgoyal.net/kitty/graphics-protocol/
Look at the “The transmission medium” section. I’m reasonably familiar with what can go wrong when messing with files you shouldn’t mess with on Linux, I’ve worked on the various security mechanisms that can help, and I would not want to implement this. If someone wanted me to consult on implementing this, my advice would be, first and foremost, not to.
There isn’t even a “security considerations” section in the document!