The reason behind my topic http://forum.cmsmadesimple.org/viewtopi ... 28&t=74310
caused me to find this:
The folders on this site contact a number of .htaccess files. At random, I downloaded one of them and opened it. It reads:
<quote>
# To deny PHPs
<Files ~ "\.(php|php3|php4|php5|phtml|pl|cgi)$">
order deny,allow
deny from all
</Files>
</quote>
Is this what I think it might be, ie to deny loading php, thus wrecking a site?
.htaccess denying php files. Site wrecker?
-
- Power Poster
- Posts: 444
- Joined: Wed Dec 27, 2006 5:15 pm
Re: .htaccess denying php files. Site wrecker?
It is to stop direct loading of php files (there are very few files that are loaded directly and they are in / and admin/). It is by design to prevent someone from placing a file hack_file.php deap in the site and use it to send spam or do other malware.
Thanks,
Jeff
Thanks,
Jeff
-
- Power Poster
- Posts: 444
- Joined: Wed Dec 27, 2006 5:15 pm
Re: .htaccess denying php files. Site wrecker?
Thanks Jeff
Bearing in mind that I, as site admin, did NOT place that file on the server, may I assume that it was placed maliciously. It is dated 0154 hrs 31/1/16 and to the best of my knowledge nothing has moved on that site for some months.
Regards
Martin
Bearing in mind that I, as site admin, did NOT place that file on the server, may I assume that it was placed maliciously. It is dated 0154 hrs 31/1/16 and to the best of my knowledge nothing has moved on that site for some months.
Regards
Martin
Re: .htaccess denying php files. Site wrecker?
As Jeff said it is by design, to prevent malicious code to be executed. The only way to know if the files were installed by CMSMS is to do a checksum against the version installed. Besides the dat files provided by CMSMS (they are on the forge) for each version, there is also the possibility to generate your own checksum files after the site is finished, which are more extensive than the one provided.Jeff wrote: It is by design to prevent someone from placing a file hack_file.php deap in the site and use it to send spam or do other malware.
Other than that you should not assume anything... The .htaccess directives are correct, it just depends on which folders they are set.
Your best bet is to:
- overwrite the files with a fresh copy of the CMSMS from the same version as the original;
- import the sql file into the db;
- do a checksum test;
- remove the installer folder from the site;
- read our docs about CMSMS security and implement its recommendations;
- try to assess if there are other scripts that might present vulnerabilities and eventually fix them or remove them;
- change all passwords (ftp and db too);
- upgrade CMSMS and 3rd party modules;
- create fresh backups;
- generate a new checksum file just for the site;
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
Re: .htaccess denying php files. Site wrecker?
That is not sufficient, because it will not affect newly placed "bad" files.Your best bet is to:
1. overwrite the files with a fresh copy of the CMSMS from the same version as the original;
You need to remove *all* files from the server and put back the freshly downloaded core and module files from the Forge. Afterwards manually upload all images etc. one by one back. Just to be sure you don't upload a hidden bad file again.
This is the only way to be sure your server is clean of bad files.
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Re: .htaccess denying php files. Site wrecker?
For the record: if the OT had full backup of the files, I would agree of course
. Not being that the case, and not being able to recover the original files, I would follow the above steps, even knowing there is a certain level of risk involved. But those steps would allow to tell the files of a CMSMS installation from the rest, and then a triage would be relatively simple.

"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
Re: .htaccess denying php files. Site wrecker?
In my experience the OP should make a copy of the current state of files as a backup and start from there. Not from a previous backup...
I have fixed several sites in the last years this way. You have to be very careful or you will be hacked "again". Well you are *still* hacked. As an example I have seen image.jpg files that were in fact scripts.
Might do a blog on this some day, but in Dutch it is already described here:
http://forum.cmsmadesimple.org/viewtopi ... 52&t=45525
I have fixed several sites in the last years this way. You have to be very careful or you will be hacked "again". Well you are *still* hacked. As an example I have seen image.jpg files that were in fact scripts.
Might do a blog on this some day, but in Dutch it is already described here:
http://forum.cmsmadesimple.org/viewtopi ... 52&t=45525
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
-
- Power Poster
- Posts: 444
- Joined: Wed Dec 27, 2006 5:15 pm
Re: .htaccess denying php files. Site wrecker?
I think I have decided what to do.
Looking at my files this morning, I have found a complete copy of an earlier version of this site in HTML, before I 'graduated' the site to CMSMS. All 3 languages, as it was tri-lingual: ENG/FR/DE/, with language switching. The CMSMS version does not work anyway and I am going to ask the host to 'clean' the server so I can start again clean, using CMSMS 2.xx.
Recreating 'feel' & content should now present no problem. All images etc to go on the new site will be from my system, not from the files left on the server. Most of my files date from when the HTML site was first created in HTML, circa 2007. They have been scanned and should be 'clean'.
I really am very grateful for the advice I have received. Thank you. It has been a traumatic 24 hours.
Regards
Martin
Looking at my files this morning, I have found a complete copy of an earlier version of this site in HTML, before I 'graduated' the site to CMSMS. All 3 languages, as it was tri-lingual: ENG/FR/DE/, with language switching. The CMSMS version does not work anyway and I am going to ask the host to 'clean' the server so I can start again clean, using CMSMS 2.xx.
Recreating 'feel' & content should now present no problem. All images etc to go on the new site will be from my system, not from the files left on the server. Most of my files date from when the HTML site was first created in HTML, circa 2007. They have been scanned and should be 'clean'.
I really am very grateful for the advice I have received. Thank you. It has been a traumatic 24 hours.
Regards
Martin