Link to home
Start Free TrialLog in
Avatar of Ian White
Ian WhiteFlag for Australia

asked on

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
Avatar of Rodrigo Munera
Rodrigo Munera
Flag of United States of America image

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

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.
Avatar of Ian White

ASKER

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#
ASKER CERTIFIED SOLUTION
Avatar of Rodrigo Munera
Rodrigo Munera
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yes I tried that - but still error fields not displaying so I have no idea of the template causing the error
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

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

please close inactive