alpine 3.8
format weakness #2

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:

aoetools/src/aoetools-aoetools-37/aoe-sancheck.c

Context:

The highlighted line of code below is the trigger point of this particular Alpine 3.8 format weakness.

 
#include <stdio.h>
#include <sched.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <pthread.h>
#include <poll.h>
#include <errno.h>

#include <netpacket/packet.h>
#include <net/ethernet.h>
#include <sys/types.h>
#include <net/if.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/socket.h>

#define	nelem(x)	(sizeof(x)/sizeof((x)[0]))
#define nil NULL
#define vprintf(...) if (qflag) ; else fprintf(stderr, __VA_ARGS__)
#define mintu(x) ((x) > 60 ? x : 60)

typedef unsigned char uchar;
typedef unsigned long ulong;

typedef struct Aoe Aoe;
typedef struct Qc Qc;
typedef struct Ata Ata;
typedef struct Lun Lun;
typedef struct Eth Eth;
typedef struct Targ Targ;
typedef struct Mac Mac;

struct Aoe {
	uchar dst[6];
	uchar src[6];
	uchar type[2];
	uchar flags;
	uchar error;
	uchar major[2];
	uchar minor;
	uchar cmd;
	uchar tag[4];
};
 

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.