Xref: utzoo alt.security:1626 comp.unix.sysv386:746 Path: utzoo!utgpu!cs.utexas.edu!uunet!mcsun!unido!mikros!mwtech!martin From: martin@mwtech.UUCP (Martin Weitzel) Newsgroups: alt.security,comp.unix.sysv386 Subject: Re: Here's how to stop shell escapes from vi Message-ID: <935@mwtech.UUCP> Date: 25 Sep 90 18:49:03 GMT References: <924@mwtech.UUCP> <27387:Sep2320:07:3890@kramden.acf.nyu.edu> <1990Sep24.040745.10454@chinet.chi.il.us> <1038:Sep2414:36:0390@k Reply-To: martin@mwtech.UUCP (Martin Weitzel) Organization: MIKROS Systemware, Darmstadt/W-Germany Lines: 36 In article <1038:Sep2414:36:0390@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes: >In article <1990Sep24.040745.10454@chinet.chi.il.us> les@chinet.chi.il.us (Leslie Mikesell) writes: >> In article <27387:Sep2320:07:3890@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes: >> > [ trash the colon with pty -0 tr \: \? | pty vi ] [...] >> Umm... Well, there's 'Q' to go to ex mode and stay there while you >> type sh, > [ blah blah blah ] > >Read my lips: ``The only thing that you can't completely control from >within vi is the mapping of the colon---and my solution handles that.'' >You can map Q. You can map @. You can even map !---I didn't realize this >at first. You can map every single f-ing character the user can type. >Except the colon. Dan, calm down. I confess that after your first posting I had not understood your proposual to map all "dangerous" command from *within* vi and that mapping Q, @, and ! to so could effectively disable these commands. But playing a little with vi, to confirm if it could work, revealed other interesting things. If you have two minutes time, please try the following: 2000i- This should construct a line of 2000 characters, which is above the limits at least my vi (386/ix Rel 2.0.2) can handle. Then insert another character into this line ... and whoops, vi throws you into ex-mode. Nice feature - who would ever have thought? Possibly some user which you carefully tried to keep away from ex-prompts knows this little "feature" (who said it is a bug?). Vi wasn't designed for what you have in mind. It MUST be fixed in the vi-sources, if it should work reliable! I would never trust in any other solution. -- Martin Weitzel, email: martin@mwtech.UUCP, voice: 49-(0)6151-6 56 83