centos 6
format weakness #18

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/report.c

Context:

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

 #else
               fprintf(stderr,GPM_STRING_INFO);
               vfprintf(stderr,text,ap);
               fprintf(stderr,"\n");
#endif
               break;

            case GPM_STAT_WARN:
#ifdef HAVE_VSYSLOG
               syslog(LOG_DAEMON | LOG_WARNING, GPM_STRING_WARN);
               vsyslog(LOG_DAEMON | LOG_WARNING, text, ap2);
#else
               fprintf(stderr,GPM_STRING_WARN);
               vfprintf(stderr,text,ap);
               fprintf(stderr,"\n");
#endif
               break;

            case GPM_STAT_ERR:
#ifdef HAVE_VSYSLOG
               syslog(LOG_DAEMON | LOG_ERR, GPM_STRING_ERR);
               vsyslog(LOG_DAEMON | LOG_ERR, text, ap2);
#else
               fprintf(stderr,GPM_STRING_ERR);
               vfprintf(stderr,text,ap);
               fprintf(stderr,"\n");
#endif
               break;

            case GPM_STAT_OOPS:
#ifdef HAVE_VSYSLOG
               syslog(LOG_DAEMON | LOG_ERR, GPM_STRING_OOPS);
               vsyslog(LOG_DAEMON | LOG_ERR, text, ap2);
#endif               
               fprintf(stderr,GPM_STRING_OOPS);
               vfprintf(stderr,text,ap);
               fprintf(stderr,"\n");

               exit(1); /* we should have a oops()-function,but this works,too*/
               break;
         }
         break; /* startup sequence */   

      /******************** RUNNING *****************/
      case GPM_RUN_DAEMON:
         switch(stat) {
            case GPM_STAT_INFO:
#ifdef HAVE_VSYSLOG
               syslog(LOG_INFO | LOG_USER, GPM_STRING_INFO);
               vsyslog(LOG_INFO | LOG_USER, text, ap2); 

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.