Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150926222609.GB11060@netbsd.org>
Date: Sat, 26 Sep 2015 22:26:09 +0000
From: David Holland <dholland-oss-security@...bsd.org>
To: oss-security@...ts.openwall.com
Subject: Re: s/party/hack like it's 1999

On Mon, Sep 21, 2015 at 09:02:27PM +0200, Florian Weimer wrote:
 > >> I have been arguing for years (but without success) that vt bomb
 > >> injection needs to be blocked in the tty driver. This problem
 > >> (corruption of concurrent UTF-8 streams) needs to be too, as a matter
 > >> of correctness and not even security.
 > >
 > > How exactly would a tty driver "block" anything like this?
 > 
 > Avoiding in-band signaling in the first place. :-/

Yes, that.

 > > A tty driver never looks at the data stream in the kernel, as that
 > > way lies madness...
 > 
 > Surely there is a way to prevent two writes from interleaving?  For
 > writes to files in O_APPEND mode, this already happens, doesn't it?

Theoretically each write() call is supposed to be atomic; there are
presumably some limits to that in practice, especially on ptys (like
PIPE_BUF is the limit for pipes) but this doesn't help if programs
emit partial characters, as is (in general) likely. Programs that use
stdio to write to stdout are ok because stdio line-buffers stdout when
it's a tty; but that doesn't help with stderr, or with programs that
ship text around in arbitrary-sized blocks, or programs in cbreak
mode, or if you're logged in across a network that hiccups
occasionally. (Or can be made to hiccup on purpose.)

ISTM that for safety the tty driver is going to have to know about
multibyte encodings and not let through partial characters; this is an
enormous can of worms.

(but, let's not overreact; it's always been possible to blat out
sequences beginning with [ and hope that they'll be inserted right
after someone else's ESC.)

-- 
David A. Holland
dholland@...bsd.org

Powered by blists - more mailing lists

Please check out the Open Source Software Security Wiki, which is counterpart to this mailing list.

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.