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

Filename Description Type Creator Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 91792 depends on: Show dependency tree
Show dependency graph
Bug 91792 blocks:

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







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


Description:   Opened: 2005-05-07 04:59 0000
Hello,

Just take a look at /usr/bin/fixproc

Line 233 :

# it must be "shell", so execute the shell script defined in database

local ($tmpfile) = "/tmp/fix_$$";
 	
&create_sh_script ($fix{$proc}, $tmpfile);
 
# return code is number divided by 256
$error_code = (system "$tmpfile") / 256;

-----------------------------------------

We see that the tmp file is created with $$ value and this script is execute by the perl system command

The subfunction do only this :

-------------------------------------

sub create_sh_script
{
  local ($file) = pop (@_);
  local ($i) = pop (@_);

  printf (stderr "create_sh_script\n") if ($debug > 0);

  $! = $fixproc_error;
  open (file, ">"."$file") || die "$0: cannot open $file\n";
  while ( $shell_lines[$i] ne $shell_end_marker )
    {
      printf (file "%s", $shell_lines[$i]);
      $i++;
    }
  close (file);
  system "chmod +x $file";
  return file;
}

----------------------------------------

My knowledge in perl is not so good, but maybe a toctou or race condition could be exploited here, and permit to a basic user to run arbitrairie commands on the system ?

Regards?

Reproducible: Always
Steps to Reproduce:
1.
2.
3.

Actual Results:  
local ($tmpfile) = "/tmp/fix_$$"; is created without mktemp and chmod

Expected Results:  
local ($tmpfile) = "/tmp/fix_$$"; should, maybe, created with mktemp and chmod

------- Comment #1 From Sune Kloppenborg Jeppesen 2005-05-07 10:11:19 0000 -------
Auditors please confirm.

------- Comment #2 From Robert Paskowitz (RETIRED) 2005-05-07 21:03:09 0000 -------
Looks like it could be a legitimate problem, but a call to mktemp from a perl
script seems a bit excessive. Also, the same thing happens in do_check, so if
one is to be fixed, the second should as well.

------- Comment #3 From Sune Kloppenborg Jeppesen 2005-05-09 23:15:34 0000 -------
Taviso/Tigger/Solar please advise.

------- Comment #4 From Tavis Ormandy (RETIRED) 2005-05-11 15:12:58 0000 -------
Confirmed, insecure tmp file handling, with a race condition for arbitrary
command execution.

File::Temp should be used instead of a pid based template.

------- Comment #5 From Sune Kloppenborg Jeppesen 2005-05-11 21:17:13 0000 -------
Max will you relay this to upstream?

------- Comment #6 From Thierry Carrez (RETIRED) 2005-05-15 08:32:15 0000 -------
Or maybe the reporter (eromang) wants to report upstream to get the credits ?

------- Comment #7 From Romang 2005-05-17 01:13:15 0000 -------
Hello,

OK i have contact upstream.

http://sourceforge.net/tracker/index.php?func=detail&aid=1203376&group_id=12694&atid=112694

Regards.

------- Comment #8 From Romang 2005-05-17 23:26:31 0000 -------
Hello,

Take a look on this :

http://rpmfind.net/linux/RPM/suse/9.1/i386/suse/i586/net-snmp-5.1-80.i586.html

* Tue Mar 16 2004 - ro@suse.de
  - use mktemp in fixproc (#36103)

But net-snmp-5.2.1 still not corrected ....

It seem that the upstream doesn't care about this bug.

Regards.

------- Comment #9 From Aaron Walker (RETIRED) 2005-05-18 08:30:53 0000 -------
5.2.1-r1 is in CVS. x86 stable. CC'd archs please stable.

------- Comment #10 From Markus Rothe 2005-05-18 10:17:38 0000 -------
stable on ppc64

------- Comment #11 From Michael Hanselmann (hansmi) (RETIRED) 2005-05-18 10:27:25 0000 -------
Stable on ppc.

------- Comment #12 From Jan Brinkmann (RETIRED) 2005-05-18 10:38:12 0000 -------
stable on amd64

------- Comment #13 From René Nussbaumer 2005-05-18 11:51:39 0000 -------
stable on hppa

------- Comment #14 From Jason Wever (RETIRED) 2005-05-18 14:49:22 0000 -------
Sparcky SPARC and the Stable Bunch

------- Comment #15 From Bryan Østergaard (RETIRED) 2005-05-20 11:36:06 0000 -------
Stable on alpha + ia64.

------- Comment #16 From Thierry Carrez (RETIRED) 2005-05-20 14:16:16 0000 -------
Ready for GLSA vote

------- Comment #17 From Thierry Carrez (RETIRED) 2005-05-21 02:05:22 0000 -------
Tool is administration-related and in path, I vote YES

------- Comment #18 From Matthias Geerdsen 2005-05-22 07:27:35 0000 -------
I agree with koon, there should be a GLSA.

------- Comment #19 From Romang 2005-05-22 07:39:19 0000 -------
Hello,

I agree also, if a GLSA is out, maybe upstream gonna correct the vulnerability :)

Regards.

------- Comment #20 From Sune Kloppenborg Jeppesen 2005-05-23 13:42:24 0000 -------
GLSA 200505-18  
 
arm, mips please remember to mark stable to benifit from the GLSA. 

------- Comment #21 From Romang 2005-05-23 14:10:04 0000 -------
Hello,

Updates from upstream :

https://sourceforge.net/tracker/?func=detail&atid=112694&aid=1203376&group_id=12694

Also, published on :

http://www.zataz.net/adviso/net-snmp-05182005.txt

Regards.

------- Comment #22 From Hardave Riar (RETIRED) 2005-07-02 19:55:29 0000 -------
Stable on mips.

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