| You're overcomplicating a thing that is simple -- don't use in-band control signaling. It's been the same problem since whistling for long-distance, with the same solution of moving control signals out of the data stream. Any system where control signals can possibly be expressed in input data is vulnerable to escape-escaping exploitation. The same solution, hard isolation, instantly solves the problem: you have to render control inexpressible in the in-band alphabet. Whether that's by carrying control signals on isolated transport (e.g CCS/SS7), making control signals inexpressible in the in-band set (e.g. using other frequencies or alphabets), using NX-style flagging, or other methods. |
You can only maintain hard isolation if the interpreter of the data is sufficiently primitive, and even then it is often hard to avoid errors that renders it more powerful than intended, be it outright bugs all the way up to unintentional Turing completeness.