centos 7
misc weakness #432


Weakness Breakdown


The software specifies permissions for a security-critical resource in a way that allows the resource to be read or modified by unintended actors.

Warning code(s):

This function is obsolete and not portable. It was in SUSv2 but removed by POSIX.2. What it does exactly varies considerably between systems, particularly in where its prompt is displayed and where it gets its data.

File Name:



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

#include <dlfcn.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <ctype.h>
#include "debug.h"
#include "error.h"
#include "cert_info.h"
#include "pkcs11_lib.h"

 * this functions is completely common between both implementation.
int pkcs11_pass_login(pkcs11_handle_t *h, int nullok)
  int rv;
  char *pin;

  /* get password */
  pin =getpass("PIN for token: ");
  DBG1("PIN = [%s]", pin);
  /* for safety reasons, clean PIN string from memory asap */

  /* check password length */
  if (!nullok && strlen(pin) == 0) {
    memset(pin, 0, strlen(pin));
    set_error("Empty passwords not allowed");
    return -1;

  /* perform pkcs #11 login */
  rv = pkcs11_login(h, pin);
  memset(pin, 0, strlen(pin));
  if (rv != 0) {
    /* DBG1("pkcs11_login() failed: %s", get_error()); */
    return -1;
  return 0;


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.