First Last Prev Next    No search results available      Search page      Enter new bug
Bug#: 72820
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Gentoo Security <security@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Matthias Geerdsen <vorlon@gentoo.org>
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:
Flags: Requestee:
 
 
  ()

Filename Description Type Creator Created Size Actions
ncpfs-output Access violation output text/plain Markus Rothe 2004-12-01 22:23 0000 3.95 KB Details
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 72820 depends on: Show dependency tree
Bug 72820 blocks:

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2004-11-29 07:55 0000
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

There is buffer overflow in ncplogin and ncpmap in nwclient.c.


static void strcpy_cw(wchar_t *w, const char* s) {
~        while ((*w++ = *(const nuint8*)s++) != 0);
}

NWDSCCODE NWDSCreateContextHandleMnt(NWDSContextHandle* ctx, const
NWDSChar * treeName){
...
wchar_t wc_treeName[MAX_DN_CHARS+1];

~  if (!treeName)
~      return ERR_NULL_POINTER;

~  strcpy_cw (wc_treeName,treeName);

Currently i have not managed to successfully exploit this bug on x86.

How to reproduce :

ncplogin -T `perl -e '{print"a"x"330"}'`
ncpmap -T `perl -e '{print"a"x"330"}'` /

Tested on ncpfs-2.2.4-1 from fedora core 2

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBqxzaFTSet8AbQUQRAiycAJ4+5YDHawXMrXiu2wPHt6IRN2Xx0wCeM7vm
LpGHtO/7DHkoRO18OQwve4M=
=YwvU
-----END PGP SIGNATURE-----

------- Comment #1 From Thierry Carrez (RETIRED) 2004-11-29 14:01:52 0000 -------
Pulling net-fs for advice...

I don't know ncpfs so I can't tell if it's a real vulnerability or just an overflow in command-line argument that can be exploited by local users to execute code with their own rights (i.e. a bug, but not a vulnerability). Is ncplogin/ncpmap suid root ? Is the "-T" option argument directly under the control of a remote attacker ?

------- Comment #2 From Maurice van der Pot 2004-11-29 14:20:42 0000 -------
-rws--x--x  1 root root 2529574 Nov 29 23:19 /usr/bin/ncplogin
-rws--x--x  1 root root 2424639 Nov 29 23:19 /usr/bin/ncpmap

All I have time for right now.

------- Comment #3 From Thierry Carrez (RETIRED) 2004-11-30 01:00:03 0000 -------
Hmm interesting.
So it's a potential local root through overflow on a SUID root binary.

No fixed version yet. Upstream should be contacted for a fixed version, if they don't react it looks like an easy patch.

------- Comment #4 From Maurice van der Pot 2004-11-30 10:50:33 0000 -------
Upstream has just released a 2.2.5 version
(ftp://platan.vc.cvut.cz/pub/linux/ncpfs/Changes-2.2.5)
From the changelog:

ChangeSet@1.294, 2004-11-30 16:42:25+01:00
  Fix bad buffer overflow in NWDSCreateContextHandleMnt.  Plus fix
  bogus interpretation of treeName.  And split 
  NWDSCreateContextHandleMnt into two functions, anything taking string
  as argument must take context, as string's encoding is defined by 
  context settings...

strcpy_cw is still present in the source, but it is no longer called. The 
treename input is now handled in a completely different way.

!!! NOTE: I'm not saying that it fixes the problem, I'm just saying that it
looks like they have worked on it !!!

------- Comment #5 From Thierry Carrez (RETIRED) 2004-11-30 12:13:35 0000 -------
Please provide an ebuild for that version, we'll test that the vulnerability is
gone there.

------- Comment #6 From Maurice van der Pot 2004-11-30 13:54:48 0000 -------
It'll take another 20 hours or so before I get a chance to do the ebuild.
If anyone else can do it sooner, go right ahead. I'm not the maintainer anyway.

------- Comment #7 From Maurice van der Pot 2004-12-01 13:40:45 0000 -------
Version 2.2.5 is now in portage. The build succeeds, but that is all I can
test.
All keywords have been reverted to "~arch", only x86 and ppc64 have ever been 
"arch". They should test this and mark it stable if it works.

------- Comment #8 From Sune Kloppenborg Jeppesen 2004-12-01 13:53:44 0000 -------
Thx Maurice.

Arches please mark 2.2.5 stable asap.

------- Comment #9 From Markus Rothe 2004-12-01 22:23:01 0000 -------
Created an attachment (id=45113) [details]
Access violation output

Hi. I'm getting an access violation with 2.2.5. I don't get this with latest
stable marked version (2.2.3).

------- Comment #10 From Sune Kloppenborg Jeppesen 2004-12-01 23:29:50 0000 -------
Back to ebuild status. Maurice please look into this.

------- Comment #11 From Maurice van der Pot 2004-12-02 15:20:58 0000 -------
I'm unable to reproduce this, though I am using the sandbox.
Corsair, can you do some debugging yourself and/or provide more info, such as emerge --info?

------- Comment #12 From Maurice van der Pot 2004-12-02 23:41:17 0000 -------
The most likely candidate for a sandbox violation is the chmod a+r that I do on
the directory to which the source is extracted. I have to do that because the 
directory does not have the +r bits set in the tarball. 

If someone could contact upstream to see if they can make another tarball with the
right permissions, then we can use the same ebuild as for 2.2.3 and we shouldn't
encounter any problems.

------- Comment #13 From Maurice van der Pot 2004-12-03 14:57:36 0000 -------
I wasn't paying attention before; somehow I overlooked Markus' log file.

The problem is not the absence of the +r bit in the tarball, it's the 
installation of a php extension. This extension is only built if php is 
installed when ncpfs is merged.

It would help if someone familiar with php extensions (and the eclasses) could 
take a look at this. Besides, I will be away this weekend.

------- Comment #14 From Sune Kloppenborg Jeppesen 2004-12-08 00:54:51 0000 -------
Stuart/php please advise.

------- Comment #15 From Stuart Herbert (RETIRED) 2004-12-09 07:29:15 0000 -------
I've committed an updated ebuild which no longer causes a sandbox violation. 
I've also added support for the php USE flag.

Best regards,
Stu

------- Comment #16 From Thierry Carrez (RETIRED) 2004-12-09 08:27:11 0000 -------
Thx Stuart.
x86, ppc64 : please retest the updated ncpfs-2.2.5...

------- Comment #17 From Markus Rothe 2004-12-11 00:15:06 0000 -------
stable on ppc64

------- Comment #18 From Thierry Carrez (RETIRED) 2004-12-14 06:43:28 0000 -------
GLSA drafted. 

x86, we are waiting for you to release... If someone else (net-fs / Stuart) can test and mark stable on x86, I'll take it :)

------- Comment #19 From Peter Johanson (RETIRED) 2004-12-14 08:00:44 0000 -------
Marked this x86 per jaervosz's request. Been using 2.2.5 since it was added,
with no problems.

------- Comment #20 From Thierry Carrez (RETIRED) 2004-12-15 01:45:38 0000 -------
GLSA 200412-09

First Last Prev Next    No search results available      Search page      Enter new bug