rhel 7
race weakness #491

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 or change the link content, a race condition results. Also, it does not terminate with ASCII NUL..

File Name:

fuse-2.9.2/include/fuse_lowlevel_compat.h

Context:

The highlighted line of code below is the trigger point of this particular Red Hat Enterprise Linux 7 race weakness.

 };

struct fuse_session *fuse_lowlevel_new_compat25(struct fuse_args *args,
				const struct fuse_lowlevel_ops_compat25 *op,
				size_t op_size, void *userdata);

size_t fuse_dirent_size(size_t namelen);

char *fuse_add_dirent(char *buf, const char *name, const struct stat *stbuf,
		      off_t off);

#if !defined(__FreeBSD__) && !defined(__NetBSD__)

#include <sys/statfs.h>

struct fuse_lowlevel_ops_compat {
	void (*init) (void *userdata);
	void (*destroy) (void *userdata);
	void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
	void (*forget) (fuse_req_t req, fuse_ino_t ino, unsigned long nlookup);
	void (*getattr) (fuse_req_t req, fuse_ino_t ino,
			 struct fuse_file_info_compat *fi);
	void (*setattr) (fuse_req_t req, fuse_ino_t ino, struct stat *attr,
			 int to_set, struct fuse_file_info_compat *fi);
	void (*readlink) (fuse_req_t req, fuse_ino_t ino);
	void (*mknod) (fuse_req_t req, fuse_ino_t parent, const char *name,
		       mode_t mode, dev_t rdev);
	void (*mkdir) (fuse_req_t req, fuse_ino_t parent, const char *name,
		       mode_t mode);
	void (*unlink) (fuse_req_t req, fuse_ino_t parent, const char *name);
	void (*rmdir) (fuse_req_t req, fuse_ino_t parent, const char *name);
	void (*symlink) (fuse_req_t req, const char *link, fuse_ino_t parent,
			 const char *name);
	void (*rename) (fuse_req_t req, fuse_ino_t parent, const char *name,
			fuse_ino_t newparent, const char *newname);
	void (*link) (fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent,
		      const char *newname);
	void (*open) (fuse_req_t req, fuse_ino_t ino,
		      struct fuse_file_info_compat *fi);
	void (*read) (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,
		      struct fuse_file_info_compat *fi);
	void (*write) (fuse_req_t req, fuse_ino_t ino, const char *buf,
		       size_t size, off_t off, struct fuse_file_info_compat *fi);
	void (*flush) (fuse_req_t req, fuse_ino_t ino,
		       struct fuse_file_info_compat *fi);
	void (*release) (fuse_req_t req, fuse_ino_t ino,
			 struct fuse_file_info_compat *fi);
	void (*fsync) (fuse_req_t req, fuse_ino_t ino, int datasync,
		       struct fuse_file_info_compat *fi);
	void (*opendir) (fuse_req_t req, fuse_ino_t ino, 

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.