J-Security Center

Title: Multiple Vendor BSD fstat Format String Vulnerability

Severity: MODERATE

Description:

fstat is a program shipped with BSD unix variants that is used to list the open files on a system. It is installed sgid kmem so it can access information about open files from the kernel memory structures.

A user definable environment variable (PWD, parent working directory) is passed as the only argument to a *printf() function within fstat. As a result, it is possible for a user to exec fstat with a value for the PWD variable that contains malicious format specifiers. These format specifiers could be layed out in the environment variable in a way that causes the *printf function interpreting them to overwrite certain bytes on the stack (like those that the return address of the function called is composed of) and manipulate the flow of execution.

An attacker, upon successful exploitation of this vulnerability, would inherit the effective privileges of the running fstat program: egid kmem. Further compromise for an experienced hacker would be trivial.

It is likely that this vulnerability affects all modern BSDs, though as of yet only OpenBSD is confirmed.

Affected Products:

  • OpenBSD OpenBSD 2.3.0
  • OpenBSD OpenBSD 2.4.0
  • OpenBSD OpenBSD 2.5.0
  • OpenBSD OpenBSD 2.6.0
  • OpenBSD OpenBSD 2.7.0

References:

Juniper Networks provides this content via a wide variety of sources and production methods. If notified of errors or omissions in the content of this page, Juniper Networks, at its discretion, will modify or remove the page or leave the content as is, depending on various factors including but not limited to the reputation and authority of the party providing the notification. Please use the contact information displayed elsewhere on this page to report any errors or omissions regarding the content on this page.