centos 6
format weakness #6

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.

                vsyslog(LOG_DAEMON | LOG_WARNING, text, ap2);
#else
               if((console = fopen(GPM_SYS_CONSOLE,"a")) != NULL) {
                  fprintf(console,GPM_STRING_WARN);
                  vfprintf(console,text,ap);
                  fprintf(console,"\n");
                  fclose(console);
               }   
#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
               if((console = fopen(GPM_SYS_CONSOLE,"a")) != NULL) {
                  fprintf(console,GPM_STRING_ERR);
                  vfprintf(console,text,ap);
                  fprintf(console,"\n");
                  fclose(console);
               }

               if((console = fopen(option.consolename,"a")) != NULL) {
                  fprintf(console,GPM_STRING_ERR);
                  vfprintf(console,text,ap3);
                  fprintf(console,"\n");
                  fclose(console);
               }
#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 are the fork()-child */
               break;
         }
         break; /* running gpm */

      /******************** DEBUGGING and CLIENT *****************/
      case GPM_RUN_DEBUG:
         switch(stat) {
            case GPM_STAT_INFO: 

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.