I’ve heard of PHP forms being abused to send email from the person the form is supposed to send to. Is this an actual problem, and if so, how can it be fixed? Is it similar to preventing SQL injection?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You’re talking about email injection security vulnerability. For example, if you’re passing custom headers to the
mail()function like in the following code sample, you’re vulnerable:Consider that a malicious user passes not only his email, but also additional headers like this:
Then a malicious user would send a carbon copy of his supposedly SPAM-ridden message to a virtually unlimited list of users from your server under your name. One can even replace your message completely with his own this way by adding certain otherwise-safe MIME headers. You can only imagine to what consequences this can lead!
Solution is simple: don’t trust anything you receive from a user, and filter/validate the received data.