It is currently Wed May 22, 2013 3:54 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Nip hacking in the bud with Purebasic
PostPosted: Thu Dec 29, 2011 7:41 pm 
Offline
PureBasic Bullfrog
PureBasic Bullfrog
User avatar

Joined: Wed Jul 06, 2005 5:42 am
Posts: 6465
Yesterday a friend from this forum let me know that google was reporting my website as a host for dangerous malware. When I pulled it up in Firefox, sure enough a big red screen warned me that I shouldn't proceed because the site was known to host viruses and worms. So I downloaded my entire site to a folder and scanned it. Two obfuscated scripts were found in my index.htm file. I compared it with the file I had uploaded some months ago and my version was clean. So someone hacked my service provider and planted malware in my index, the dirty rotten scoundrels. I reupped the clean version of my index, submitted my site to google for a review, and after the six hours or so it took them to get to it, I got the all clear.

This kind of thing is going to happen from time to time, how to defend against it? Why, aim some Purebasic at it of course:

Code:
InitNetwork()
Repeat
  If ReceiveHTTPFile("http://www.<mywebsite>.com/index.htm", "d:\index.htm")
    a$ = MD5FileFingerprint("d:\index.htm")          ; Downloaded index
    b$ = MD5FileFingerprint("d:\_website\index.htm") ; Original index
    If a$<>b$
      If CreateMail(0, "<myemail>@<myhost>.com", "Emergency!")
        SetMailBody(0, "Website index has been attacked !")
        AddMailRecipient(0, "<myemail>@<myhost>.com", #PB_Mail_To)
        Result = SendMail(0, "smtp.<mysmtpserver>.com", 25, 1)
        Repeat
          Progress = MailProgress(0)
          Delay(300)
        Until Progress = #PB_Mail_Finished Or Progress = #PB_Mail_Error
        If Progress = #PB_Mail_Finished
          MessageRequester("Emergency!", "Website index has been attacked! Emails sent.")
        Else
          MessageRequester("Emergency", "Website index has been attacked! Unable to send emails.")
        EndIf
      EndIf
    EndIf
  EndIf
  Delay(1000*60*10) ; 10 minutes
ForEver

This runs continuously (actually a more sophisticated version with a systray icon and health check infos but this is the basic idea) on my system and now if someone hacks me again I'll know it in 10 minutes, even if I'm not home.

_________________
Veni, vidi, vici.


Top
 Profile  
 
 Post subject: Re: Nip hacking in the bud with Purebasic
PostPosted: Thu Dec 29, 2011 9:40 pm 
Offline
Addict
Addict

Joined: Tue Feb 22, 2011 1:16 pm
Posts: 1459
Instead of a warning email, couldn't you just make an app to upload the clean file every 12 hours? So you know it's always going to be clean at least twice a day, every day.

_________________
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!


Top
 Profile  
 
 Post subject: Re: Nip hacking in the bud with Purebasic
PostPosted: Thu Dec 29, 2011 9:46 pm 
Offline
PureBasic Bullfrog
PureBasic Bullfrog
User avatar

Joined: Wed Jul 06, 2005 5:42 am
Posts: 6465
My current version checks every 10 minutes, if tampering is found it saves the bad one and uploads the good one. This way I can examine the script(s) and possibly get a line on who may have done this.

_________________
Veni, vidi, vici.


Top
 Profile  
 
 Post subject: Re: Nip hacking in the bud with Purebasic
PostPosted: Fri Dec 30, 2011 7:04 am 
Offline
Addict
Addict

Joined: Sun Apr 12, 2009 6:27 am
Posts: 1468
Too bad
Where is your Service Provider in all of this?

_________________
Egypt my love


Top
 Profile  
 
 Post subject: Re: Nip hacking in the bud with Purebasic
PostPosted: Fri Dec 30, 2011 7:24 am 
Offline
PureBasic Bullfrog
PureBasic Bullfrog
User avatar

Joined: Wed Jul 06, 2005 5:42 am
Posts: 6465
RASHAD wrote:
Where is your Service Provider in all of this?

Good question. My provider sent me an email telling me that my site was reported as distributing badware and gave me 24 hours to prove that I've cleaned it up or they would suspend it under the terms of my service agreement. I replied to them explaining what happened and that I took immediate action (thanks to DarkDragon's early warning) and that all is clean now. They checked, found it to be true and told me I'm in the clear. The problem appears to be that I had a reasonably weak password on my ftp account, just 3 numbers and 6 lowercase letters making up a word that can be found in a dictionary. A bot probably broke it. I changed it to something much stronger and it's unlikely I'll be compromised again anytime soon. And if I am, it'll be for ten minutes tops. Purebasic, the titanium shield 8)

_________________
Veni, vidi, vici.


Top
 Profile  
 
 Post subject: Re: Nip hacking in the bud with Purebasic
PostPosted: Fri Dec 30, 2011 12:13 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Tue Dec 08, 2009 8:34 pm
Posts: 161
Location: United Kingdom
1. Who is your provider?
2. Move to a proper provider!

_________________
C provides the infinitely-abusable goto statement, and labels to branch to. Formally, the goto is never necessary, and in practice it is almost always easy to write code without it. We have not used goto in this book. -- K&R (2nd Ed.) : Page 65


Top
 Profile  
 
 Post subject: Re: Nip hacking in the bud with Purebasic
PostPosted: Fri Dec 30, 2011 1:59 pm 
Offline
Addict
Addict

Joined: Tue Feb 22, 2011 1:16 pm
Posts: 1459
netmaestro wrote:
This runs continuously

How can it run continuously when there's 2 x MessageRequesters in there? ;) Were you testing us?

_________________
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!


Top
 Profile  
 
 Post subject: Re: Nip hacking in the bud with Purebasic
PostPosted: Fri Dec 30, 2011 2:06 pm 
Offline
Addict
Addict
User avatar

Joined: Mon Jun 02, 2003 9:16 am
Posts: 1917
Location: Germany
MachineCode wrote:
netmaestro wrote:
This runs continuously

How can it run continuously when there's 2 x MessageRequesters in there? ;) Were you testing us?
Nitpicker. It runs continuously until a special situation has been reached. :lol: :wink:

_________________
bye,
Daniel

http://www.bradan.eu/


Top
 Profile  
 
 Post subject: Re: Nip hacking in the bud with Purebasic
PostPosted: Fri Dec 30, 2011 11:37 pm 
Offline
Addict
Addict

Joined: Sun Dec 12, 2010 12:36 am
Posts: 1284
Location: Waterloo, WI - USA
Absolutely move to a new host, if your account was compromised and they in turn threatened to suspend you for distributing malware..

_________________
Image


Top
 Profile  
 
 Post subject: Re: Nip hacking in the bud with Purebasic
PostPosted: Sat Dec 31, 2011 12:50 am 
Offline
Addict
Addict

Joined: Tue Feb 22, 2011 1:16 pm
Posts: 1459
Zach wrote:
Absolutely move to a new host

+1, I wouldn't put up with a rude host like that.

_________________
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!


Top
 Profile  
 
 Post subject: Re: Nip hacking in the bud with Purebasic
PostPosted: Mon Feb 06, 2012 12:55 am 
Offline
Addict
Addict

Joined: Fri Oct 23, 2009 2:33 am
Posts: 2860
Location: Wales, UK
Quote:
Absolutely move to a new host, if your account was compromised and they in turn threatened to suspend you for distributing malware..


They are all pretty much the same - looking after their own back, a few customers not being important.

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
 
 Post subject: Re: Nip hacking in the bud with Purebasic
PostPosted: Tue Feb 14, 2012 5:43 pm 
Offline
Addict
Addict

Joined: Sun Dec 12, 2010 12:36 am
Posts: 1284
Location: Waterloo, WI - USA
Maybe so, but I would not put up with that kind of treatment simply on the face of principle.

_________________
Image


Top
 Profile  
 
 Post subject: Re: Nip hacking in the bud with Purebasic
PostPosted: Sun May 05, 2013 10:15 pm 
Offline
New User
New User

Joined: Sun May 05, 2013 9:26 pm
Posts: 9
Can I have a copy of your corrupted index.html file???


Top
 Profile  
 
 Post subject: Re: Nip hacking in the bud with Purebasic
PostPosted: Sun May 05, 2013 10:18 pm 
Offline
PureBasic Bullfrog
PureBasic Bullfrog
User avatar

Joined: Wed Jul 06, 2005 5:42 am
Posts: 6465
Sorry it's long gone.

_________________
Veni, vidi, vici.


Top
 Profile  
 
 Post subject: Re: Nip hacking in the bud with Purebasic
PostPosted: Sun May 05, 2013 10:43 pm 
Offline
Addict
Addict

Joined: Thu Nov 01, 2007 5:37 pm
Posts: 1565
Location: Germany
Offtopic:
I'm not sure if that jmcbride guy is spamming or at least a spam account in preparation. I mean come on... 5 posts in just under 30 mins to either outdated or completely random topics?!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: dhouston and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye