/    Sign up×
Community /Pin to ProfileBookmark

Spam getting by JavaScript validation

Delete

to post a comment
JavaScript

10 Comments(s)

Copy linkTweet thisAlerts:
@konithomimoNov 11.2006 — It seems you have global variables enabled on your server. Most likely the spam bots are entering in the direct URL of the ASP page and sending it the desired info, which is very easy to do. Here is how people do it:

  • 1. Look at the form tag and find the action of the form . . . most likely your asp page . . . for example purposes lets call it updateComment.asp

  • 2. Now they look at the names of the fields that get inserted to the DB. Those names are what gets sent.

  • 3. Enter in the direct URL for the action page . . . in our case updateComment.asp . . . and then add the names of the fields and the values to send, thus evading the JS and entering in scripts.


  • here is an example.

    Lets say your pages is:

    http://www.mysite.com/test.asp

    And then the form on the page is:

    <form action="updateComment.asp" onsubmit="validate()">

    <input type="text" name="[color=red]username[/color]">

    <input type="text" name="[color=red]comment[/color]">

    <input type="submit" value="Submit">

    </form>


    They take the URL of the action page:

    http://www.mysite.com/updateComment.asp

    and then add the values (names highlighted in red above and below) to the querystring:

    h**p://www.mysite.com/updateComment.asp?[color=red]name[/color]=whatever they want&[color=red]comment[/color]=whatever else they want

    Now updateComment.asp will run with the values they send it, and there is no validation.


    To fix this you can do a few things:

  • 1. Disable global variables

  • 2. in the action page (updateComment.asp from our example) check the referrer and make sure that it is one of your pages


  • Choice 2 doesnt always work though, cus the spam bot can simply go to one of your pages and insert the URL from there.
    Copy linkTweet thisAlerts:
    @JohnCauthorNov 11.2006 — Delete
    Copy linkTweet thisAlerts:
    @konithomimoNov 11.2006 — Well, I should have been more specific. There are many types of global variables. The ones you are concerned with are called register_globals in PHP . . . I'm not really sure what they are referred to in ASP. Either way, they are controlled in the configuration files for the server, so you would most likely have to contact the server admin to get it fixed. Most professional servers give users control panels that allow them to disable such variables, or they allow the users to controlled them via .htaccess files. however, not all servers allow such conveniences.
    Copy linkTweet thisAlerts:
    @konithomimoNov 11.2006 — The other thing you can do is make sure that you have your form method set to _POST, and then have the action page check to see if that method is used. _POST passes the data outside of the URL, and _GET passes the data via the URL. If _GET is used then don't go any further, but if it is via _POST then allow it.
    Copy linkTweet thisAlerts:
    @JohnCauthorNov 12.2006 — Delete
    Copy linkTweet thisAlerts:
    @konithomimoNov 12.2006 — Sorry, the underline is not needed, I am just used to including it because that is how you get the info from a POST method in PHP. As I said, instead of changing your global variables, try using only the POST method. In PHP it is $_POST instead of $_GET, and in ASP it should be request.form()

    request.form() gets data from the specified object from a form with method="POST".

    If you are using request.querystring() instead then that would be the problem. Simply change it to request.form() and you will not get your data from the querystring, and thus spambots will not work.
    Copy linkTweet thisAlerts:
    @konithomimoNov 12.2006 — The other thing to remember when getting data from querystrings is that you can prevent a lot of forced data via a direct call by first declaring each variable in your code and giving it an initial value, which can then be changed by request.form()
    Copy linkTweet thisAlerts:
    @JohnCauthorNov 12.2006 — Delete
    Copy linkTweet thisAlerts:
    @konithomimoNov 12.2006 — WIthout seeing the code it is hard to say. You may simply be referrencing request.form() improperly.
    Copy linkTweet thisAlerts:
    @JohnCauthorNov 15.2006 — Delete
    ×

    Success!

    Help @JohnC spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.28,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...