centos 7
race weakness #5

5

Weakness Breakdown


Definition:

A race condition exists when parallel code accesses shared data without proper coordination. An attack that uses a race-condition weakness takes advantage of the unsafe data access to manipulate how one of the parallel sections of code reacts. Even though each process runs as intended, the outcome is unexpected. For example, consider a bank service that depends on an encryption key that it reads from a known location. An independent cryptography service is responsible for generating the key and placing it where the bank is expected to read it in a timely manner. If the bank and cryptography services do not coordinate with each other, then the bank may read a blank encryption key before cryptography writes the key to the location. This can effectively turn off all encryption for the bank without either service, or the administrator, knowing that something has gone wrong.

Warning code(s):

This accepts filename arguments; if an attacker can move those files, a race condition results..

File Name:

fuse-2.9.2/include/fuse_compat.h

Context:

The highlighted line of code below is the trigger point of this particular Centos 7 race weakness.

 			       size_t op_size);

struct fuse *fuse_setup_compat22(int argc, char *argv[],
				 const struct fuse_operations_compat22 *op,
				 size_t op_size, char **mountpoint,
				 int *multithreaded, int *fd);

int fuse_main_real_compat22(int argc, char *argv[],
			    const struct fuse_operations_compat22 *op,
			    size_t op_size);

typedef int (*fuse_dirfil_t_compat) (fuse_dirh_t h, const char *name, int type);
struct fuse_operations_compat2 {
	int (*getattr)	   (const char *, struct stat *);
	int (*readlink)	   (const char *, char *, size_t);
	int (*getdir)	   (const char *, fuse_dirh_t, fuse_dirfil_t_compat);
	int (*mknod)	   (const char *, mode_t, dev_t);
	int (*mkdir)	   (const char *, mode_t);
	int (*unlink)	   (const char *);
	int (*rmdir)	   (const char *);
	int (*symlink)	   (const char *, const char *);
	int (*rename)	   (const char *, const char *);
	int (*link)	   (const char *, const char *);
	int (*chmod)	   (const char *, mode_t);
	int (*chown)	   (const char *, uid_t, gid_t);
	int (*truncate)	   (const char *, off_t);
	int (*utime)	   (const char *, struct utimbuf *);
	int (*open)	   (const char *, int);
	int (*read)	   (const char *, char *, size_t, off_t);
	int (*write)	   (const char *, const char *, size_t, off_t);
	int (*statfs)	   (const char *, struct statfs *);
	int (*flush)	   (const char *);
	int (*release)	   (const char *, int);
	int (*fsync)	   (const char *, int);
	int (*setxattr)	   (const char *, const char *, const char *,
			    size_t, int);
	int (*getxattr)	   (const char *, const char *, char *, size_t);
	int (*listxattr)   (const char *, char *, size_t);
	int (*removexattr) (const char *, const char *);
};

int fuse_main_compat2(int argc, char *argv[],
		      const struct fuse_operations_compat2 *op);

struct fuse *fuse_new_compat2(int fd, const char *opts,
			      const struct fuse_operations_compat2 *op);

struct fuse *fuse_setup_compat2(int argc, char *argv[],
				const struct fuse_operations_compat2 *op,
				char **mountpoint, int *multithreaded, int *fd); 

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.