centos 6
format weakness #19

4

Weakness Breakdown


Definition:

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.

File Name:

gpm-1.20.6/src/lib/report-lib.c

Context:

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

    int log_level;
   va_list ap;

   if (stat == GPM_STAT_DEBUG) return;

   va_start(ap,text);

   switch(stat) {
      case GPM_STAT_INFO : string = GPM_TEXT_INFO ;
                           log_level = LOG_INFO; break;
      case GPM_STAT_WARN : string = GPM_TEXT_WARN ;
                           log_level = LOG_WARNING; break;
      case GPM_STAT_ERR  : string = GPM_TEXT_ERR  ;
                           log_level = LOG_ERR; break;
      case GPM_STAT_DEBUG: string = GPM_TEXT_DEBUG;
                           log_level = LOG_DEBUG; break;
      case GPM_STAT_OOPS : string = GPM_TEXT_OOPS;
                           log_level = LOG_CRIT; break;
   }
#ifdef HAVE_VSYSLOG
   syslog(log_level, string);
   vsyslog(log_level, text, ap);
#else
   fprintf(stderr,"%s[%s(%d)]:\n",string,file,line);
   vfprintf(stderr,text,ap);
   fprintf(stderr,"\n");
#endif

   if(stat == GPM_STAT_OOPS) exit(1);  /* may a lib function call exit ???? */
} 

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.