• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 188
  • Last Modified:

Hacker Bot visiting each day - cferror fields not trapped - Coldfusion 9 site

I use standard cferror trapping to go to cferror template and send me an email when request errors occur.

Ever day I get errors generated from an attempted hacker bot - It looks like they are trying to inject some links somewhere.  The attempts always fail and generate the errors below. The only error field that gets populated some of the time is error.diagnostics   Sometimes it is blank too.

Here are two examples of the failed daily hack attempt wth fields emailed to me
ErrorDate         #Error.DateTime#
     Browser           #Error.Browser#
     Remote Address    #Error.RemoteAddress#
     HTTP Referrer     #Error.HTTPReferer#
         Template          #Error.Template#
     Query String      #Error.QueryString#
     User name         
     HTML Code Format  <PRE>The United States &lt;a href=&quot; http://www.aprilborbon.com/writing/ &quot;&gt;buy vermox&lt;/a&gt;  payment arrangements should be made with the patient.
 &lt;a href=&quot; http://www.gtonics.net/technology/oscommerce &quot;&gt;topiramate online&lt;/a&gt;  For more information, contact PKP secretary.
 &lt;a href=&quot; http://dalit.dk/omos/ &quot;&gt;buy generic effexor xr online&lt;/a&gt;  Nyarang’O P, Mutema A, Odero W, Sumba O. Interviewing: A manual on
 </PRE> 

Open in new window


ErrorDate         #Error.DateTime#
     Browser           #Error.Browser#
     Remote Address    #Error.RemoteAddress#
     HTTP Referrer     #Error.HTTPReferer#
         Template          #Error.Template#
     Query String      #Error.QueryString#
     User name         
     HTML Code Format  <PRE>Punk not dead  &lt;a href=&quot; http://www.suckvalleywaywalk.ie/health-safety/ &quot;&gt;fish cycline tetracycline 250mg 100 capsules&lt;/a&gt;  instructions of their preceptor. If there is concern about the preceptors instructions, students
 &lt;a href=&quot; http://www.aprilborbon.com/writing/ &quot;&gt;vermox for children&lt;/a&gt;  Pharmacy Procedures Manual | 1 March 2010 13
 &lt;a href=&quot; http://www.gtonics.net/technology/oscommerce &quot;&gt;topamax and weight loss&lt;/a&gt;  Personal accountability and responsibility for actions
 </PRE> 

Open in new window


All the error fields are normally populated when an error is trapped - just not when this happens.

So I am not able to diagnose what the bot is trying to do so I can thwart it. I use cfqueryparam on querys

Any ideas?

This is a coldfusion 9 site www.housecarers.com
0
Ian White
Asked:
Ian White
  • 5
  • 3
1 Solution
 
Rodrigo MuneraSr. Software EngineerCommented:
It sounds like a blind form post jacking,

I would use try/catch blocks to prepare the error and mail it to yourself, adding CGI and FORM dumps to see what the bot is trying to attempt

<cftry>
        <!--- code where the error is being thrown goes here before the catch --->
    <cfcatch type="any">
        <cfsavecontent variable="dumps">
            <cfif isDefined("CGI")>
                <cfdump var="#CGI#">
            </cfif>
            <cfif isDefined("FORM")>
                <cfdump var="#FORM#">
            </cfif>
        </cfsavecontent>
        <cfmail to="admin@company.com">
            #dumps#
        </cfmail>
        <!--- Insert graceful error handling code here --->
    </cfcatch>
</cftry>

Open in new window

0
 
Rodrigo MuneraSr. Software EngineerCommented:
Also, if you design your action page to validate the exact type of content you want to receive and send the user back to the original form if the correct data is not present, that might discourage the bot to attempt further attacks on your site.

The hacker will keep trying as long as he sees that his attempts are causing some errors to be tripped on your server.
0
 
Ian WhiteOwner and FounderAuthor Commented:
Thanks. I have an extensive site with a number of forms.  

<!--- code where the error is being thrown goes here before the catch --->
The trouble is I don't know where the error is being thrown.

As advised cferror in application.cfm goes to error handling template but the referer and template are not populated

HTTP Referrer     #Error.HTTPReferer#
Template          #Error.Template#
0
Improved Protection from Phishing Attacks

WatchGuard DNSWatch reduces malware infections by detecting and blocking malicious DNS requests, improving your ability to protect employees from phishing attacks. Learn more about our newest service included in Total Security Suite today!

 
Rodrigo MuneraSr. Software EngineerCommented:
I'm not sure if the CGI and FORM data from the request would make it to the error page specified in your error handler, but you can give it a try.

In your error handler add:

        <cfsavecontent variable="dumps">
            <cfif isDefined("ERROR")>
                <cfdump var="#ERROR#" label="Error Dump">
            </cfif>
            <cfif isDefined("CGI")>
                <cfdump var="#CGI#" label="CGI Dump">
            </cfif>
            <cfif isDefined("FORM")>
                <cfdump var="#FORM#" label="Form Dump">
            </cfif>
        </cfsavecontent>
        <cfmail to="admin@company.com">
            #dumps#
        </cfmail>

Open in new window

That should give you all available data ColdFusion has made available to your error handler regarding the request.

Also, if your forms take any form of sensitive information, you may want to clean the dumps before emailing them (What good is to have your server secure if you're potentially emailing credit card information in an error reporting email?)

Here's a good resource on securing your dump data http://www.bennadel.com/index.cfm?event=blog.viewcode&id=932&index=3

Here's another resource where ben implements his secure dumps into cferror http://www.bennadel.com/blog/932-Ask-Ben-Handling-Errors-With-ColdFusion-CFError.htm
0
 
Ian WhiteOwner and FounderAuthor Commented:
Yes I tried that - but still error fields not displaying so I have no idea of the template causing the error
0
 
Ian WhiteOwner and FounderAuthor Commented:
I ended up checking for the injection in application.cfm then aborting. Not sure what would be best thing to
present to the hacker - currently just aborting

<cfloop collection="#form#" item="item">
 <cfif form[item] contains "exec("

 or  form[item] contains  "href=&quot"
 
  >

<!--- Do something to the hacker - blank page? --->
<cfabort>
</cfloop>

Open in new window

0
 
Ian WhiteOwner and FounderAuthor Commented:
No Matter what I do - an error is generated but fields dont get trapped except for error.diagnostics - see example below so error.template etc not reported

ErrorDate         #Error.DateTime#
     Browser           #Error.Browser#
     Remote Address    #Error.RemoteAddress#
     HTTP Referrer     #Error.HTTPReferer#
         Template          #Error.Template#
     Query String      #Error.QueryString#
     User name         
     HTML Code Format  <PRE>We went to university together &lt;a href=&quot; http://www.moorelegal.net/austin-law-office.html &quot;&gt;generic for nexium 40 mg&lt;/a&gt;  dispensed in quantities sufficient to effect optimum economy, up to 90 days.
 &lt;a href=&quot; http://fuckedup.cc/category/writing/ &quot;&gt;75 mg topamax&lt;/a&gt;  Preceptors qualify to participate in the PEP by meeting and adhering to standards set by the UNC
 &lt;a href=&quot; http://www.chdesignsinc.com/?page_id=194 &quot;&gt;acyclovir iv rxlist&lt;/a&gt;  frozen inserts, and one camping stove that we will lend if we are not using them. Please return
 &lt;a href=&quot; http://lbhoffmangroup.com/index.php/testimonials &quot;&gt;50 mg amitriptyline&lt;/a&gt;  salt and curry powder to taste
 </PRE> 

Open in new window

0
 
Ian WhiteOwner and FounderAuthor Commented:
please close inactive
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now