Updated September 2026. We rewrote this guide for how websites get attacked today. It now covers modern TLS and the move to shorter certificate lifetimes, patching plugins against fast mass exploitation, MFA on admin accounts, web application firewalls, backups, and a new section on Content Security Policy (CSP) and security headers. We removed outdated 2012–2018 statistics.
Most website attacks aren’t targeted. Bots scan the internet for outdated plugins, weak admin passwords and misconfigured servers, then break in automatically. The 12 practices below close the gaps they look for. They apply to any site, whether it runs on WordPress or another CMS, a custom application, or a hosted site builder.
Common website security risks
- Vulnerable plugins, themes and components: the most common way small sites are hacked.
- Stolen or weak admin credentials: brute force, credential stuffing and phishing for CMS, hosting and domain logins.
- Injection and broken access control: flaws that let attackers read data or act as other users. Broken access control is #1 on the OWASP Top 10:2025.
- Malicious third-party scripts: compromised analytics, chat or ad scripts that skim payment data or redirect visitors.
- DDoS and bot abuse: traffic floods, scraping, fake sign-ups and spam.
- Malware injection and SEO spam: hidden links and redirects that get sites flagged by search engines and browsers.
Top 12 website security practices
1. Use HTTPS everywhere with modern TLS
Serve every page over HTTPS and redirect all HTTP traffic. Support TLS 1.2 and 1.3 only, and disable old SSL and TLS 1.0/1.1. Add an HTTP Strict Transport Security (HSTS) header so browsers always use HTTPS (MDN).
Know what matters before your first meeting.
Weekday mornings. Five minutes. What changed in security, why it matters.
By subscribing you agree to our Privacy Policy.
Free. Weekday mornings. 5 minutes or less.
Automate certificate renewal. Under a CA/Browser Forum decision, the maximum lifetime of public TLS certificates dropped to 200 days for certificates issued from March 15, 2026, and will fall to 100 days in March 2027 and 47 days in March 2029 (CA/Browser Forum). Manual renewals won’t keep up, so use automatic renewal through your host, CDN or an ACME client with a free certificate authority such as Let’s Encrypt. HTTPS relies on public-key cryptography; our asymmetric encryption guide explains how it works.
2. Patch your CMS, plugins and themes quickly
Plugins are where most CMS vulnerabilities live. Patchstack counted 11,334 new vulnerabilities in the WordPress ecosystem in 2025, up 42% from 2024. 91% were in plugins, only six were in WordPress core, and 46% weren’t fixed by the developer when they were disclosed. For heavily exploited flaws, the median time to mass exploitation was 5 hours (Patchstack).
- Turn on automatic updates for core and trusted plugins, or check for updates at least weekly.
- Delete plugins and themes you don’t use; deactivated code can still be exploited.
- Replace abandoned plugins that no longer get updates.
- Keep the server stack updated too: PHP or other runtime, web server and database.
3. Require MFA on every admin account
Turn on multi-factor authentication for CMS admins and editors, and also for the accounts that control your site from outside: hosting control panel, domain registrar, DNS or CDN provider, and the email accounts used for password resets. Passkeys or security keys are the strongest option. Use long, unique passwords stored in a password manager, and limit login attempts. See our guide to multi-factor authentication.
4. Apply least-privilege access
Give each person their own account with the lowest role that does the job: most contributors don’t need admin rights. Remove accounts when people leave, review admin users regularly, and change default admin usernames and URLs where possible. In your own code, enforce authorization checks on the server for every request; broken access control was also the most exploited vulnerability type in Patchstack’s 2025 data.
5. Put a web application firewall (WAF) in front of the site
A WAF filters malicious HTTP requests such as SQL injection, cross-site scripting and known exploit attempts before they reach your application (Cloudflare). Cloud WAFs from CDN providers also absorb DDoS traffic and block bad bots, and many offer “virtual patching” rules that block attacks on a newly disclosed plugin flaw before you can update. A WAF supplements patching; it doesn’t replace it.
6. Keep backups you can actually restore
Back up files and databases automatically, at least daily for active sites. Keep copies off the web server and at least one offline or immutable copy that an attacker with your hosting login can’t delete. CISA recommends offline, encrypted backups and regular restore tests (CISA). Test a full restore to a staging site a few times a year.
7. Set security headers and a Content Security Policy
Security headers tell browsers how to handle your site and block whole classes of attacks. See the next section for a starter set.
8. Validate input and write secure code
Treat all user input as untrusted. Use parameterized queries to prevent SQL injection, encode output to prevent cross-site scripting, validate file uploads by type and size, and protect forms with CSRF tokens and rate limits. The OWASP Top 10:2025 lists the most critical web application risks, including injection (A05) and the new “Mishandling of Exceptional Conditions” (A10).
9. Control third-party scripts and dependencies
Every external script you embed, such as analytics, chat widgets, ads or tag managers, runs with full access to your pages. OWASP ranks software supply chain failures #3 in its 2025 Top 10. Keep an inventory of scripts and packages, remove what you don’t need, use Subresource Integrity (SRI) for scripts loaded from CDNs (MDN), and restrict script sources with CSP. If you take card payments, PCI DSS 4.0.1 requirements that became mandatory March 31, 2025 require an authorized inventory of payment-page scripts and monitoring for unauthorized changes to them and to security-impacting headers (PCI SSC).
10. Secure your hosting, domain and DNS
Choose a host that isolates accounts, patches servers, offers malware scanning and keeps logs. Turn on registrar lock and MFA at your domain registrar, keep domain contact details current so renewal notices reach you, and consider DNSSEC if your registrar and DNS provider support it. Don’t expose admin panels, databases or file-transfer services to the whole internet when you can restrict them by IP or VPN.
11. Log, monitor and alert
Log logins, admin actions, file changes and errors, and send alerts to someone who will act on them. OWASP renamed its logging category “Security Logging & Alerting Failures” in 2025 to stress that logs without alerts are of little value. Add uptime and file-integrity monitoring, and register your site in Google Search Console to get notified if Google detects malware or hacked content (Google).
12. Have a plan for when the site is hacked
Write down who to call (host, developer, payment provider), how to take the site offline or into maintenance mode, where clean backups are, and how to rotate every password and API key. After cleanup, find and fix the root cause, usually an outdated plugin or stolen password, before bringing the site back, then request a review in Search Console if the site was flagged.
Security headers and CSP basics
These response headers are a good starting point. Most can be added at the web server, CDN or through a security plugin (OWASP HTTP Headers Cheat Sheet; OWASP Secure Headers Project).
| Header | Starter value | What it does |
|---|---|---|
| Strict-Transport-Security | max-age=63072000; includeSubDomains; preload | Forces HTTPS for two years. Start with a shorter max-age and add preload only when every subdomain supports HTTPS. |
| Content-Security-Policy | See below | Restricts where scripts, styles, frames and other resources can load from, which limits cross-site scripting and injected skimmers. |
| X-Content-Type-Options | nosniff | Stops browsers from guessing file types, which prevents some content-injection attacks. |
| Referrer-Policy | strict-origin-when-cross-origin | Limits how much of your URLs are shared with other sites. |
| CSP frame-ancestors (or X-Frame-Options) | frame-ancestors 'self' or X-Frame-Options: DENY | Prevents other sites from framing yours (clickjacking). frame-ancestors supersedes X-Frame-Options in modern browsers. |
| Permissions-Policy | camera=(), microphone=(), geolocation=() | Turns off browser features your site doesn’t use. |
OWASP recommends turning off the old X-XSS-Protection header (X-XSS-Protection: 0) rather than relying on it; modern browsers have dropped that filter, and CSP does the job better.
How to roll out a Content Security Policy
CSP is the most powerful header and the easiest to break a site with, so introduce it in stages (MDN):
Know what matters before your first meeting.
Weekday mornings. Five minutes. What changed in security, why it matters.
By subscribing you agree to our Privacy Policy.
Free. Weekday mornings. 5 minutes or less.
- Start with
Content-Security-Policy-Report-Onlyso the browser reports violations without blocking anything. - Begin from a strict baseline and add the sources your site really needs, for example:
Content-Security-Policy-Report-Only: default-src 'self'; script-src 'self' https://www.googletagmanager.com; img-src 'self' data: https:; style-src 'self' 'unsafe-inline'; frame-ancestors 'self'; object-src 'none'; base-uri 'self'; form-action 'self'
- Review the reports for a week or two, add legitimate sources and remove unused scripts.
- Switch to the enforcing
Content-Security-Policyheader. Avoid'unsafe-inline'and'unsafe-eval'for scripts where you can; nonces or hashes are the stronger option. - Re-test after adding plugins, tags or embeds.
You can check your headers with your browser’s developer tools (Network tab, then Response Headers) or a free online header scanner.
Website security checklist
- HTTPS on every page, TLS 1.2+ only, HSTS on, certificates renewing automatically
- CMS, plugins, themes and server software updated; unused plugins deleted
- MFA on CMS, hosting, registrar, DNS/CDN and recovery email accounts
- Individual accounts with least privilege; old accounts removed
- WAF and DDoS protection enabled
- Automated, off-server backups, with a restore tested this quarter
- Security headers set, CSP in report-only or enforcing mode
- Third-party scripts inventoried; SRI on CDN scripts
- Logging and alerts for logins and file changes; Search Console set up
- A written incident plan with contacts
For the rest of your organization, use our full cybersecurity checklist and our password policy best practices.
Plugin and CMS vulnerabilities get exploited within hours. The CyberExperts Daily Brief flags the ones worth patching each weekday.
Frequently asked questions
What are the most important website security practices?
Keep your CMS, plugins and themes updated, require MFA on admin accounts, use HTTPS with automatic certificate renewal, run a web application firewall, keep tested off-server backups, and set security headers including a Content Security Policy.
How do most websites get hacked?
Mostly through outdated plugins and themes with known vulnerabilities, and through stolen or weak admin passwords. Patchstack found 91% of new WordPress ecosystem vulnerabilities in 2025 were in plugins, and heavily targeted flaws were mass-exploited within a median of 5 hours.
Do I still need an SSL certificate?
Yes, though it’s really a TLS certificate. It enables HTTPS, which browsers expect and search engines favor. Public certificates can now last at most 200 days, falling to 47 days by 2029, so set up automatic renewal.
What is a Content Security Policy?
A CSP is an HTTP header that tells the browser which sources of scripts, styles, images and frames your site allows. It limits the damage from cross-site scripting and injected malicious scripts. Roll it out in report-only mode first.
Is a web application firewall worth it for a small site?
Usually, yes. Cloud WAFs are inexpensive or included with many CDNs and hosts, block common attacks and bots, and can block exploits against newly disclosed plugin flaws before you patch.
How often should I back up my website?
At least daily for sites that change often, and before every update. Keep copies off the web server, including one an attacker can’t delete, and test restoring them regularly.
Which security headers should every website have?
Start with Strict-Transport-Security, Content-Security-Policy, X-Content-Type-Options: nosniff, Referrer-Policy, frame-ancestors (or X-Frame-Options) and Permissions-Policy.
Sources
- OWASP, Top 10:2025: owasp.org
- OWASP, HTTP Headers Cheat Sheet: owasp.org
- OWASP, Secure Headers Project: owasp.org
- Cloudflare Learning Center, What is a WAF?: cloudflare.com
- Patchstack, State of WordPress Security in 2026: patchstack.com
- CA/Browser Forum, Ballot SC-081v3: Introduce Schedule of Reducing Validity and Data Reuse Periods (Apr 2025): cabforum.org
- MDN, Strict-Transport-Security: developer.mozilla.org
- MDN, Content Security Policy (CSP): developer.mozilla.org
- MDN, Subresource Integrity: developer.mozilla.org
- Let’s Encrypt: letsencrypt.org
- CISA, #StopRansomware Guide: cisa.gov
- PCI Security Standards Council, Just Published: PCI DSS v4.0.1: pcisecuritystandards.org
- Google Search Central, Security issues report: support.google.com
Newer CyberExperts coverage on this topic
This article still works as background. If you want the current picture, start with the freshest related coverage below and today's brief.
8 Best AI Exposure Management Tools for CISOs in 2026
Scanners pile up findings faster than any team can patch, and attackers are weaponizing new flaws within hours. These eight AI exposure...
Security+ vs CySA+ (2026): Which CompTIA Cert to Take
Security+ SY0-701 vs CySA+ CS0-004: difficulty, $439 exam cost, renewal stacking, DoD 8140 roles, and which CompTIA cert to take first by...
DoD 8140 Approved Certifications (2026): Roles and Levels
How DoD 8140 replaced 8570 IAT/IAM with DCWF work roles and proficiency levels, plus which certifications qualify where in Qualification Matrix V2.1.
Friday’s brief: FortiMail due Saturday, then BoKS, vm2, Satellite
The fastest way to catch up on what changed after this article was published.
Start your morning with the signal that matters.
Get the biggest cybersecurity developments, why they matter, and where to go deeper on CyberExperts.
By subscribing you agree to our Privacy Policy.
Free. Weekdays. Built for operators.