WordPress Hardening: 18 Ways to Harden Security of Your ...
文章推薦指數: 80 %
WordPress hardening is a catch-all term used to describe settings and configurations that increase the security of your website. These ...
Features
Features
MalwareScanner
MalwareRemoval
WordPressFirewall
BotProtection
VulnerabilityScanner
WordPressBackups
ActivityLog
Pricing
Blog
SignUp
Login
Login
WordPressHardening:18WaystoHardenSecurityofYourWebsite
December23,2020
TableofContents
Contents
hide
1
Beforeyoubegin
2
5EASYwaystohardenyourWordPresssecurity
2.1
Setstrongpasswords
2.2
Requiretheuseofstrongpasswords
2.3
Implementleastprivilegepermissions
2.4
InstallSSL
2.5
SetupaWordPresssecurityplugin
3
6MEDIUMmeasurestohardenWordPress
3.1
2-factorauthentication
3.2
Limitloginattempts
3.3
Keepanauditlog
3.4
Autologoutinactiveusers
3.5
SetupalertsforsuspiciousWordPresslogins
3.6
Setupawebapplicationfirewall
4
7COMPLEXWordPresshardeningmethods
4.1
BlockPHPexecutioninuntrustedfolders
4.2
Disablefileeditor
4.3
Changesecuritykeys
4.4
Disallowplugininstallations
4.5
Secureyourwp-config.phpfile
4.6
Separatingoutdatabases
4.7
Securingwp-admin
5
UsingaWordPresssecurityplugin
6
Forextracredit
6.1
Backupyourwebsite
6.2
Keepyourcomputercleanofmalware
6.3
Alwayskeepeverythingupdated
6.4
UseSFTP
6.5
Useatrustedwebhost
7
Conclusion
8
FAQs
8.1
WhatisWordPresshardening?
8.2
WhyshouldIhardenWordPress?
8.3
IsitdifficulttohardenWordPress?
8.4
DoIneedtohardenWordPressifIhaveasecurityplugin?
Therearesystemsthatarehardtohackinto,butmoreoftenthannot,websitesgethackedbecausetheyarevulnerable,andtheydon’thavebasicsecurityinplace.
Inthisarticle,wearegoingtotalkabouthowtohardenyourWordPresssite.
TL;DR:SecureyourwebsitewithMalCare,anall-in-onesecuritysuiteforWordPress.WithMalCare,youcanalsohardenWordPresssecurityin1-click.
Contents
hide
1
Beforeyoubegin
2
5EASYwaystohardenyourWordPresssecurity
3
6MEDIUMmeasurestohardenWordPress
4
7COMPLEXWordPresshardeningmethods
5
UsingaWordPresssecurityplugin
6
Forextracredit
Beforeyoubegin
We’veorganisedthelistbyeaseofimplementation,soyoucanstartatthetopandworkyourwaydownthelist.WerecommendthatyoustartbyinstallingMalCare,andusingtheSiteHardeningoptionthere.That’sahugestepintherightdirection,andthenyoucancomebackhereformoremeasures.
Protip:Wealwaysrecommendyoubackupyourwebsitebeforemakinganychanges,evensecurityones.Bettersafethansorry!
5EASYwaystohardenyourWordPresssecurity
Let’sstartthislistwithsomelow-hangingfruit.Getthesebasicsettingsoutoftheway,andwe’llallfeelgoodaboutmakingprogresswithhardeningWordPress.
Setstrongpasswords
Passwordsareperhapsthelowesthangingofalllow-hangingfruit.That’sprobablywhythey’rejustasoftenignored.Andthat’swhythey’reatthetopofahowtohardenyourWordPresssitelist.
Passwordsarehardtoremember,andyessomeofthebestpracticesaretiresome:noduplicatepasswords;noteasypasswords;amixofletters,numbersandsymbols;thelististrulydaunting,especiallywhenyoustoptocounthowmanyservicesyouuse.
Wesympathise,andsowesuggestusingapasswordmanager,likeLastPass.Useanautomatically-generatedstringofnumbers,lettersandsymbolstokeepyouraccountsafe.Eventhoughtheoddsaresmall,bruteforceattacksnowusedictionaryattackstoguessatpasswords.
Requiretheuseofstrongpasswords
Continuingwithourthemeofstrongpasswords,thisneedstobethenextitemonyourto-dolist.
Whenyouhavemultipleusershandlingyourwebsite,youneedtoensureeveryusermaintainsastrongpasswordandalsochangesitregularly.Now,thismaybeeasieronasmallscale,butwhenitcomestoabiggerteam,itwouldbebettertohaveasoftwarethatwillautomatethisforyou.
WordPressbydefaultwillalertyouifyouchooseaweakpassword:
However,youcanchoosetooverrideitbychecking‘confirmuseofweakpassword’.Bydoingso,youareleavingyourwebsitevulnerabletoattacks.
Toforcetheuserstoupdatetheirpasswords,thereusedtobepluginslikeExpirepasswords.Itwouldallowyoutosetamaximumnumberofdaysbeforethepasswordexpires.However,mostofthesepluginshavenotbeenupdatedforalongtime,sowewouldn’trecommendusingthem.
Implementleastprivilegepermissions
Thereare6pre-definedrolesyoucanhaveonaWordPresswebsite:SuperAdmin,Administrator,Editor,Author,ContributorandSubscriber.Eachrolehasasetofpermissions,andcanthereforeperformsometasks.Thesetasksarecalledcapabilities.Thefulllistofrolesandcapabilitiesishere.
Note:Forasinglewebsitetheadministratorroleisthemostpowerful,whereasforamultisiteitisthesuperadminrole.
Ifyouhaveasinglewebsite,youonlyneedalimitednumberofadministrators.Infact,theruleofthumbhereistohaveasfewadministratorsasyoucanpossiblymanagewith.Thereasoningisstraightforward:youarereducingtheriskofhackersstealingadmincredentials.
InstallSSL
SSLisawaytotransmitdatasecurelyfromusertoserver,andbackagain,overanencryptedconnection.
Quiteapartfromthefactthatitisagoodsecuritypractice,GooglerequiresthatwebsiteshaveSSL.Ittendstopenalisewebsitesbyshowing“Notsecure”inthebrowser,insteadofthepleasantgreenlockthatindicatesawebsiterunsonHTTPSinsteadofHTTP.
ItusedtobequitecomplicatedtoinstallanSSLcertificate,butnotanymore.WehaveacompleteguidetoinstallingSSL,andanothertomakesurethatallyourpagesareHTTPSaswell.
SetupaWordPresssecurityplugin
Alltheotherentriesinourlistuptothispointaremanualadditionsyoumaketoyourwebsite.Restassured,theyaretheeasyonesthatdon’trequiretoomuchconfiguration,orinstallationofplugins.
Therestofthislistisn’tquiteasstraightforward.ManyofthemeasuresareincludedinMalCare’sSiteHardeningfeature.
Youwillsaveaconsiderableamountoftimebyinstallingthepluginandusingourdashboardtosetupthemeasures.Tryitnow.
6MEDIUMmeasurestohardenWordPress
EachoftheWordPresshardeningmeasureswehaveincludedinthissectioninvolvetheinstallationofaplugin.Wedonotrecommendinstallingpluginslightly,astheyoftencontainvulnerabilities,andbecometheentrypointstoinfection.Pleaseusediscretionwhenchoosingaplugintocarryoutthefollowingsecuritymeasures.
2-factorauthentication
Oneofthemostcommonwayshackersbreakintowebsitesisthroughtheloginpage.Theyuseatechniquecalledbruteforceattackswhereintheyusebotstoguessthelogincredentialsofawebsite.Anotherwayhackerscangetinisifyourdatawasleakedfromanotherwebsite.Hackersareawarethatmanypeopleusethesameusernameandpasswordformultipleaccountsacrosstheinternet,andhence,itbecomeseasiertoplaytheguessinggame!
Toprotectyourself,youcanaddatwo-factorverificationforeveryuser–whethertheyareSuperAdmin,Administrator,Editor,Author,Contributor,oraSubscriber.
Manywebsites,Gmailforexample,giveuserstheoptionof2-stepverificationtologintotheiraccounts.Thisrequiresausertoprovidetheirlogindetailsfirst,andthenenterapasswordthatisgeneratedinreal-time(usuallyaone-timepasswordsenttotheregisteredphonenumber).Itmakesyouraccountharderforhackerstocrack,orforthemtogainaccesstoyourWordPressdashboard.
Limitloginattempts
There’sareasonwhywebsites,especiallybanks,giveusersonlythreeattemptstogettheirusernameandpasswordright.Afterthat,you’regiventheoptionof‘Forgotpassword’orevengetlockedoutofyouraccounts.Theimagebelowisanexampleofawarningthatisgeneratedanddisplayedontheloginscreenwhentheuserhasattemptedtologinwithwrongcredentials.
Thisisessentiallytoeliminatebruteforceattacksandreducethesuccessofhackersandfraudsters.
Bydefault,WordPressallowsanunlimitednumberofloginattempts.Enablinglimitedloginattemptsonyourwebsiteincreasesitssecurityandensureshackerscan’ttrythousandsofcombinationstogetin.Therearethreewaysinwhichyoucanlimitloginattemptsonyourwebsite.
YoucaninstallapluginlikeLimitLoginAttemptsReloaded.IfyoualreadyhavetheMalCaresecuritypluginactiveonyourwebsite,youautomaticallyhavelimitedloginprotectionagainstfailedattempts.Thepluginimplementscaptcha-basedprotectionthatwillpreventbadbotsfromaccessingyoursite.Bymanuallyinsertingcodeinthefunctions.phpfile.YouneedtoaddaWordPressactionandhookfilterwithacorrespondingcallbackfunction.Thismethodistechnicalandrisky.Ifyouaren’tsavvywithcoding,it’sbestnottoattemptthis.
You’llfindthecodeforthethirdoptionandamoredetailedexplanationinourarticleaboutlimitingloginattempts.
Keepanauditlog
ThismaynotbeaWordPresshardeningmeasureperse,butitisanabsolutemust-havesecuritymeasure.
SimplyinstallapluginlikeWPSecurityAuditLogwhichwilltrackeverythingthathappensonyourwebsite.Andinthisway,youwillknowexactlywhatyourusersaredoingandwhen.Youcanthenmonitorwhat’shappeningonyourwebsiteandholdusersaccountablefortheiractions.
Thepluginwillkeeptrackofeverything–logins,logouts,changesmade,creations,modifications,deletions,additions,updates,etc.Ifyouarehacked,youcanrefertotheactivitylogtoidentifyanysuspiciousactivityorchangesmade.
Youcangetinstantnotificationsiftherehavebeenanycriticalchangesmadetoyourwebsite.Youcanalsologofforblockanyuserwithjustaclick.
Autologoutinactiveusers
Thisfeatureisseenprimarilywithbankwebsitesandappsthatlogyououtafteraperiodofinactivity.Thisistoprotectyouraccountfromanyunauthorizedaccess.
Tosetthisup,youcanuseapluginthathasanidlesessionlogoutfeature.
SetupalertsforsuspiciousWordPresslogins
Hackersareconstantlyfindingwaystobypasssecurityfeatures,andthusitbehovesustobevigilant.It’sadvisabletosetupalertsonyourwebsitetobenotifiedofanysuspiciousactivityasandwhenithappens.
TodothisyouneedtouseasecuritypluginlikeMalCare.Itconstantlyscansyoursiteandalertsyouifitdetectsanymalwareoranythingsuspicious.
Setupawebapplicationfirewall
Awebapplicationfirewallwillblockhackersevenbeforetheyvisityourwebsite.TheydothisbytrackingIPaddresses–anumericalidentifierassignedtoeverydevicethat’sconnectedtotheinternet.
IftheIPhascarriedoutmaliciousactivitiesbefore,they’llbemarkedandblockedfromcomingtoyoursite.
Setupafirewallusingasecurityplugin,andrestassuredyouhavethebestprotectionpossibleforyourwebsite.
7COMPLEXWordPresshardeningmethods
NowwecometotherealscrappystufftohardenWordPress.Thefollowingmeasuresneedsomecodingordevelopmentexperience,otherwisemistakescancausesitecrashesandbreakdowns.
Proceedwiththesehardeningmethodswithsomecaution,andifyouhaven’talreadydoneso,pleasebackupyourwebsite.
BlockPHPexecutioninuntrustedfolders
Thisisabittechnicalbutlet’strytosimplifyitasmuchaspossible.
First,youneedtoknowPHPisascriptinglanguagethatisusedinwebdevelopment.APHPfunctionisablockofcodewritteninaprogramthatcanbeexecutedtoperformacertaintask.Next,yourWPwebsiteismadeupoffilesandfolders.However,onlycertainfilesandfoldersusephpfunctions.Onceahackergainsaccesstoyourwebsite,theycancreatetheirownfolders,ortheycaninserttheirPHPfunctionsintoyourexistingones.
Topreventsuchahack,youcanblocktheexecutionofPHPfunctionsfromanyunknownfolder.AndyoucanalsodisablethePHPexecutionsinplaceswhereitdoesn’tneedtohappen.
Forthis,followthesesteps:
Caution:MeddlingwiththebackendfilesanddatabasetablesofWordPressisriskybusinessandcancauseyoursitetobreak.Itrequirestechnicalknowledge.Ifyoudon’tknowwhatyou’redoing,it’sbesttogetprofessionalhelp.
1.Accessyourwebsite’sfilesviacPanel>FileManager.Ifyoudon’thaveaccesstocPanel,youcanuseanFTPclientlikeFileZilla.You’llneedyourFTPcredentialstoaccessyourfiles.
2.Gotopublic_htmlandyou’llseethreefolderscalledwp-includes,wp-admin,andwp-content,likeso:
3.Next,lookforthe.htaccessfile.Ifitdoesn’texist,youcancreateonebyopeningatexteditorlikeNotepadandsavingitas.htaccess.
4.Youneedtopastethefollowingcodeinyour.htaccessfile.
延伸文章資訊
- 1WordPress Security - 19 Steps to Lock Down Your Site (2022)
Server hardening is the key to maintaining a thoroughly-secure WordPress environment. It takes mu...
- 211 Effective Ways For Hardening WordPress - GeeksforGeeks
11 Effective Ways For Hardening WordPress · 1. Implement Two Factor Authentication · 2. Limit Log...
- 3The Ultimate WordPress Security Guide - Step by Step (2022)
Another way to harden your WordPress security is by disabling PHP file execution in directories w...
- 415 Ways To Harden The Security Of Your WordPress Site
15 WordPress Security Tips · Keep WordPress core, themes, and plugins up to date · Only install t...
- 5A Beginner's Guide to Hardening WordPress Security
13 Ways to Harden a WordPress Site · 1. Install an SSL certificate · 2. Use strong passwords · 3....