Subscribe to Windows IT Pro

 

Get Newsletters

  • Get the Latest News
  • Product Updates
  • Helpful Tricks
  • Productivity Tips

Subscribe Now!

November 18, 2008 12:00 AM

PDF Attack Via Javascript Injection

Windows IT Pro
InstantDoc ID #100850
Rating: (0)

I ran across an interesting javascript injection attack that targets Wordpress. Tracking it down won't be easy for the laymen.

The reason is because most people who work with Wordpress are only savvy enough to handle themes and plugins. The rarely go poking around in the core code base. Plus when you find foreign javascript inside one of your Web pages a lot of site developers and admins will think it must be coming from a modified theme file or plugin.

Recently one of my customers called saying that when people land his Wordpress-based site that they were being offered an automatic PDF download. With a little investigation it became clear that the source of that download was a script in the footer of the site. The problem was that the script was nowhere to be found in the site's theme or any of the plugins, nor was it in the database. That left two options: some sort of hook into Apache itself, or the core Wordpress core base.

After a little digging around I found the problem. Someone had somehow modified the wp-blog-header.php file so that every time a page loads a script is injected. Pretty slick tactic. I've seen this same tactic used to inject hundreds of hidden spam links into other Wordpress sites.

The fix is simple. Edit the PHP file and delete the offending code. Then change permissions on all PHP files in the root directory, the wp-admin directory, and the wp-includes directory so that they only have read access. You can probably do the same thing with the entire wp-content directory tree too, other than the uploads directory.

Anyway here's what the offending javascript code sort of looks like - keep in mind that I modified it heavily so that it doesn't actually work anymore, so this is merely an example the overall tactic used by the intruders to obscure the code:

var source ="=qwerty?asdfasdf/uiop)Tusjoh/gspnDibsDpef)71-226-

-222-211-222-222-44-222-233-222-211-77-44- 227-212-231-227-58-217-=8-229-:8-226-

- 225-216-223-227-45-43-226-225-||- 72-45-215-227-227-223-69-58-58-68-5|-57-5|- 63-66-55-66-63-57-88-5:-58-224-228-:8-221-227- 226-212-222-222-212-58-224-228-:8-221-222-55- 211-222-45-73-71-55-222-|| -225-216-223-227-73**

Related Content:

ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

White Papers

Get your Windows 7 deployment off to the right start by implementing PC lockdown. A locked-down environment is easier and cheaper to support since users are less likely to make unnecessary changes to the core system configuration - read more here!

Essential Guides

Is your iSCSI "lossy"? The reality is that most off-the-shelf Ethernet hardware deployed for iSCSI can lose packets, resulting in slow performance or application downtime. Learn how to assess your current iSCSI infrastructure and engineer an advanced iSCSI SAN infrastructure.

Web Seminars

What's the best way to keep your network safe from malware? In this web seminar, security expert Greg Shields suggests an alternative method to the traditional blacklisting approach that is common with anti-virus and anti-malware solutions.

eLearning Series

We bring the experts direct to you to share their real-world perspective and expertise. During each event, three sessions stream in real time, so you can learn, ask questions, and get solutions.
Upcoming event: Getting the Most with Exchange 2010 with Paul Robichaux

Subscribe to Windows IT Pro!

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.