Vulnerability Note VU#6901

Solaris libc getopt(3) contains buffer overflow

Original Release date: 25 Sep 2003 | Last revised: 25 Sep 2003


Solaris libc getopt(3) contains a buffer overflow vulnerability. Please note the date of this report: 1/27/1997. This does not affect current versions of Solaris.


From <>:

A buffer overflow condition exists in the getopt(3) routine in Solaris libc. By supplying an invalid option and replacing argv[0] of a SUID program that uses the getopt(3) function with the appropriate address and machine code instructions, it is possible to overwrite the saved stack frame and upon return(s) force the processor to execute user supplied instructions with elevated permissions.


A local user can gain root access.


Please see <>.

From <>:

For those with source:
If you are one of the few people who have a source code license the fix should be fairly simple. Replace the sprintf() routine in getopt.c with snprintf() and rebuld libc.

Super Ugly kludge fix:
If you don't have the source code available (like most of us), one solution is to use adb to change the name for getopt with something like getopz, yank a publicly available getopt.c, and put it in place of getopt.

See also section 4. of <>.

Systems Affected (Learn More)

VendorStatusDate NotifiedDate Updated
Sun Microsystems Inc.Affected-25 Sep 2003
If you are a vendor and your product is affected, let us know.

CVSS Metrics (Learn More)

Group Score Vector
Base N/A N/A
Temporal N/A N/A
Environmental N/A N/A



Thanks to L0pht/@stake and Sun for information used in this document.

This document was written by James T. Ellis and updated by Art Manion.

Other Information

  • CVE IDs: Unknown
  • Date Public: 27 Jan 97
  • Date First Published: 25 Sep 2003
  • Date Last Updated: 25 Sep 2003
  • Severity Metric: 3.92
  • Document Revision: 6


If you have feedback, comments, or additional information about this vulnerability, please send us email.