Monitor Your Website For Cyber Hacker Attacks
I have taken steps to monitor and stop hacker attacks in real with my own website. Why can't big business and government agencies do the same to protect their own computers?
In May 2011 I received emails from Best Buy, Citigroup, Home Depot, Capital One and JC Penny, warning me that my personal info was stolen from their computers.
You might have received these notices too. There are continual reports of data being compromised on large corporate and government computer systems.
I was wondering how all these companies I do business with had failed to protect my data.
With this combined data, Epsilon probably knows more about you than any of the individual firms you deal with. I can only guess what can happen when Epsilon gets hacked–and they did in May 2011.
May 2011 Cyber Attack on Citibank and Others
According to Reuters, 360,000 Citigroup accounts were hacked in the May cyber attack. Citibank should know how to protect their client's data from cyber threats. They have the resources. They just don't have the knowledge. A simple monitoring algorithm, as I do, would have stopped it before 100 hacks, not 360,000.
It doesn’t leave me with any kind of a secure feeling when the notices I received went on to say that no critical data required to commit fraud was taken. Steal a little from one firm, a little from another, and before you know it, they have all the data required to steal my identity.
I monitor my credit activity with myfico.com, so if someone were to apply for a loan in my name I would be notified immediately. Therefore, I’m not worried for myself, but these ongoing cyber attacks make me wonder how these large corporations can be so lacking of security.
In June 2011 a hacker group broke into a publicly allocated portion of the Senate’s website. Luckily they were stopped from getting into an internal part of the network by the site’s firewall. (Source: reuters.com).
Google Got Hacked, Too
Even Google was hacked! In June 2011 hundreds of Gmail accounts were compromised by a hacker in China. Some of them belonged to U.S. Government officials. (Source: Washington Post).
We have to ask ourselves how safe our privacy is if all these trusted companies were hacked at the same time. They evidently do not have strong enough defenses in place to catch and trap cyber attacks.
It can be done and hackers can be blocked in real time, but I don't see that being done enough.
Computer systems that are online with the Internet need to have better controls in place to avoid hackers from getting through. They are continuously trying. Processes need to be developed that block the specific predator the instant their attack is obvious.
What I Did To Protect My Website
I have taken additional steps with my own business web site. I wrote some code to monitor and discover cyber attacks that seek to compromise security.
You might be familiar with the page on most websites that tells you you've reached a non-existent page. Webmasters know this as a 404 error page. If you click on a link to a page that no longer exists or if you mistype a URL, you will go to that 404 error page. In most cases this is simply another HTML coded page that may include additional instructions to help guide the visitor. Here's an example:
I went a step further with my own website by creating real time monitoring of server hacking attempts.
I wrote a 404 error routine that captures information about the visitor and notifies me immediately via email.
I capture info such as the visitors IP address, their location in the world, what site and page they were just looking at before they clicked to my site, what page they are trying to see, what web browser they are using and even some of their system information. A large number of simultaneous 404 errors from the same IP address indicates possible hacking.
I also look up of their DNS authenticity and sometimes the report states “Could be forged: hostname does not exist.” I find that interesting and an obvious clue that this visitor is up to no good.
Any Webmaster knows that all this information is available. After all, Google even gives us that info about visitors to our HubPages in our Google Analytics and Webmaster reports.
I wonder how many big companies actually monitor their web traffic in real time for security reasons? If I can do it, so can they–and they should.
Now I know what you are thinking. How can I make use of the info to block the hacker? And how can a big company with even more traffic ever keep up with constant cyber attacks, when little old me gets at least one per day?
The trick is to automate it. I like to get notified in real time via email just to know what's going on with my website. However, notifying a human being is not necessary. It's actually quite easy to write a routine to automatically block hacker bots. I'll explain a little later how to automate the process to stop hackers in their tracks. It's technical, so I'll leave it for last.
Finding Out What Hackers Are Up To
Since I get this information in real time, I can block IP addresses immediately when I see an attempt to find a back door access.
I also get to see what they are looking for. I learn from the email notifications that there are excessive attempts searching for admin scripts, sql database scripts, and php setup code. This activity indicates to me an attempt to gain access to our server by hunting for a back door entry.
I'm noticing that these attempts always have IP addresses from foreign countries such as China, Japan, Bangladesh, India, Russia, Brazil, Ukraine, Lithuania, and Jordan. It’s very rare for me to catch a hacker from the U.S.
Some of these attacks are so vicious they take up a lot of bandwidth, hitting hundreds of non-existence pages in a matter of seconds. Obviously hoping to find one that is a back door entry to log in and get vital information from the rest of the server.
Some back doors they are searching for allow them to plant executable code to search for things like customer records. I don't have any scripts online that would allow access to my data, but the hackers don't know that. They are just using bots to scan every computer in the world, or in a selected country. Anyway, I keep my customer records off line with no connection to the Internet in any way whatsoever. Besides that, credit card info is not kept at all.
The hackers are doing this across the web. Eventually they find a computer server where they can get in, and sometimes they actually find something useful.
Allowing Access To Data Without Knowing It
Since I wrote code to send me emails showing what these hackers are looking for, I have discovered a particular targeted search that happens almost every day – Hackers looking for a file by the name of crossdomain.xml.
I don’t have that file on my server, but they keep scanning computers until they find it on some server somewhere. It may be a government installation or a big corporate office computer. Eventually they find one that has this file and once they do, they have a field day collecting data.
I am shocked that so many websites use this without monitoring it closely. This is the only reason why hackers are searching all sites until they find it. I feel that since I get hackers searching for this every day, it must be quite prominent. I wonder if some Webmasters have it on their server and don’t even realize it.
Stop Hackers In Their Tracks With Cyber Attack Monitoring
This last section is for Webmasters. But anyone else who’s interested can follow along to get the jest of what I’m about to explain. I'll explain it in English so anyone can follow along.
I’m not going to show my code that I wrote for my site, and it's not for sale either, but I will explain clearly what needs to be done. Programmers and webmasters will understand this.
Make a 404.php file and specify that to be the page to display when someone clicks to a non-existent page or enters a non-existent page in their browser. This will also capture bots that go around the Internet searching for back doors. Back doors are scripts that allow access.
Make the page display a friendly error telling a legitimate visitor that they stumbled upon a non-existent page and give them other options to find what they are looking for.
Now for the fun part...
Write PHP code that monitors hacker attacks. The method is to keep track of how many requests ended up with error-404's by the same IP address in a specified time period... say 30 seconds.
If more errors occur than is a reasonable number for a human, then it is most likely a cyber hacker bot. Examine the requests for files that include sql, admin, crossdomain, login, scripts, setup, and anything else that could provide a method of access to a hacker.
If a match is found then you can safely assume this is a hacker. No one else would be looking for access scripts and getting continuous 404 errors while searching.
The next step of the PHP code routine is to capture the http referrer (where they came from), the redirect status (status code), the http user agent (browser info), the server signature (web server info), and any other info you might want to track.
Write additional PHP code that blocks that IP address. On an Apache server that’s done by adding a deny record to the htaccess file. That's the trick to block the hacker and it'll be done in milliseconds.
You can also include PHP code to send the details of the hacker attempt to an administrator’s email address for follow up, or write the info to a report file that can be printed later for review.
A Central Database of Hacker IP Addresses is Strongly Needed
The possibilities are endless of what can be done with this, such as sharing the hacker’s IP address with other field office computers so they can block any discovered hackers too.
With my method I just described, cyber hackers can be stopped in real time before they succeed with getting through and compromising a server. If they try again from a different IP address, that too will be blocked in real time. They won't have a chance!
I have other ideas to enhance this implementation, such as developing a way to send hacker's IP addresses to a central database in real time. The United States Cyber Command for Cybersecurity is just the place for that! How about it?
There presently are a number of sites where you can report hackers. Even the FBI has a “File a Complaint” link on their site for this purpose. But the data has to be entered by a human and it's time consuming. I wish I could just let the code I wrote interface with something like that when it happens.
I think all Webmasters need to work together to control cyber crime. The door can be shut to these attacks and the Internet can be made much more secure for us all.
© 2011 Glenn Stok