Mitigate Baron SameEdit (CVE-2021-3156) vulnerability

fedora 25
format weakness #12

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:

magicpoint-1.13a/contrib/xmindpath/main.c

Context:

The highlighted line of code below is the trigger point of this particular Fedora 25 format weakness.

 
#include <sys/time.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <termios.h>
#include <signal.h>
#include <X11/X.h>
#include <X11/extensions/XTest.h>
#include <X11/keysym.h>

#ifdef X_DISPLAY_MISSING
# error this program cannot be compiled without X11.
#endif

#ifndef REMOTE_DEVICE
# define REMOTE_DEVICE	"/dev/tty02"	/*biased to VAIO505 :-P*/
#endif

static char *remote = REMOTE_DEVICE;
static int debug = 0;
#define dprintf(x)	{ if (debug) fprintf x; }
static int verbose = 0;
#define verbmsg(x)	{ if (verbose) fprintf x; }

Display *display = NULL;
static uid_t uid, euid;
static gid_t gid, egid;
static int uidswapped = 0;

static void usage __P((void));
static void mainloop __P((int));
static void buttonpress __P((int, int));
static int uucplock __P((char *));
static int uucpunlock __P((char *));
static RETSIGTYPE sigtrap __P((int));
static void daemonuid __P((void));
static void useruid __P((void));

#define EFFECT	0x15
#define LEFT	0x16
#define RIGHT	0x17
#define RELEASE	0x55

int
main(argc, argv)
	int argc;
	char **argv;
{ 

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.