All of my Drupal sites are sending me webform "replies" from @domain.com I was at another forum website and this topic came up, but not related to Drupal. The general consensus was that it is a result of a vulnerability in the form parsing script used. Do you care to comment on this? The other discussion is here: http://www.webmasterworld.com/forum10/9776.htm
Comments
Comment #1
ullgren commentedI'm not really sure what's the problem and I'm not in the mode to sign-up to some webform to find out.
Please copy paste the valid parts of the discussion into this issue.
The webform module uses the sites email address (specified in the site settings, admin -> settings).
If this field is empty the address is specified as "webmail@{$_SERVER['SERVER_NAME']}" that is webmail@www.example.com if ServerName in your httpd.conf is www.example.com.
I've tested both with and without setting the site email setting and I get both user and domain part in the from field of the email messages send by webform submissions. I would suggest that you set your site email adress under the site settings to a valid adress.
If on the other hand your problem is spambots missusing your webforms to send you spam I would suggest setting the permissions of the forms so that only authenticated users may use them.
Comment #2
jo1ene commentedYou don't have to sign up for anything. I though you may want to glance through the thread in it's entirety (< 30 messages) to see the back and forth on the theories. Besides, the discussion is a hair too technical for me so I'm not sure which messages would help you most. Maybe this? It seems to sum up the problem.
Yes, this is the issue. I could only allow authenticated users to send form responses, which was a prevension method mentioned in the aforementioned thread, but I believe this would cut down on my inquiries. I'm not running a communtity site. And I do, in fact, have my email setting set properly.
Comment #3
ullgren commentedHmm ... yesterday the link you submitted sent me to a "Register for access"-page but today I get the forum.
Thanks for the detailed explination on the matter.
The module have a option to disallow cross-site postings. That is it checks the HTTP_REFERER to check if the post came from the right site. I know this could be forged and a challenge-response approach would be more secure.
As I see it there are two cases this vurnability can be used agains webform. This is when you choose one of the fields to be SUBJECT and FROM address. In this cases these field may be used to insert headers into the email message and should be screened.
All other fields that are recieved from the user is added to the email _body_ and will be ignored by all sensible MTAs (who should ignore all header like information in the body part of the message). So in this perspective I disagree with you that ANY filed may be used to insert header information.
Also in Drupal some header fields (in this case the SUBJECT, TO and FROM addresses) are mime_header_encode() before used for sending the email message. I don't know if this gives any protection but I will investigate further.
Comment #4
jo1ene commentedThanks for taking a look into this. I got hit with two rounds of this in the last four days. I checked my setup and I have the SUBJECT and FROM field set to automatic. Does this contradict your first point?
Your second point seems true because none of these messages have any BODY content. Another site that I manage that is getting hit with this does not use webform and those messages do have BODY content.
BTW, the opinion I posted previously (highlighted) is not my own.
Comment #5
nshb commentedOne method of fixing this site wide would be to add this to your /modules/user.module
Locate the "function user_mail(.."
function user_mail($mail, $subject, $message, $header) {
And add these lines:
// START - SPAM FILTER
// check if they are spamming using a bcc hack
if (preg_match('/b*cc\s*:/i', $mail)
|| preg_match('/b*cc\s*:/i', $subject)
|| preg_match('/b*cc\s*:/i', $message)
|| preg_match('/b*cc\s*:/i', $header)
) {
return FALSE;
}
// check if they are spamming using a bcc hack
if (preg_match('/content\-type/i', $mail)
|| preg_match('/content\-type/i', $subject)
|| preg_match('/content\-type/i', $message)
|| preg_match('/content\-type/i', $header)
) {
return FALSE;
}
// END - SPAM FILTER
This will break out any email prior to sending a unsolicited spam message.
Comment #6
jo1ene commentedThank you for the tip. I uploaded this code and will report back here on how effective it is.
Comment #7
jo1ene commentedSo far, so good. I was getting hit every few days, but I haven't been hit in two weeks after adding the code suggested.
Comment #8
ullgren commentedAdded these checks before calling user_mail.
Fixed in CVS HEAD
Comment #9
joel_guesclin commentedI seem to have hit this same problem, however it is not clear to me that this proposed solution will work. I have webform set up so that anonymous users can send e-mail to addresses that do not necessarily correspond to user id's in Drupal. I don't want to oblige users to create a user id just to send an e-mail (especially this is just for first contact - thereafter we correspond using ordinary e-mail, not through the site).
The standard way for avoiding spamming in such cases seems to be using a captcha. I've set this up for login registration on another site and it seems to work ok. What are the chances of incorporating a call to the captcha module (if present) into webform?
I don't mind trying this, though it may take me a bit of time. But in the event that I get it to work, should it be submitted as a patch or through CVS?
Comment #10
jo1ene commentedThe patch that is being discussed has nothing to do with registering as a user. Before installing it, i was getting hit once every few days. Since I have installed it (almost 6 weeks) i have not gotten hit. So we're assuming it works.
Restricting form access to users was just one proposed solution in an earlier message.
Comment #11
ullgren commentedBackported the patch to 4.6
Comment #12
(not verified) commented