[TUHS] shell escapes in utilities

Steffen Nurpmeso steffen at sdaoden.eu
Wed Aug 2 07:52:44 AEST 2023

Ron Natalie wrote in
 <em4ad243a6-02bf-4d7e-924a-3fe4a00e2c06 at a70c2ae8.com>:
 |Even without shell escapes there are fun and cames with abusing setuid 
 |(but accessible) programs.
 |Things like opening all the available file descriptors, closing 
 |stdin/out/err before invocation, doing things to overrun buffers, etc…

Of course.  Even experienced programmers still make errors, or
kernel bugs introduce problems which even such a programmer did
not take into account.  (Like that isatty(3) uses "a" IOCTL, and
a Linux bug caused local root exploit of any SETUID program that
uses C stdio's stdout (testing ISO C's "whether output shall be
line or fully buffered"), as seen earlier this year i think.)

This is for my convenience, one could "overlayfs them away".
..And my user account has a number of capabilities, starting X,
accessing audio and video, starting QEMU instances, changing files
under /x/{src,iso,os,doc} etc.

  $ groups
  audio video cdrom input kvm _icmp users steffen ports doc backups shared media vm code

And brute forcing/attacking the encfs ~/.sic where keys are stored
to access more one could.

At least, via the ACPI that Linux thankfully supports on this box,
all (other) encfs are unloaded, and (all) X displays are locked
(via slock, requiring password to unlock) when the display is

And all keys are removed from all SSH agents, even though this is
hard because even root cannot simply signal this as would be
possible with gnupg based agents.  Ie.

  act 'pkill -HUP gpg-agent >/dev/null 2>&1 &'


  for a in /tmp/ssh-*/agent.*; do
    [ -e "$a" ] || continue
    act "SSH_AUTH_SOCK=\"$a\" ssh-add -D </dev/null >/dev/null 2>&1 &"
    inc 1 2

which prevents personal /tmp directories (or requires work).
(Asynchronousity of signals hopefully no attack vector / problem.)
No healing in sight for this.

On the server there is only

  # find /sbin /bin /usr/sbin /usr/bin -perm /4000

but most daemons will not even be able to find that, or much in
their /dev/ etc.  Like my local web browser, which is, except for
armed perpetrators, the far biggest attack surface here.

|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)

More information about the TUHS mailing list