in reply to why is this tainted?

Since everyone's answered the question about the taint, I figured I'd mention one thing that jumped out at me immediately: the fact that you are using the email address right from the Param in a SQL Query without sanity-checking it to ensure it's a valid email address.

That's a potentially big security hole, especially when combined with using 'LIKE' in your SQL statement to return matching records. Queries with 'LIKE' perform wildcard matching. If I was Mr. Bad Cracker I could pass your script an email along the lines of *hotmail.com and get back all records for everyone with a Hotmail account.

Granted you are sending the password to an email address, so it's not immediately insecure, but a determined cracker could use this to get a passwords from your site.

Instead of using 'LIKE' (which is also a performance hit since it has to do the wildcard-matching), I would suggest that you canonicalize on uppercasing or lowercasing all entries in your database and do the same to each email address your given, and use '=' in your SQL query. That way, the database can only return one record, and wildcards are treated as literal characters. And as I said before, always always make sure that it's a valid email address you've been given before you even perform your query.

Cheers, Maurice
  • Comment on Re: (Not about the Taint, but another suggestion) - why is this tainted?