CreateObject("MSWC.BrowserType") randomly fails

162 views
Skip to first unread message

Jonathan

unread,
Aug 5, 2015, 8:53:23 AM8/5/15
to browscap
Hi everybody,

We use your browscap.ini file since many years in our classic asp website to help identify user agents.

Since July 21 our code began to throw Server.CreateObject failed errors when trying to create the MSWC.BrowserType object. It works most of the time, but randomly fails several times each day.

I know it is not necessarily related to the file itself, but since many here should be using MSWC.BrowserType object I was wondering if someone else was having the same problem and could help to solve it ?

I know we didn't change anything in our code or system configuration on that date, the only thing I see is the windows update kb3079904 that was installed on the July 21, but it does not seems related because it is about font driver vulnerability !?

I may try to restore the system to the checkpoint before this update to see if it is really the cause, but this is an important security update and I will have to re-install it after so it may not solve the problem.

thanks for your support !
Jonathan

James Titcumb

unread,
Aug 5, 2015, 10:02:20 AM8/5/15
to browscap on behalf of Jonathan
Something that has caused the PHP version issues was the size of the file, which is ~15MB at the moment - could it be memory issues perhaps?

Thanks
James

Jonathan

--
You received this message because you are subscribed to the Google Groups "browscap" group.
To unsubscribe from this group and stop receiving emails from it, send an email to browscap+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jonathan

unread,
Aug 5, 2015, 10:28:39 AM8/5/15
to browscap
Thank you for your reply, we downloaded the full_asp_browscap.ini file and shrinked it to keep only the crawlers (that is the only thing we want to detect), and the file is now only 292kb so it is not a size problem.

I tried the original full_asp_browscap.ini file too which is 31mb to see if it was our shrinked file that was corrupted or something, but we still have the same problem.

James Titcumb

unread,
Aug 5, 2015, 1:45:07 PM8/5/15
to browscap on behalf of Jonathan

Is there any indication of what the error is? A stack trace, error message, or anything at all?

On 5 Aug 2015 15:28, "Jonathan via browscap" <browscap+APn2wQe0Ewfb6_L41L_0UX9...@googlegroups.com> wrote:
Thank you for your reply, we downloaded the full_asp_browscap.ini file and shrinked it to keep only the crawlers (that is the only thing we want to detect), and the file is now only 292kb so it is not a size problem.

I tried the original full_asp_browscap.ini file too which is 31mb to see if it was our shrinked file that was corrupted or something, but we still have the same problem.

Jonathan

unread,
Aug 6, 2015, 8:39:51 AM8/6/15
to browscap
I finally found the problem, it is not directly related to browscap component even if it is this object creation that raised the error.

I checked all the request ip addresses and they all came from Germany in the same 2-3 subsets, and we don't have customers from Germany so it is probably some kind of bot spoofing its user agent string (it uses many different common browser like chrome, firefox and safari), that's why I thought at first it was real visitors (I didn't have the ip adresses at that time yet).

The error occurs because the request contains an invalid cookie header, the first cookie have only a value but no key: "HTTP_COOKIE:=true; _tnlb_bot_fn_autodetect_lbt=; ASP.NET_SessionId.GAFrontend=zupfpkalqjzjgxbkcj3dfvgv;"

I found that the error was raised when reading the Request.Cookies collection, which is likely used by the browscap component, that's why I had the error on the object creation.

So far I don't really have a solution, we could have expected the ASP Request object to handle better invalid cookies, like just ignoring it, but because it raise an error, the only thing I can do is ban the ip addresses from the website to stop flooding my log with these errors.

Thank you for your time !

Regards,
Jonathan

Carlos Blanco

unread,
Nov 7, 2015, 1:20:14 PM11/7/15
to browscap
Jonathan,

I use Windows sever and use the full classic asp browscap.ini, never had that problem but reading your last post maybe this help you:

I use in global.asa several arrays of keywords to filter the user agent and referer before anything else, if a known bad UA or referer is found user is transfered to a Error403.8.asp page to show is blocked and why, and set session.adandon to avoid IIS sessions go high (some people just set Response.End).
This catches most of fakes before they can harm, and mitigate the posibility browscap object reads an infected UA or cookie.

Also use Microsoft URLScan wich detect and reject SQL injections and other URL anomalies searching for security flaws.

Arrays:

1. Good words on User Agent (good spiders known words)
2. Good domains names as Referer (mostly search engines)
3. Bad words on User Agents (know bad bots and fake words on User Agent)
4. Bad words on Referer (domain names that send junk traffic)
5. Bad words on UA for specific toolbars which usually contain malware

On each check, if found something, we bypass the next checkpoints so we don't waste more time so user response time remain as fast as possible.
1 catches 60% of traffic of spiders, google, bing, yahoo, etc. and bypass. Set Session.Timeout = 1 (crawlers open a new session on each request)
2 catches 35% of traffic from search engines and is good to go to use ASP browscap Object and use UA properties.
If not found as good then check 3, 4, 5 to cath the bad bots, fake user agents and bad referers which are the 5% of traffic that hurt the most.

Here a sample:

Sub Application_OnStart (here so array is loaded in memory just once)

'GOOD SPIDERS and COMMON GOOD UA STRINGS
'
'=======================================
S = ""
S = S & "acoon|ahrefsbot|baidu|bingpreview|bingbot|adidxbot|blitz|googlebot.com|googleweblight|google.com|euroseek|excite|exabot|facebook|msnbot|lycos|yandex|yahoo|slurp|pingdom|orangebot|soso|sogou|"
S = S & "arachnoidea|docomo|dotbot|feedfetcher-google|filterdb.iss.net|gnip|haosouspider|indlinks|jikespider|mail.ru|netseer|surveybot|seznambot|semrushbot|moget|ichiro|goo.ne|youdaobot|qwant.com|"
S = S & " cros |google page speed insights|google wireless transcoder|daumoa|cyberfox|droidz atom|babya|deusu.de|darkmoon|genieo"
Application("GoodSpiders") = Split(S, "|")


'BAD SPIDERS 1 (most common, ordered by frequecy of visits). Fast list, if not found here, will check the huge list BAD SPIDERS 2
'================================================================================================================================
S = ""
S = S & "user-agent:|linkdexbot|xovibot|havij|archive.org|ie 5.|synapse|common|ebin|microsoft office protocol discovery|test|winhttp|python|myie2|nerdybot|free|nutch|phantomjs|curl/|httpclient|virtual|"
S = S & "speed|ibm evv|opera 7|check|alpha|baby|browsex|bsalsa|crazy|fuck|grapeshot|sift|sleuth|sputnik|"
S = S & "windows 98|windows ce|torrent|sleip|spider|heritrix|jam|openf|frontpage|coast|contextad|certificate|apollo|"
S = S & "wordpress|comodo|firephp/|ia_archiver|kkman2|majestic12|mifetcher|netcraft ssl server survey|nmap scripting|python-urllib|rejectedv-by|safari version 537.36|zeus 2.6|"
S = S & "zgrab|asktbfxtv|powermark|framework test client|riddler"

Application("BadSpiders1") = Split(S, "|")

SUB Session_OnStart

Agent = LCase(Request.ServerVariables("HTTP_USER_AGENT"))
REF = Request.ServerVariables("HTTP_REFERER")
Bad = False 'Flag. Defalt false, filters will change value to true when when filters detect bad bot, toolbar or referers

'GOOD SPIDERS
'============
If IsArray(Application("GoodSpiders")) then
S = Application("GoodSpiders")
For I = 0 to UBound(S)
If InStr(Agent, S(I)) > 0 Then
Bad = False
Session.Timeout = 1
Exit For
End If
Next
End If

... check referers array the same way

'BAD STUFF Not found as good stuff, check if it is bad
'=========================================================================
If Word = "" Then '(not found in good arrays)

'BAD SPIDERS 1
'======================================
If IsArray(Application("BadSpiders1")) AND Word = "" Then
BS = Application("BadSpiders1")
For I = 0 to UBound(BS)
If InStr(Agent, BS(I)) > 0 OR InStr(Agent, Chr(34)) Then
sType = "UA"
Bad = True
Session.Timeout = 1
Exit For
End If
Next
End If

... checks 4 bad referers, 5 bad toolbars

End If

If Bad = True Then
Select Case sClass
Case "User Agent"
Server.Transfer("/Error403.8.asp") 'send to 403.8.asp to display is blocked and UA is a known fake, scrapper, etc.
Case "Malware"
Server.Transfer("/Error403.8.asp") 'send to 403.8.asp wich display a link to http://www.2-spyware.com/[Keyword].htm
Case "Referer"
Server.Transfer("/Error403.8.asp") 'send to 403.1.asp to deny access with legend: Your site send unwanted traffic
Case Else
Server.Transfer("/Error403.1.asp") 'not defined in filters, send to 403.1..asp with Clase = "Unknown"
End Select
End If

'Data
'=====
Set Browser = Server.CreateObject("MSWC.BrowserType")

Do whatever with Browser properties such as Browser.Browser, Browser.Browser_Type, Browser.Cookies, Browser.Crawler ...


Reply all
Reply to author
Forward
0 new messages