Jump to content

Archived

This topic is now archived and is closed to further replies.

theflea912

Mail Security

Recommended Posts

I recently wrote a script that emails the form results to me. I also have a friend who at least acts like he knows PHP and when he looked at the code he said that a command could be entered that would delete the files on the server or on the computor. Is this true? If so, is there a way to correct it or prevent it. The code is below:

------------------------------------------------------------------------

An email has been sent to the Director of Human Resources.
Thank you for apply, you will hear back in a bit.

<?php
$body = "Application Alert!\n\n";
foreach($_POST as $field => $value) {
$body .= sprintf("%s = %s\n", $field, $value);
}

mail("theflea912@gmail.com", "APPLYING PILOT!", $body,
'From: "APPLY" <apply@qantasva.com');
?>

Share this post


Link to post
Share on other sites
i don't think so.

i have already used this code on different site... and it is working fine.

i.e.
mail($getter, $subject , $body, $header_info);

Share this post


Link to post
Share on other sites
Theres not an exploit like that around as far as i know, one of the very few mail() exploits is mail injection which works like sql injection and can be avoided by validating user input.. which should always be done anyway, if you wanna know more theres a nice little article here about it:

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--][a href=\"http://securephp.damonkohler.com/index.php/Email_Injection\" target=\"_blank\"]http://securephp.damonkohler.com/index.php/Email_Injection[/a][/quote]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.