Skip to content

Archive

Web Security

130 articles
Cybersecurity 04 Sep 2026 11 min read

Treat Request Hostnames as Untrusted Input

A web application often needs to know which hostname a request targeted. That hostname helps route virtual hosts and can be useful when serving several domains. The security problem begins when the application treats the request hostname as if it were a trusted statement about its own public identity. If an unauthenticated client can influence that value, using it to build password-reset links, sign-in callbacks, canonical URLs, or other security-sensitive destinations can make the application generate URLs for a domain it does not control. Similar trust mistakes can also affect routing and caches.

Cybersecurity 04 Sep 2026 10 min read

Keep Redirect Targets Inside Trusted Destinations

Redirects are useful after sign-in, checkout, account setup, and many other workflows. The danger appears when an application lets request data decide the destination without enforcing where that destination may point. For example, a sign-in page might accept a next value and redirect the user there after authentication. If any absolute URL is accepted, an attacker can create a link on the application’s real domain that sends the user to an unrelated site. The first URL looks legitimate, but the final destination is controlled by someone else.

Cybersecurity 04 Sep 2026 10 min read

Cache Personalized Responses Without Cross-User Leaks

Caching can make an application faster by reusing a previous response instead of generating it again. That same reuse becomes a security problem when a response created for one user can be returned to another. Imagine /account renders the signed-in user’s email address and recent activity. The application checks authentication correctly at the origin server. A shared cache in front of it stores Alice’s response under a key based only on /account. Bob later requests the same path and the cache reuses Alice’s stored response without contacting the origin. The authentication code is correct, but it never gets a chance to run for Bob’s request.

Cybersecurity 03 Sep 2026 6 min read

Use HTTP Security Headers as Defense in Depth

HTTP security headers let a server tell browsers which security rules should apply to a response. They can restrict where content loads from, prevent MIME type guessing, reduce referrer leakage, and enforce encrypted transport. They are useful defense in depth, not a replacement for input validation, output encoding, authentication controls, or secure session handling. A strong header policy can limit the impact of some mistakes, but it cannot make an unsafe application secure by itself.

Cybersecurity 03 Sep 2026 7 min read

Secure File Upload Handling

File uploads cross a security boundary. A file supplied by a user may have a misleading name, unexpected content, excessive size, malicious active content, or a structure designed to exploit the software that processes it. Secure upload handling therefore requires more than checking a filename extension. Treat every uploaded file as untrusted until the application has validated, stored, processed, and served it according to an explicit policy. Start with a narrow upload policy Define what the feature actually needs to accept. An avatar service may need only a small set of image formats, while a document workflow may need PDF files and nothing else.

Cybersecurity 03 Sep 2026 6 min read

Harden Authenticated Sessions Against Hijacking

Authentication does not end when a password, passkey, or second factor is accepted. After login, most applications represent the user’s authenticated state with a session credential. Anyone who obtains that credential may be able to act as the user without repeating the original authentication. Session security therefore depends on protecting the credential throughout its lifecycle: creation, transport, use, rotation, expiration, and revocation. Treat the session identifier as a credential A session identifier should be unpredictable and generated with a cryptographically secure random generator. It should not encode sequential database IDs, timestamps, usernames, or other values an attacker can infer.

Cybersecurity 02 Sep 2026 5 min read

Practical CSRF Defense with SameSite Cookies and Tokens

Cross-site request forgery (CSRF) abuses the fact that browsers can automatically attach a user’s cookies to requests. If a state-changing endpoint trusts only the presence of an authenticated cookie, another site may be able to trigger that endpoint from the user’s browser. Modern cookie controls reduce the attack surface, but robust applications still need to reason about request semantics and trust boundaries. Understand the condition that makes CSRF possible A typical CSRF attack needs three ingredients:

Cybersecurity 02 Sep 2026 5 min read

Design Secure Password Reset Flows

Password reset is an authentication mechanism. Anyone who can complete the reset flow can usually take control of the account, so recovery deserves protections comparable to login. A secure design must prevent token guessing, account enumeration, replay, accidental disclosure, and long-lived takeover opportunities. Return the same public response A reset form often accepts an email address or username. Do not reveal whether that identifier exists. Prefer a response such as:

Web Development 01 Sep 2026 5 min read

Preventing SSRF in Backend Services That Fetch User-Supplied URLs

Features that fetch a URL supplied by a user appear in webhook testers, image importers, link previewers, document converters, and integration platforms. They also create a server-side request forgery (SSRF) boundary: an attacker can try to make the backend send requests to destinations the attacker cannot reach directly. A secure design needs more than a blacklist of suspicious strings. Understand the trust boundary The dangerous capability is not URL parsing itself. It is allowing untrusted input to influence a network connection made with the server’s network identity.

Cybersecurity 01 Sep 2026 3 min read

Prevent Session Fixation During Web Authentication

Session fixation occurs when an attacker can cause a victim to authenticate while using a session identifier the attacker already knows. If the application keeps that identifier after login, the attacker may reuse it to access the newly authenticated session. The core defense is to change the session identifier whenever privilege changes. Rotate at authentication boundaries After credentials, passkeys, or another authentication factor succeeds, create a fresh unpredictable session identifier and retire the pre-authentication identifier. Apply the same principle after privilege elevation, impersonation boundaries, or other security-sensitive identity changes.