What is application security?
Application security is the work of keeping the code you write and deploy free of exploitable flaws, and of limiting the damage when one slips through.
How does application security differ from server security?
Server security protects the machine; application security protects what runs on it. A fully patched, firewalled server still leaks data if the web application lets one customer read another's invoices by changing a number in the URL. Both layers matter, and they reinforce each other: a hardened host limits what an attacker can do after exploiting the application. Our Hardening a new dedicated server article covers the host side.
Which flaws cause most breaches?
A small set of classes appears again and again in public vulnerability lists:
- Broken access control: users reaching records or functions that belong to others, often through predictable identifiers.
- Injection: untrusted input reaching an SQL query, a shell command or a template engine as code.
- Authentication weaknesses: missing rate limits, weak password storage, sessions that never expire.
- Vulnerable dependencies: an outdated library with a published exploit.
- Security misconfiguration: debug mode in production, default credentials, verbose error pages.
- Server-side request forgery: the application fetching attacker-chosen URLs, including internal addresses.
What coding habits prevent the common flaws?
A handful of rules, applied everywhere. Use parameterised queries, never string concatenation, for every database call. Check authorisation on the server for every object access, not just at login. Encode output for its context (HTML, attribute, JavaScript, URL). Store passwords with a slow hash such as Argon2id or bcrypt. Keep secrets out of source code and logs. Validate input against what is allowed, rather than trying to list what is forbidden.
# bad: user input becomes part of the SQL text
cur.execute(f"SELECT * FROM orders WHERE id = {order_id}")
# good: the driver sends the value separately
cur.execute("SELECT * FROM orders WHERE id = %s AND owner = %s", (order_id, user_id))
How do I keep dependencies safe?
Know what you ship and update it on a schedule. Lock files record exact versions; scanners compare them with vulnerability databases. Run them in the build pipeline so a known flaw fails the build:
npm audit --omit=dev --audit-level=high pip-audit -r requirements.txt osv-scanner scan --lockfile=composer.lock
Container images need the same treatment, since they carry a whole operating system userland; tools like Trivy scan both packages and application libraries.
Which tests find security bugs?
Several kinds, each catching different problems. Static analysis reads source code for dangerous patterns. Dynamic scanners probe a running test instance, as an attacker would. Dependency scanning covers third-party code. Manual review and occasional penetration tests find logic flaws that tools miss, such as a refund endpoint callable twice. A build server, for example on ESSENTIAL-M, can run all automated checks on every commit; our DevSecOps article describes fitting them into a pipeline.
What runtime defences help on a dedicated server?
Layers that limit what an exploit can reach. Run each application under its own unprivileged user. Use systemd sandboxing options such as ProtectSystem=strict, NoNewPrivileges=yes and PrivateTmp=yes. Put a reverse proxy in front to enforce request size limits, rate limits and security headers. Restrict outbound traffic with the host firewall so a compromised process cannot reach arbitrary addresses. Send logs somewhere the application cannot delete them.
[Service] User=shopapp NoNewPrivileges=yes ProtectSystem=strict ReadWritePaths=/srv/shop/var PrivateTmp=yes ProtectHome=yes RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
Does DDoS protection cover application attacks?
Partly. The network filtering included with every server here absorbs volumetric floods against the port, but a slow, well-formed attack against an expensive search page looks like normal traffic at the network level. Defend that layer in the application and proxy with caching, rate limits per client and queueing for heavy operations. Our DDoS protection on bare metal article explains where the network layer stops.
What should happen when a flaw is found?
Fix, deploy, check for exploitation, then learn. Patch and release quickly, search logs for signs that the flaw was used, rotate any secrets it could have exposed, and inform affected users if data was reached. Publish a simple security contact, such as a security.txt file, so outside researchers can report problems to you directly. Our Respond to a compromised server guide covers the response when a server itself has been breached.
Related pages
Hardening a new dedicated server
The first hour on a fresh machine: SSH keys, a firewall, automatic updates, brute force blocking and a habit of checking what listens.
Read moreIT security basics
The parts of IT security that matter for a team running servers: identity, patching, network exposure, data protection, logging and a practised response.
Read moreRespond to a compromised server
What to do in the first hour after you suspect an intruder on a rented machine: contain, preserve evidence, rebuild and close the hole.
Read moreDDoS protection on bare metal
How network edge filtering stops volumetric attacks before they reach your port, and what you still handle yourself.
Read moreQuestions and answers
What is the most common web application vulnerability?
Broken access control, where users can reach data or functions that belong to others. Checking authorisation on the server for every request prevents it.
How do I prevent SQL injection?
Use parameterised queries or a query builder that binds values separately from the SQL text. Never build queries by joining strings with user input.
Does a firewall protect my web application?
Only partly. A firewall limits which ports are reachable, but attacks on the application arrive through the same port as normal visitors and must be handled in the code.
How often should dependencies be updated?
Scan on every build and update on a regular schedule, with urgent updates as soon as a relevant vulnerability is published.
Which password hash should applications use?
A slow, salted algorithm designed for passwords, such as Argon2id or bcrypt. Fast general hashes such as SHA-256 alone are not suitable.