Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Apr 2002 18:40:05 +0200
From:      Bjoern Fischer <bfischer@Techfak.Uni-Bielefeld.DE>
To:        Jordan Hubbard <jkh@winston.freebsd.org>
Cc:        hackers@FreeBSD.ORG
Subject:   OT: Better fake challenges [Re: ssh + compiled-in SKEY support considered harmful?]
Message-ID:  <20020423164005.GB258@frolic.no-support.loc>
In-Reply-To: <200204230039.g3N0dQ8i011313@winston.freebsd.org>
References:  <200204230039.g3N0dQ8i011313@winston.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hello,

> jhubbard@wafer-> ssh jkh@winston.freebsd.org
> otp-md5 114 wi7854 ext
> S/Key Password:=20
> otp-md5 117 wi5044 ext
> S/Key Password:=20
> otp-md5 397 wi0652 ext
> S/Key Password:=20
> jkh@winston.freebsd.org's password:=20

If anyone is concerned about revealing too much information on
valid/invalid OTP login names through S/Key or OPIE fake challanges,
here is a proof of concept of a much better stateless fake challenge
generator. It shouldn't be possible to distuingish valid from invalid
OTP login names by just giving a few login attempts. It would not
last a statistical analysis, but that many failed login attempts
should show up in the logs and raise an alert condition.

-Bj=F6rn

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
#!/usr/bin/perl -w

#
# It should not be important to have two distinct secrets
#
my $secret1 =3D "Soylent Green is human!";
my $secret2 =3D "Komm suesser Tod (BWV 471)";

#
# The sequence number should not drop beyond 3, since the user needs
# a sequence number to reset the counter.
#
my $init_seq =3D 499;
my $min_seq =3D 2;
my $max_seq =3D $init_seq - $min_seq;

#
# get_fake_challenge(const char *login, time_t esec)
#
# This subroutine computes a sufficiently good fake sequence
# for a given login name and a date.
#
sub get_fake_challenge {

  my ($login, $esec) =3D @_;

  #
  # Assuming, a user logs in a few times a day, we have to use a login
  # schedule, that is constant (but different) for each user.
  #
  my $lognums =3D 2 + (hex substr(`md5 -q -s "$login$secret1"`, 0, 1)) % 7;
  my $delta =3D int (($esec / ((24 * 60 * 60) / $lognums)) / $max_seq);

  #
  # Compute seed and sequence number
  #
  my $seed =3D `md5 -q -s "$delta$login$secret2"`;
  chomp $seed;
  my $seq =3D $init_seq -
            ((int ($esec / ((24 * 60 * 60) / $lognums))) % $max_seq);

  return ($seq, $seed);

}

#
# testcase
#
my $testlogin =3D "nouser";

$i =3D 1;
for ($date =3D 1016265366; $date < 1226000000; $date +=3D 1) {
  ($seq, $seed) =3D get_fake_challenge ("nouser", $date);
  ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =3D
    localtime($date);
  printf ("%02u.%02u.%04u %02u:%02u:%02u (%03u, %s)\n",
          $mday+1, $mon, $year+1900, $hour, $min, $sec, $seq, $seed);
  if (!($i++ % 40)) {
    $i =3D 1;
    print "Press [RETURN].";
    <>;
  }
}


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020423164005.GB258>