Tag: Scripts
Removing malicious code with perl and sed…
by Eric on Feb.10, 2009, under Linux, One-liners
Today, I had an instance where a customer's site had been attacked with a code injection affected all of his .php files. In this case, it was an old vBulletin install that had several known exploits on milw0rm (proof you should update often) that caused it.
Fortunately, the code was injected as a single line, and was the same in every file, and had the added benefit of being on the top line of the file. So, I could use abit of perl to remove it, and then a bit of sed magic to remove the blank line left by Perl (because for some reason, it didn't want to remove the newline).




