Re: Format String Exploits

From: R.C.S (rastaat_private)
Date: Thu Apr 12 2001 - 14:19:28 PDT

  • Next message: Schlecht, Ron: "Re: Ports vulnerability database"

    main(int argc, char **argv)
    {
      printf("%s\n",argv[1]);
    }
    
    Shows that C printf works well!
    
    printf(argv[1]);
    
    don't.
    
    and perls printf $ARGV[0];
    
    ./fmt.pl %.6x
    will produce
    000000
    
    Clifford, Shawn A <shawn.a.cliffordat_private> wrote:
    > A better comparison is:
    >
    > ------ test_printf.pl ------
    > #!/usr/local/bin/perl
    >
    > printf("%s\n", $ARGV[0]);
    > _____________________________
    > ./test_printf.pl %x%x%x%x%x%x
    >
    > Will product this:
    >
    > %x%x%x%x%x%x
    >
    > Showing that Perl's printf formatting works well.
    >
    > -- Shawn
    >
    > Larry W. Cashdollar wrote:
    > > perl's print function doesnt use tokens to format its output like
    > > printf() in C.  A little test of this:
    > >
    > > ------- test.pl -------
    > > #!/usr/bin/perl
    > >
    > > $ARGC = @ARGV;
    > >
    > > print $ARGV[0];
    > >
    > > $ ./test.pl %x%x%x%x%x%x
    > >
    > > Will produce this:
    > >
    > > %x%x%x%x%x%x
    
    --
    http://www.rshell.org
    rastaat_private
    



    This archive was generated by hypermail 2b30 : Fri Apr 13 2001 - 12:58:10 PDT