KitWiz4687 wrote:
There may be another way to help correct a malicious script injection...
A PHP file that contains the other php files used by the forum in an encrypted form stored as constant values, a moderator or administrator can be allowed access the corrective php page and when they select the proper control, the php code will examine the respective php files and if they had been altered from their original state it will then overwrite the entire file with the correct php code to eliminate the injected scripts.
Essentially monitoring files, and replacing them with the originals if they change, right? Only problem is with upgrading any files to a newer version - you'll need to remember to update the corresponding files in the corrective PHP file. Though that should be fairly easy to do. Quite honestly, it might not even be necessary to store it in encrypted form - As far as I know, most attack scripts are hardcoded to only change certain files (relative to a directory of course), so the corrective PHP file wouldn't even be touched. Or if they use a 'shotgun' approach, injecting scripts into *.php, the corrective file itself would be compromised. Alternatively, if someone specifically hacks into the server to modify files, they might just remove the corrective file.
So the corrective file should be stored elsewhere to prevent tampering, but then that prevents the corrective file from doing anything because it would be run in another context. Maybe a combination of a PHP file which calculates the checksums (smaller than storing a copy of all the PHP files, which means it would be less likely to be noticed), then a known good file with the original PHP code that the admin can store elsewhere and copy over if need be? (ie. a checksum calculation has failed?)
And for good measure, chmod 755 ./* everything in the web server directory.