Penetration Testing

Web Security Best Practices: A 12-Point Website Security Checklist

By Vince AntonioPublished 6 min read

These 12 web security best practices close the gaps attackers use most on websites and web apps. Each one is mapped to the OWASP Top 10, so your developers know exactly what it covers.

In plain English

  • Most website break-ins use a small set of well-known weak spots.
  • Updates, a second login step and careful handling of user input stop many of them.
  • Give this checklist to whoever builds or hosts your website.
  • Have the site tested at least once a year and after big changes.

Web security best practices: the short answer

The web security best practices that matter most are simple to list. Encrypt all traffic. Keep software updated. Protect logins with a second step. Treat every piece of user input as untrusted. Then test the site regularly. The rest of this checklist builds on those habits.

Each item below maps to the OWASP Top 10. OWASP is a nonprofit that publishes free web security guidance. Its Top 10 is the most widely used list of serious web app risks. The current edition is from 2025. Our guide to the OWASP Top 10 explained covers each risk in detail.

#PracticeOWASP Top 10:2025 risk it helps with
1HTTPS everywhere, with HSTSA04 Cryptographic Failures
2Fast updates for software and librariesA03 Software Supply Chain Failures
3Strong logins and MFAA07 Authentication Failures
4Least privilege for users and staffA01 Broken Access Control
5Check all input, and use safe database queriesA05 Injection
6Security headers and safe settingsA02 Security Misconfiguration
7Keep secrets out of codeA04 Cryptographic Failures, A07 Authentication Failures
8Handle errors safelyA10 Mishandling of Exceptional Conditions
9Logging and monitoringA09 Security Logging and Alerting Failures
10Tested backupsLimits damage from any attack
11A web application firewallExtra layer, mainly against A05 Injection
12Regular testingAll ten, including A06 Insecure Design

Encryption and updates

1. Use HTTPS everywhere and turn on HSTS. HTTPS encrypts traffic between the browser and your site. It is the padlock in the address bar. HSTS is a setting that tells browsers to always use the secure version, even if someone types the plain address. Free certificates are widely available, so there is no reason to skip this.

2. Patch fast, including the libraries your code uses. Modern sites are built from many outside code packages (dependencies). A flaw in one of them is a flaw in your site. Use a tool that warns you when a package has a known problem, and update within days for serious ones.

Two recent cases show why. React2Shell let attackers take over servers running React Server Components, which many Next.js apps use. PHP2Shell did the same to PHP servers. In both cases, sites that updated quickly were safe. Sites that waited were at risk.

Logins and access

3. Protect logins and require MFA. MFA is a second login step, such as a code on your phone. Require it for every admin account, and offer it to customers. Also limit failed login attempts, and check new passwords against lists of known leaked ones. Passkeys are a strong option if your platform supports them.

4. Give people only the access they need. This is called least privilege. Staff, users and even your app's own database account should have the smallest set of rights that still lets them work. Check access on the server for every request. A user should never see another customer's order just by changing a number in the address bar.

Web application security in the code

These items are for your developers. They stop the attacks that target the app itself.

5. Never trust user input. Anything a visitor types or sends can be an attack. Two common examples:

  • SQL injection: an attacker types database commands into a form field. If the site pastes that text straight into a query, the attacker can read or delete your data. The fix is parameterized queries, which keep data and commands apart.
  • Cross-site scripting (XSS): an attacker gets the site to show their script to other visitors. The script can steal logins or change the page. The fix is to encode output, so the browser shows the text instead of running it.

6. Set security headers and safe defaults. Headers are short instructions your site sends to the browser. A Content-Security-Policy (CSP) tells the browser which scripts it may run, which limits XSS. Other useful headers stop your pages being loaded inside other sites. Also turn off default accounts, sample pages and directory listings.

7. Keep secrets out of your code. Secrets are passwords, API keys and tokens. (An API is how one piece of software talks to another.) Never store them in source code or shared documents. Use a secrets manager from your cloud or hosting provider. Change them when someone leaves or a leak is suspected.

8. Handle errors safely. Show visitors a plain error page, not a technical one. Detailed errors can reveal file paths and software versions. Make sure the app fails closed. If a check breaks, access should be denied, not allowed.

Backups, logging and a firewall

9. Log the events that matter and watch them. Record logins, failed logins, admin changes and payment changes. Send the logs somewhere an attacker cannot easily erase them. Set alerts for unusual activity, and make sure someone reads them.

10. Back up and test restores. Keep copies of your site, database and settings, with at least one copy the web server cannot change or delete. Restore from them on a schedule. A backup you have never restored may not work when you need it.

11. Put a web application firewall in front of the site. A web application firewall (WAF) filters traffic and blocks common attacks before they reach your app. It buys time while you fix a flaw. It is not a fix by itself.

Website security checklist step 12: test regularly

12. Test the site, not just the checklist. Good intentions drift as code changes. Use a mix of testing methods:

  • Automated code checks while developers write code (SAST) and checks against the running site (DAST). Our SAST vs DAST guide explains the difference.
  • Regular vulnerability scans to catch missing updates and weak settings.
  • A penetration test at least once a year, and after major releases. A skilled tester looks for logic flaws that tools miss.
Testing is most useful before launch. Fixing a design flaw after release usually costs far more time than catching it early.

How NextGarrison helps

We test websites, web apps and APIs against the OWASP Top 10 and beyond. You get findings ranked by real risk and clear steps your developers can follow. We can also retest once fixes are in. See our services or request a web application test.

Sources

Topics:Application SecurityVulnerability ManagementSmall Business

Need a hand with this?

Talk to a senior consultant. We reply within one business day with clear next steps and a scoped quote.

Prefer to just ask? Contact us and a consultant will reply.

Written by

Vince Antonio

Security writer and consultant, NextGarrison

Vince writes NextGarrison's security news, technical vulnerability write-ups and guides. He covers actively exploited flaws, penetration testing, SOC monitoring and getting ready for SOC 2, ISO 27001 and PCI DSS, in plain English with sources for every claim.

Want the next alert like this one?

New vulnerability alerts as soon as we publish them. Free, no sign-up, works in Feedly, Outlook, Slack and Teams.

Frequently Asked Questions

What are the most important web security best practices?

Use HTTPS with HSTS, update software and libraries quickly and require MFA on admin logins. Check all user input, set security headers and test the site regularly.

What should a website security checklist include?

At minimum: encryption, updates, strong logins, access control, input checks, security headers, secret handling, safe errors, logging, backups, a firewall and regular testing. The table in this guide maps each item to the OWASP Top 10.

Is a web application firewall enough to protect my site?

No. A WAF blocks many common attacks and buys time, but attackers can sometimes get around it. You still need to fix flaws in the code and keep software updated.

How often should a website be security tested?

Scan it at least every three months and after big changes. Have a penetration test at least once a year and before or after major releases.

Keep reading