Check Recently Modified Files in Server
Login to server through SSH, run the below commands to find out which scripts have been uploaded recently
$ cd /home/public_html/
$ find ./ -type f -mtime -15
(this code checks all files that has been uploaded / modified in last 15 days)
$ find /etc -type f -printf ‘%TY-%Tm-%Td %TT %p\n’ | sort -r
$ find /etc -type f -printf ‘%TY-%Tm-%Td %TT %p\n’ | sort -r
Check PHP Scripts that has been recently uploaded
$ cd /home/public_html/
$ find ./ -type f -name “*.php” -ctime -7
(this code checks all the PHP files that has been uploaded / modified in last 7 days)
$ find ./ -type f -name “*.php” -ctime +7
(this code checks all the PHP files that has been uploaded / modified before 7 days ago)
find ./ -type f -name “*.php” -atime -7
(this code checks all the PHP files that has been accessed in last 7 days)
find ./ -type f -name “*.php” -atime +7
(this code checks all the PHP files that has been accessed more than 7 days)
Find all files that are modified on April 1, 2020:
find ./ -type f -newermt 2020-04-01
OR
find ./ -type f -newermt 2020-04-01 ! -newermt 2020-04-02
Check Other Files:
You should check Robots.txt file & sitemap.xml files. Hackers use popular site that has better SEO so that they can sell their dark web market items through your site
In your public_html folder, you will see folders named .well-known, check those folders for new uploaded PHP/ Python / Bat files from which they will infect the site again.
Always check a site public html top folder for malware files. For example: if my site is arzerin.com/ check the top folders with some php files that you think you did not upload them.
Also check the top index.php files because at the top of the script, may be they have inject malware code already.
Find malware code in all files:
grep -rlnw '/home/public_html/' -e 'virus_code'
Hardening WP Site Security
Change WordPress File Permission
For Directories:
$ find /home/public_html/arzerin/ -type d -exec chmod 755 {} \;
For Files:
$ find /home/public_html/arzerin/ -type f -exec chmod 644 {} \;
Change .htaccess files:
# BEGIN WordPress # The directives (lines) between `BEGIN WordPress` and `END WordPress` are # dynamically generated, and should only be modified via WordPress filters. # Any changes to the directives between these markers will be overwritten.If your Site is WordPress Site, do the following:
A. Manually Update WordPress:
- Log into your server via SFTP or SSH.
- Backup your website and database (especially customized content).
- Manually remove the wp-admin and wp-includes directories.
- Replace wp-admin and wp-includes using copies from the official WordPress repository.
- Manually remove and replace plugins and themes with copies from official sources.
- Log into WordPress as an admin and click Dashboard > Updates.
- Apply any missing updates.
- Open your website to verify it is operational.
B. Reset Site Password from Database
C. Set new secret keys in the wp-config.php
Scan Your Website
- Sucuri Sitecheck (https://sitecheck.sucuri.net/)
- Google Transparency Check (https://www.google.com/transparencyreport/safebrowsing/diagnostic)
- Google Webmaster Console (https://search.google.com/search-console/welcome?hl=en)
- Bing Webmaster (https://www.bing.com/toolbox/webmaster)
- Yandex Webmaster (https://webmaster.yandex.com/)
- Norton Safe Web (https://safeweb.norton.com/)
RESOURCE LINK:
https://search.google.com/search-console/welcome?hl=en
https://wordpress.org/support/article/hardening-wordpress/
There are 0 comments