alpine 3.6
tmpfile weakness #69

4

Weakness Breakdown


Definition:

A temporary file weakness occurs when a temporary file that is created and used by a high-privilege process is accidentally shared with a low-privilege process, on account of it being temporary and generated after all security controls have been applied. This allows the low-privilege process to read data from the high-privilege process (information leakage), or worse, influence the high-privilege process by modifying the shared temporary file.

Warning code(s):

Temporary file race condition.

File Name:

tarsnap/src/tarsnap-autoconf-1.0.37/libarchive/archive_windows.h

Context:

The highlighted line of code below is the trigger point of this particular Alpine 3.6 tmpfile weakness.

 #define	NULL    ((void *)0)
#endif
#endif

/* Replacement for major/minor/makedev. */
#define	major(x) ((int)(0x00ff & ((x) >> 8)))
#define	minor(x) ((int)(0xffff00ff & (x)))
#define	makedev(maj,min) ((0xff00 & ((maj)<<8))|(0xffff00ff & (min)))

/* Alias the Windows _function to the POSIX equivalent. */
#define	access		_access
#define	chdir		la_chdir
#define	chmod		la_chmod
#define	close		_close
#define	fcntl		la_fcntl
#define	fileno		_fileno
#define	fstat		la_fstat
#define	getcwd		_getcwd
#define	lseek		la_lseek
#define	lstat		la_stat
#define	open		la_open
#define	stat		_stat
#define	mbstowcs	la_mbstowcs
#define	mkdir(d,m)	la_mkdir(d, m)
#define	mktemp		_mktemp
#define	read		la_read
#define	rmdir		la_rmdir
#define	strdup		_strdup
#define	tzset		_tzset
#define	umask		_umask
#define	unlink		la_unlink
#define	waitpid		la_waitpid
#define	write		la_write

#define	O_RDONLY	_O_RDONLY
#define	O_WRONLY	_O_WRONLY
#define	O_TRUNC		_O_TRUNC
#define	O_CREAT		_O_CREAT
#define	O_EXCL		_O_EXCL

#ifndef _S_IFIFO
  #define	_S_IFIFO        0010000   /* pipe */
#endif
#ifndef _S_IFCHR
  #define	_S_IFCHR        0020000   /* character special */
#endif
#ifndef _S_IFDIR
  #define	_S_IFDIR        0040000   /* directory */
#endif
#ifndef _S_IFBLK 

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.