centos 6
format weakness #1

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:

cjet089/io.c

Context:

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

  *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 *
 *  io.c - input/output
 *
 *  #define get_next_char()     fgetc(infile)
 *  #define unget_char(a)       ungetc(a,infile)
 */

#include "cjet.h"


/* 
 * output a string, either directly to the printer or to the 
 * macro recording buffer 
 */

void PutString(char *format, ... )
{
  va_list stuff;
  va_start(stuff, format);
  vfprintf(outfile, format, stuff);
  va_end(stuff);
}


void put_next_char( int c)
{
  if(recording == TRUE) {
    /* record in macro buffer */
  }
  else
    fputc (c,outfile);
}


/* 
 * read file/pipe routine with 'helpful' error message 
 */

void pipe_read( BYTE *p, int size)
{
  if ( fread(p,1,size,infile) != size) {
    MorePanic(UN_RFILE, "input", 0);
    exit(1);           /* yes, a bit abrupt */
  }
} 

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.