Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 119966 - net-misc/lsh leaks fd:s to user shells
Summary: net-misc/lsh leaks fd:s to user shells
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: High normal
Assignee: Gentoo Security
URL: http://lists.lysator.liu.se/pipermail...
Whiteboard: B3 [noglsa] DerCorny
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-22 12:00 UTC by Sune Kloppenborg Jeppesen (RETIRED)
Modified: 2006-02-03 07:25 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
lsh-2.0.1-r1.log (3321-lsh-2.0.1-r1.log,289.87 KB, text/plain)
2006-01-24 06:05 UTC, Tobias Scherbaum (RETIRED)
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2006-01-22 12:00:14 UTC
Stefan Pfetzing noticed that lshd leaks a couple of file descriptors,
related to the randomness generator, to user shells which are started
by lshd.

This is a security problem, in at least two ways:

* A user can truncate the server's seed file, which may prevent the
  server from starting.

* By reading the file, a user can get information that may be useful
  for cracking other user's session keys, as well as public keys that
  are generated from the disclosed seed file. (To understand what the
  impact is, one must understand how yarrow generates and uses the
  seed file. My initial analysis is that reading the seed-file is
  advantageous only if it is read just prior to the start of some
  process using the seed for initialization.)

This is a local hole. It provides for fairly easy denial of service by
local users, and with some more effort, maybe also cracking of session
keys.

The below patch, relative to lsh-2.0.1, seems to solve the problem.
After applying the patch, you should remove and then regenerate the
server's seed file (since users may still have open fd:s), and restart
lshd.

I hope to be able to put together a new release sometime next week.
I'll be off-line over the weekend. In the mean time, feel free to
inform other distributors and appropriate security fora about the
problem.

Sorry for the inconvenience,
/Niels

*** unix_random.c.~1.17.~       2004-11-17 22:13:27.000000000 +0100
--- unix_random.c       2006-01-20 14:26:05.000000000 +0100
***************
*** 258,263 ****
--- 258,264 ----
        if (self->device_fd < 0)
        return 0;

+       io_set_close_on_exec(self->device_fd);
        self->device_last_read = now;
      }

***************
*** 381,386 ****
--- 382,388 ----
        return NULL;
        }

+     io_set_close_on_exec(self->seed_file_fd);
      trace("random_init, reading seed file...\n");

      if (!read_initial_seed_file(&self->yarrow, self->seed_file_fd))
Comment 1 Stefan Cornelius (RETIRED) gentoo-dev 2006-01-22 13:13:38 UTC
well, no maintainer but spanky is the (un)lucky one who is mentioned 7 times in the changelog, would you do the bumping pls? thx in advance
Comment 2 SpanKY gentoo-dev 2006-01-23 14:58:24 UTC
2.0.1-r1 in portage
Comment 3 Stefan Cornelius (RETIRED) gentoo-dev 2006-01-23 15:17:52 UTC
arches, cast your magic spell :)
Comment 4 Tobias Scherbaum (RETIRED) gentoo-dev 2006-01-24 06:05:59 UTC
Created attachment 77994 [details]
lsh-2.0.1-r1.log

Fails on ppc, see attached logfile.

[ebuild  N    ] net-misc/lsh-2.0.1-r1  USE="X pam tcpd zlib -ipv6" 0 kB
Comment 5 Stefan Cornelius (RETIRED) gentoo-dev 2006-01-24 06:13:08 UTC
mhh, probably back to ebuild status then, any comments vapier?
Comment 6 Joshua Jackson (RETIRED) gentoo-dev 2006-01-24 23:50:36 UTC
(In reply to comment #4)

fails at the same spot in x86, not that any of that is surprising.
Comment 7 SpanKY gentoo-dev 2006-01-25 22:09:27 UTC
it bombed because you guys dont have guile installed

forced guile into DEPEND
Comment 8 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2006-01-25 22:46:40 UTC
Back to stable with fixed ebuild.
Comment 9 Joshua Jackson (RETIRED) gentoo-dev 2006-01-26 21:48:56 UTC
well it goes about fine until we check for collisions..it then fails because it collides with /usr/share/man/man8/sftp-server.8.gz, this naturally belongs to openssh-4.2_p1. Another fix to fix ~_~
Comment 10 Joshua Jackson (RETIRED) gentoo-dev 2006-01-30 15:05:27 UTC
Stable on x86 for security reasons. Sorry about the delay on this.

Also please note something is missing

 metadata.missing               1
   net-misc/lsh/metadata.xml

If we can get one in there, it'd be a good thing (TM)
Comment 11 Tobias Scherbaum (RETIRED) gentoo-dev 2006-01-31 12:04:17 UTC
ppc stable
Comment 12 Stefan Cornelius (RETIRED) gentoo-dev 2006-01-31 14:40:05 UTC
ready for glsa vote, i tend to say no.
Comment 13 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2006-01-31 15:24:17 UTC
Tend to vote NO too.
Comment 14 SpanKY gentoo-dev 2006-02-01 17:21:59 UTC
lsh-2.0.1-r2 fixes the file collision
Comment 15 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2006-02-01 22:50:01 UTC
Back to stable to let ppc and x86 mark the latest fixed version stable. Would be nice to get -r1 removed once -r2 is stable.
Comment 16 SpanKY gentoo-dev 2006-02-02 12:50:55 UTC
i dont really think we must move to 2.0.1-r2 for security

2.0.1-r1 is Good Enough imho for GLSA
Comment 17 Wormo (RETIRED) gentoo-dev 2006-02-02 16:13:09 UTC
lsh-2.0.1-r2 stable on ppc
Comment 18 Joshua Jackson (RETIRED) gentoo-dev 2006-02-02 19:47:28 UTC
thank you for the fixes, its stable on x86
Comment 19 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2006-02-02 22:39:05 UTC
Back to GLSA vote. 1 full NO and 0 YES votes so far.
Comment 20 Stefan Cornelius (RETIRED) gentoo-dev 2006-02-03 07:25:52 UTC
Second full no and closing as resolved fixed.