fedora 24
crypto weakness #275

4

Weakness Breakdown


Definition:

This weakness involves creating non-standard or non-tested algorithms, using weak algorithms or applying cryptographic algorithms incorrectly. Algorithms that were once considered safe are commonly later found to be unsafe, as the algorithms were broken.

Warning code(s):

The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment.

File Name:

gpsdrive-2.11/src/friends.c

Context:

The highlighted line of code below is the trigger point of this particular Fedora 24 crypto weakness.

 friends_init ()
{

  char *key, buf2[20];
  int f;
  long int r;
  time_t ti, tii;

  if ((strcmp (local_config.friends_id, "XXX")) == 0)
    {
      r = 0x12345678;
      f = open ("/dev/random", O_RDONLY);
      if (f >= 0)
	{
	  read (f, &r, 4);
	  close (f);
	}
      tii = ti = time (NULL);
      ti = ti & 0xffffff;
      r += ti;

      g_snprintf (buf2, sizeof (buf2), "$ 1$ %08lx$ ", r);
      key = "havenocrypt";
#ifdef HAVE_CRYPT_H
      key = crypt ("fritz", buf2);
      g_strlcpy (local_config.friends_id, (key + 12), sizeof (local_config.friends_id));
#else
      r = r * r;
      g_snprintf (local_config.friends_id, sizeof (local_config.friends_id),
		  "nocrypt%015ld", labs (r));
#endif
      printf ("\nKey: %s,id: %s %Zu bytes, time: %ld\n", key,
	      local_config.friends_id, strlen (local_config.friends_id), ti);
      current.needtosave = TRUE;
    }

	fserver = g_new (friendsstruct, 1);
	friends_buf = g_new (friendsstruct, 1);

	friends_list = gtk_list_store_new (FRIENDS_N_ITEMS,
		G_TYPE_STRING,		/* ID */
		G_TYPE_STRING,		/* NAME */
		G_TYPE_STRING,		/* TYPE */
		G_TYPE_DOUBLE,		/* LAT */
		G_TYPE_DOUBLE,		/* LON */
		G_TYPE_INT,		/* TIMESEC */
		G_TYPE_INT,		/* SPEED */
		G_TYPE_INT,		/* COURSE */
		GDK_TYPE_PIXBUF,	/* ICON */
		G_TYPE_DOUBLE,		/* DIST */ 

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.