Tim Anderson

The day my web site was hacked

An intrusion involving a stolen cookie and an unpatched PHP application has lessons for all site operators

Written by Tim Anderson

A recent Monday morning brought a nasty surprise. A hacker had gained access to a web site I run, and planted a script engagingly entitled “Magic Include Shell WordPress Edition”, buried under an innocent-looking directory called images in the uploads section of the WordPress blog installation.

The hacker chose a Friday evening to start spitting out trackback spam, where ad-laden comments are automatically posted to other blogs, hoping that the activity would attract little attention over the weekend.

Shutting down the script was easy; but how did the intruder gain access? Could there be other sinister scripts or executables lurking on the server? How could the server now be secured?

It was the cue for hours spent trawling through Apache logs, consulting with users and developers of open-source software used on the site, and inspecting server backups to check the state of files. We think that the problem began with a stolen cookie, escalated by a security issue in a PHP application that was not patched with the latest update, and resulting in the hacker having free ability to upload files and scripts to the web site, wherever the web server had permission to write.

This last point is interesting. It used to be considered obvious that web servers should not have permission to write files in places where they can also be served or executed by the web server. The problem is that the surge in user-generated content means there is pressure for easy authoring and customisation of web content. WordPress is an example, and some convenient though non-essential features depend on certain folders being writeable by the web server. That proved a fatal weakness, when combined with other vulnerabilities.

It is tempting to keep quiet about an embarrassing incident. However, I am convinced that it is better to discuss and learn from events like this. Further, I have never been under the illusion that web servers like mine are secure. They are not places for critical data. Flaws in popular applications are widely and frequently exploited, so my experience is not unusual. At the same time, just because something is commonplace does not make it unimportant. Hacked sites are the source of many perils, such as virus-infected spam messages, phishing sites, or any amount of illegal content.

Lessons learned? First, anyone managing their own web site, even on a shared host, needs to come to terms with the administrative responsibilities. Unfortunately, leaving well alone is a recipe for disaster. Fully managed solutions are increasingly attractive for non-specialists. Second, it is a reminder that insecure Windows boxes are by no means the main problem for Web security; Linux and PHP can be just as bad. It all depends on configuration, management, and applications. Third, the open-source community can be wonderfully responsive when people have problems.

Fourth, if you manage a web site, don’t forget to check the logs. If your site is hacked, at least you will be likely to discover it quickly.

Tags:

reader comments

related articles

 

related whitepapers

today's top stories

Learning from the credit crunch to avoid a broadband crunch

While it might be the most pressing issue de jour , the financial system isn’t the only area where government needs to... 10 Oct 2008

How careerism can warp IT procurement

Many working in IT put their career interests before those of their employer when weighing up purchasing options 10 Oct 2008

City in pressing need of skilled IT matchmakers

With the financial services sector plunging ever deeper into an M&A maelstrom, IT leaders are having their systems integration skills and due diligence expertise tested as never before 09 Oct 2008

The definitive guide to software development

Five key trends and five best practice tips to help you improve your programming capabilities 09 Oct 2008

Computing podcast - IT implications of the banking crisis, and the FSA clamps down on IT security

We discuss the effect of shotgun mergers and acquisitions on financial services IT staff, and examine the industry regulator's plan to fine directors for information security breaches 09 Oct 2008

Advertisement

Newsletter signup

Sign up for our range of FREE newsletters:

Existing User

Newsletter user login:

Jobs

Related jobs

Job of the week

Job alerts

Sign up here

Find your next job


IT Salary Checker

Check salary here

Advertisement

White papers

Search white papers

Top categories

VPN, Extranet and Intranet Solutions

WAN/ LAN Solutions

Network Security

Interoperability-Connectivity

Grid/ Utility Computing

Latest poll

Would you apply for a job that was advertised on Facebook or a similar social networking site?

Would you apply for a job that was advertised on Facebook or a similar social networking site?

The government is using Facebook to recruit IT staff - would you apply to such an ad?

Previous poll results

Latest audio and video articles

programming codeVideo

The definitive guide to software development

Five key trends and five best practice tips to help you improve your programming capabilities 09 Oct 2008

Podcast imageAudio

Computing podcast - IT implications of the banking crisis, and the FSA clamps down on IT security

We discuss the effect of shotgun mergers and acquisitions on financial services IT staff, and examine the industry regulator's plan to fine directors for information security breaches 09 Oct 2008

Latest in-depth articles

Financial Services Authority buildingAnalysis

FSA threatens executives with fines

Senior management to be held accountable for security lapses at banks 09 Oct 2008

Comment

Broadband must be a spending priority

For the economic health of the nation, the government would do better to bankroll an optical fibre rollout rather than prop up profligate banks 09 Oct 2008

Advertisement

Primary Navigation