1. You are viewing our forum as a guest. For full access please Register. WindowsBBS.com is completely free, paid for by advertisers and donations.

Garbage Spammers

Discussion in 'Security and Privacy' started by Budsy, 2009/11/12.

  1. 2009/11/12
    Budsy

    Budsy Inactive Thread Starter

    Joined:
    2009/11/03
    Messages:
    4
    Likes Received:
    0
    Occassionally forms on my websites get hit by what I call 'garbage spam'. All the form fields are filled with apparently random letters. Curiously, some are configured into hotlinks, though they too are garbage and do not point to valid sites.

    Is this some form of probing, or what? I have trapped all these and send them to a garbage area. The messages tend to have a consistent signature and I am able to filter them in my software. But I'm still curious; does anybody know what this kind of spam is all about?

    Budsy
     
  2. 2009/11/13
    TonyT

    TonyT SuperGeek Staff

    Joined:
    2002/01/18
    Messages:
    9,072
    Likes Received:
    400
    Spammers use bots to try to send spam via email forms of Webpages. All automatic. What you need to do is harden your code so the bots can't submit the forms. Use captcha or a similar code which deters automatic form filling and submission. And you should also use code to prevent header injection and carriage returns in all the form fields except the message textarea.

    I use php on my sites and require the user to enter the answer to a math question, such as 5 + 11 = ___ and the user must type the correct answer. If the answer is incorrect an error is displayed and the user bounced. Most bots are dumb and don't do calculations.

    example form field:
    Code:
    <p>12 - 5 = <input type= "text" id= "math_question" name= "math_question" size= "2" maxlength= "1" value=" "> <a href= "javascript:void()" onclick= "alert('Math Question\n\nHelps prevent automatic spam programs from using this form.'); ">what's this?</a></p>
    and the php:
    Code:
    <?php
    if ($_POST['submit'] == TRUE) { //if submit button pressed process form
    $recipient		= stripslashes(strip_tags($_POST['recipient']));
    $sender_name		= stripslashes(strip_tags($_POST['sender_name']));
    $sender_email		= stripslashes(strip_tags($_POST['sender_email']));
    $subject		= stripslashes(strip_tags($_POST['subject']));
    $message		= stripslashes(strip_tags($_POST['message']));
    $math_question		= stripslashes(strip_tags($_POST['math_question']));
    
    //prevent header injection, bounce to google if fields contain carriage returns
    if (ereg( "[\r\n] ", $recipient) || ereg( "[\r\n] ", $sender_name) || ereg( "[\r\n] ", $sender_email) || ereg( "[\r\n] ", $subject) || ereg( "[\r\n] ", $math_question)) {
    echo  "<meta http-equiv='refresh' content='0;url=http://www.google.com'> ";
    }
    
    $answer	= '7'; //correct answer to math question
    if($math_question != $answer) { //if incorrect answer to math question
    //ack sender and redirect back to home page in 3 seconds
    echo  "<h3>Incorrect!</h3> ";
    echo  "<p>12 - 4 does not = <span class='red'>$math_question</span></p> ";
    echo  "<meta http-equiv='refresh' content='3;url=/'> ";
    ?>
    
     
    Last edited: 2009/11/13

  3. to hide this advert.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.