centos 6
format weakness #14

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.

 #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:
               console = stdout;
               fprintf(console,GPM_STRING_INFO); break;
            case GPM_STAT_WARN:
               console = stderr;
               fprintf(console,GPM_STRING_WARN); break;
            case GPM_STAT_ERR:
               console = stderr;
               fprintf(console,GPM_STRING_ERR); break;
            case GPM_STAT_DEBUG:
               console = stderr;
               fprintf(console,GPM_STRING_DEBUG); break;
            case GPM_STAT_OOPS:
               console = stderr;
               fprintf(console,GPM_STRING_OOPS); break;
         }

         vfprintf(console,text,ap);
         fprintf(console,"\n");
         
         if(stat == GPM_STAT_OOPS) exit(1);

         break;
   } /* switch for current modus */

   va_end(ap);
   va_end(ap3);
#ifdef HAVE_VSYSLOG
   va_end(ap2);
#endif
} /* gpm_report */   


/* old interesting part from debuglog.c.
 * interesting, if you want to include ERRNO into syslog message
 * should possibly included again later...when sources are clean and
 * there is no doubled strrer(errno)  

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.