centos 6
format weakness #3


Weakness Breakdown


A format string exploit occurs when the data of an input string is evaluated as a command by the program. This class of attacks is very similar to buffer overflows since an attacker could execute code, read the stack or cause new behaviors that compromise security. Learn more about format string attacks on OWASP attack index.

Warning code(s):

If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always 0-terminate.

File Name:



The highlighted line of code below is the trigger point of this particular Centos 6 format weakness.

                  *fd1, *fd2);
  return TRUE;  
  _dbus_warn ("_dbus_full_duplex_pipe() not implemented on this OS\n");
  dbus_set_error (error, DBUS_ERROR_FAILED,
                  "_dbus_full_duplex_pipe() not implemented on this OS");
  return FALSE;

 * Measure the length of the given format string and arguments,
 * not including the terminating nul.
 * @param format a printf-style format string
 * @param args arguments for the format string
 * @returns length of the given format string and args
_dbus_printf_string_upper_bound (const char *format,
                                 va_list     args)
  char c;
  return vsnprintf (&c, 1, format, args);

 * Gets the temporary files directory by inspecting the environment variables 
 * TMPDIR, TMP, and TEMP in that order. If none of those are set "/tmp" is returned
 * @returns location of temp directory
const char*
  static const char* tmpdir = NULL;

  if (tmpdir == NULL)
      /* TMPDIR is what glibc uses, then
       * glibc falls back to the P_tmpdir macro which
       * just expands to "/tmp"
      if (tmpdir == NULL)
        tmpdir = getenv("TMPDIR");

      /* These two env variables are probably
       * broken, but maybe some OS uses them?

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.