rpc.mountd: fix some vulnerabilities
Subsystems (2)
Quoted 8 lines · On Wed, Nov 05, 2014 at 09:21:37PM +0100, [email protected] wrote:
Hello,
I'm sending a small set of 3 patches for a problem, that I have reported a few weeks ago.
rpc.mountd can be blocked by a bad client, that sends lots of RPC requests, but never reads the replies from the socket either intentionally or e.g. caused by a wrong configured MTU.
Quoted 5 lines
While looking for a possible solution, I found another weakness in rpc.mountd if it is used "multithreaded" (-t nn).
The first two patches fix that weakness in the case of !HAVE_LIBTIRPC and
HAVE_LIBTIRPC.
They look fine to me.
Quoted 2 lines
The third patch more a kind of suggestion how the main problem could be fixed.
Sounds reasonable to me.
Quoted 4 lines
I don't know whether we can set MAXREC without causing new troubles. When this patch is used, a further patch for libtirpc also should be used. You can find it here:
http://sourceforge.net/p/libtirpc/mailman/libtirpc-devel/?viewmonth=201409
So applying this last patch and then building against an unpatched libtirpc would expose us to a serious bug? Do we need to do something to make that less likely to happen?
--b.
Quoted 3 lines
Best regards,
Bodo
Quoted 29 lines
-----Original Message-----
From: J. Bruce Fields [mailto:[email protected]]
Sent: Wednesday, November 05, 2014 10:06 PM
To: Strösser, Bodo
Cc: [email protected]; [email protected]
Subject: Re: [nfs-utils] [PATCH 0/3] rpc.mountd: fix some vulnerabilitiesQuoted 8 lines · On Wed, Nov 05, 2014 at 09:21:37PM +0100, [email protected] wrote:
Hello,
I'm sending a small set of 3 patches for a problem, that I have reported a few weeks ago.
rpc.mountd can be blocked by a bad client, that sends lots of RPC requests, but never reads the replies from the socket either intentionally or e.g. caused by a wrong configured MTU.Quoted 5 lines
While looking for a possible solution, I found another weakness in rpc.mountd if it is used "multithreaded" (-t nn).
The first two patches fix that weakness in the case of !HAVE_LIBTIRPC and
HAVE_LIBTIRPC.They look fine to me.
Quoted 2 lines
The third patch more a kind of suggestion how the main problem could be fixed.
Sounds reasonable to me.
Quoted 8 lines
Quoted 4 lines
I don't know whether we can set MAXREC without causing new troubles. When this patch is used, a further patch for libtirpc also should be used. You can find it here:
http://sourceforge.net/p/libtirpc/mailman/libtirpc-devel/?viewmonth=201409So applying this last patch and then building against an unpatched libtirpc would expose us to a serious bug? Do we need to do something to make that less likely to happen?
The bug in libtirpc is triggered, if the write() to the socket returns -EAGAIN but one of the many retries in the following 2 seconds succeeds. Then the normal reply is sent with a prefix of (maybe many) bytes from rpc.mountd's memory space before the reply buffer. That means, that some data from memory is sent (authentication data?) or rpc.mountd might get SIGSEGV, I don't know.
But I think it won't be easy to trigger this. rpcbind uses the nonblocking mode of libtirpc and no one complains about the bug in libtirpc.
Anyway, it of course would be better to use a fixed libtirpc, as I can't see a way to have a work around in rpc.mountd for the libtirpc bug.
Bodo
Quoted 6 lines
--b.
Quoted 3 lines
Best regards,
Bodo
Quoted 54 lines · NeilBrown
Quoted 44 lines · Bodo
Quoted 29 lines
-----Original Message-----
From: J. Bruce Fields [mailto:[email protected]]
Sent: Wednesday, November 05, 2014 10:06 PM
To: Strösser, Bodo
Cc: [email protected]; [email protected]
Subject: Re: [nfs-utils] [PATCH 0/3] rpc.mountd: fix some vulnerabilitiesQuoted 8 lines · On Wed, Nov 05, 2014 at 09:21:37PM +0100, [email protected] wrote:
Hello,
I'm sending a small set of 3 patches for a problem, that I have reported a few weeks ago.
rpc.mountd can be blocked by a bad client, that sends lots of RPC requests, but never reads the replies from the socket either intentionally or e.g. caused by a wrong configured MTU.Quoted 5 lines
While looking for a possible solution, I found another weakness in rpc.mountd if it is used "multithreaded" (-t nn).
The first two patches fix that weakness in the case of !HAVE_LIBTIRPC and
HAVE_LIBTIRPC.They look fine to me.
Quoted 2 lines
The third patch more a kind of suggestion how the main problem could be fixed.
Sounds reasonable to me.
Quoted 8 lines
Quoted 4 lines
I don't know whether we can set MAXREC without causing new troubles. When this patch is used, a further patch for libtirpc also should be used. You can find it here:
http://sourceforge.net/p/libtirpc/mailman/libtirpc-devel/?viewmonth=201409So applying this last patch and then building against an unpatched libtirpc would expose us to a serious bug? Do we need to do something to make that less likely to happen?
The bug in libtirpc is triggered, if the
write()to the socket returns-EAGAINbut one of the many retries in the following 2 seconds succeeds. Then the normal reply is sent with a prefix of (maybe many) bytes from rpc.mountd's memory space before the reply buffer. That means, that some data from memory is sent (authentication data?) or rpc.mountd might get SIGSEGV, I don't know.Quoted 6 lines
But I think it won't be easy to trigger this. rpcbind uses the nonblocking mode of libtirpc and no one complains about the bug in libtirpc.
Anyway, it of course would be better to use a fixed libtirpc, as I can't see a way to have a work around in rpc.mountd for the libtirpc bug.
Quoted 5 lines
I agree that hitting the bug is fairly unlikely. If there is something easy we can do to help avoid it, it might be worth it.
Once the fix gets into a libtirpc release, we could put a hard dependency on that release number in configure for nfs-utils. Is that too harsh??
Yeah, that's more what I was wondering about.
If building new mountd against an old libtirpc meant suddenly mountd was crashing all the time then it'd seem worth something like that.
If it's an unusual corner case that people have been exposed to in other ways for a while anyway, then maybe we just trust to distros to get their libtirpc's fixed and don't worry so much.
--b.
Quoted 4 lines
Steve: you are maintainer for both (?). Would you be able to make a libtirpc release soonish with the mentioned fix, then would you be happy for future nfs-utils to require at least that version?
Quoted 3 lines · NeilBrown
Steve: you are maintainer for both (?). Would you be able to make a libtirpc release soonish with the mentioned fix, then would you be happy for future nfs-utils to require at least that version?
Let me get the libtirpc fix in.. and then take a look at adding something to the aclocal/libtirpc.m4 requiring a particular version??
steved.