clayfreeman wrote:
I don't take any offense to what you are saying, but at the time, we were about to quit, and on top of that, it was late. Our other code isn't this bad. This was just an attempt to solve the problem one last time before we went home and gave up. I knew there were many more secure ways to do this, but in our situation, it wasn't required. This is not public, so for us, it doesn't affect security. I appreciate your concerns, and the file is being updated to respect the fact that it is exploitable.
I understand. You've gotta do whatever works if you're getting attacked and you don't have time. But when you post a script on a public web site, please remember that other people
will download it and run it in the most stupid manner possible. The world would be a better place without all those insecure PHP code snippets littering the blogosphere.
Just for fun, here's a one-liner (in bash) that improves upon the code I posted above:
Code:
grep -li "htaccess" $(grep -li "unlink" $(grep -lir "fwrite" *))
Just go to /var/www and run it in a bash shell!