Google weiß alles: Ein Lösungsweg

Beitrag lesen

Das Passwort wird mittels Perl über die Funktion crypt erstellt.

Ja. Und genau das ist der Fehler. crypt benutzt sha1 ohne Salt welches sogar unsicherer als die Apache-eigene, schwache und schwach gesalzene Implementation von MD5 ist.

Sowas könnte Abhilfe schaffen, wird aber nicht jedem gefallen:

sub htpasswd_wrapper {
    ## return a fin hashed password for Apache 2.4 oder 2.2
    ## usage htpasswd_wrapper($passwd_clear, '2.4') or usage htpasswd_wrapper($passwd_clear, '2.2')

     my $passwd_clear = shift;
     $passwd_clear =~ s/\"/\\\"/g;
     $passwd_clear =~ s/\`/\\\`/g;
     my $version = shift;

    my $sys; my $passwd_hash;

    if ( $version eq "2.2" ) {
        $sys = "echo \"$passwd_clear\" | /usr/bin/htpasswd -i -n \"USER\";";
        print $sys;
    } elsif ( $version eq "2.4" ) {
        $sys = "echo \"$passwd_clear\" | /usr/bin/htpasswd -i -n -B \"USER\";";
        print $sys;
    } else {
        $sys=false;
    }

    if ($sys) {
        $passwd_hash = `$sys`;
        $passwd_hash =~ s/^USER://;
        return $passwd_hash;
    } else {
        return false;
    }
}
$passwd_hash = htpasswd_wrapper("ha'llo", '2.4');
print $passwd_hash . "\n";
$passwd_hash = htpasswd_wrapper('ha"llo', '2.4');
print $passwd_hash . "\n";
$passwd_hash = htpasswd_wrapper('ha`ll`o', '2.4');
print $passwd_hash . "\n";
0 39

Apache Passwortlänge

piet
  • apache
  • perl
  • sicherheit
  1. 0
    dedlfix
  2. 0
    Google weiß alles
  3. 2

    Eine ganz generelle Bitte

    Google weiß alles
    1. 0
      piet
      1. 0
        MudGuard
        1. 0
          piet
          1. 0
            MudGuard
            1. 0
              piet
              1. 1

                Boah (Whiskey Tango Foxtrott)

                Google weiß alles
                • sicherheit
              2. 0
                dedlfix
      2. 0
        woodfighter
        1. 0
          piet
          1. 0
            woodfighter
            1. 0

              htpasswd

              Google weiß alles
          2. 0

            https

            Google weiß alles
            • apache
            • sicherheit
      3. 0

        Ein Lösungsweg

        Google weiß alles
        • apache
        1. 0
          Google weiß alles
          1. 0

            Vorsicht: Injection-Lücke

            woodfighter
            • apache
            • sicherheit
            1. 0
              dedlfix
              • menschelei
              • sicherheit
          2. 0
            Christian Kruse
            1. 0
              Google weiß alles
              1. 0
                woodfighter
                • apache
                • perl
                1. 0
                  Google weiß alles
                  1. 0
                    woodfighter
                    1. 0

                      Perl 5 und UTF-8 ...

                      Google weiß alles
                      1. 0
                        woodfighter
                        • perl
                        1. 0
                          Matthias Apsel
                          • menschelei
                          1. 0
                            woodfighter
                            1. 0
                              Matthias Apsel
                              1. 0
                                woodfighter
                                1. 0
                                  Matthias Apsel
                        2. 0
                          Google weiß alles
                  2. 0

                    Warum bei Perl bleiben?

                    Mitleser
                    • apache
                    • meinung
                    • perl
              2. 0
                woodfighter
                1. 0
                  Google weiß alles
            2. -1
              pl
              • apache
              • perl
              1. 0
                Mitleser
                1. 0
                  Thars