Re: Is this PHP code secure from CSS ?

From: Cedric Blancher (blancher_at_cartel-securite.fr)
Date: 09/26/03

  • Next message: Ganbold: "sample buffer overflow exploit problem"
    To: kha <kha.kha@laposte.net>
    Date: Fri, 26 Sep 2003 22:11:24 +0200
    
    

    Le ven 26/09/2003 à 17:21, kha a écrit :
    > $login = mysql_escape_string($post-login);
    > $password = mysql_escape_string($post-password);
    > $lines = performQuery("select id from users where name='$login' and
    > pass='$password'");
    > Do i need only the mysql_escape_string function to prevent sql injections in
    > the form or i should perform other checks ?

    You should perform any test you can perform. mysql_escape_string can
    happen to be buggy one day, who knows. Another cool function you can use
    for input validation is PHP safe mode magic_quotes_* settings.

    Anyway, if you decide both login and password should contains only
    alphanumeric characters, you should enforce $login and $password against
    a [a-zA-Z0-9] based expression before constructing your SQL query.

    > NB : passwords are not yet encrypted in the database.

    :/

    NB : what you want to avoid here is not CSS (one usually says XSS), but
         SQL injection.

    -- 
    http://www.netexit.com/~sid/
    PGP KeyID: 157E98EE FingerPrint: FA62226DA9E72FA8AECAA240008B480E157E98EE
    

  • Next message: Ganbold: "sample buffer overflow exploit problem"

    Relevant Pages

    • Re: Removing Gnome
      ... Linux a écrit: ... > up too much memory. ... Is there an easy way to disable this from login and ... > run something more svelte? ...
      (comp.os.linux.setup)
    • Re: SMC 3.0
      ... try admin... ... mika a écrit: ... > but it's say me that the login is incorrect. ...
      (comp.unix.solaris)
    • Re: Big Brother ;-)
      ... >> I'd like to know if threre's a way to abtain an history on user's ... >> login, and how to do... ...
      (comp.unix.admin)