Re: ? Unsafe terminal escape sequences and ANSI codes from decryption
[email protected] (Richard) Mon, 6 Mar 2023 18:36:47 -0000 (UTC)
| Newsgroups | sci.crypt,alt.security.pgp,alt.bbs,comp.terminals,alt.computer.security |
|---|---|
| Organization | multi-cellular, biological |
| Message-ID | <[email protected]> |
[Please do not mail me a copy of your followup] "G.K." <[email protected]> spake the secret code <[email protected]> thusly: >Another distinction occurs to me that might ease the problem >requirement. Is there a cheap way to distinguish between control codes >and formatting codes (color, foreground, background, underline, >blinkenlights) codes in a text stream. The ANSI sequences are described in ECMA-48: <https://www.ecma-international.org/publications-and-standards/standards/ecma-48/> Other terminals have their own code sequence, some of which are documented here: <https://terminals-wiki.org/wiki/index.php/Category:Code_Chart>. You can also reverse engineer them from the terminfo/termcap database. <https://invisible-island.net/ncurses/#download_database> >What I mean by 'control codes' are codes for bell, repositioning cursor, >backspace and flush, etc. What I mean by 'formatting codes' is strictly >that which formats the color and appearance without any cursor movement >or flushing on the x and y of the display. For ANSI sequences, this is well defined. For other terminal types, it depends on their control sequences which are usually documented in the manual accompanying the terminal. There are a very few fancy terminals which allowed you to download firmware directly into the terminal which potentially means for arbitrary control sequences. However, these terminals were not common (AFAIK) and are unlikely to be targetted in random control sequence streams you'd encounter on the net. It was not uncommon for OEM manufacturers to allow custom ROMs to be installed in order to support custom control sequences. If you want to understand the inner workings of how a hardware terminal typically processes the incoming byte stream, I can point you to more resources that explain it in detail. >I think this simplifies my problem because it is really the control >codes I would want to watch out for, which could possibly trick someone >visually. That is of course barring some zero day hiding in the source >code of the terminal as you have said. Terminal *emulator*, not terminal. >Perhaps there is a code that toggles arbitrary escapes off, that could >be injected into the stream, rather than truncating out of the stream. >although I haven't been able to find it. There is no such thing for ANSI control sequences (look at the ECMA-48 link above) and in all the other oddball terminals I've looked at, they don't have this either. There would be no point in having this because the whole point of a smart terminal is for it to understand and process commands in the communication stream. -- "The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline> The Terminals Wiki <http://terminals-wiki.org> The Computer Graphics Museum <http://computergraphicsmuseum.org> Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>