Skip to content

Archive

Input Validation

44 articles
Cybersecurity 08 Sep 2026 9 min read

Keep Untrusted Data Out of Object Deserializers

A serialized object can look like ordinary input: bytes arrive from a request, queue, cache, file, or database and the application turns them back into an object. The important difference is that some object deserializers do more than decode values. They can choose application types, reconstruct object graphs, and invoke type-specific behavior while reconstruction is happening. That makes object deserialization a security boundary. If an attacker can influence the serialized bytes, treating those bytes as instructions for rebuilding application objects can lead to unexpected state, denial of service, or, with some formats and available types, code execution.

Cybersecurity 08 Sep 2026 10 min read

Confine Archive Extraction to a Trusted Directory

An application that accepts ZIP, TAR, or similar archives may appear to be handling one uploaded file. During extraction, however, the archive can ask the application to create many filesystem objects with names chosen by whoever created the archive. If those names are treated as trusted paths, extraction can write outside the directory the application intended to use. The consequence can be more serious than a misplaced file. Depending on the process permissions and surrounding system, an unintended write might replace application data, alter configuration, or place content where another component will later consume it.

Cybersecurity 08 Sep 2026 8 min read

Build Security Links from Trusted Origins

Applications often need to send absolute links in email: password-reset links, email-verification links, invitation links, and similar security-sensitive URLs. A convenient implementation takes the hostname from the incoming HTTP request and combines it with a generated token. That convenience can cross a trust boundary. Request host information is input, and deployments may also receive forwarded host information from proxies. If an attacker can influence the value used to build a security link, the application can generate a valid secret token but place it inside a URL for the wrong origin. A user who follows that URL may disclose the token to a host the application does not trust.

Cybersecurity 07 Sep 2026 10 min read

Treat File Uploads as Untrusted Content

A file-upload feature can appear simple: accept bytes, save them, and let another user download them later. The security problem is that the uploaded file crosses several trust boundaries. Its name, declared type, contents, and eventual delivery behavior are all influenced by the uploader. If the application treats any of those properties as trustworthy, an ordinary upload can become an unintended way to consume excessive resources, overwrite data, feed dangerous content into a parser, or make a browser handle attacker-controlled bytes in a more powerful context than intended.

Cybersecurity 06 Sep 2026 11 min read

Validate File Uploads Before You Trust Them

A file upload endpoint accepts more than bytes. It also receives a filename, a declared content type, a size, and often assumptions about what the application will do with the file later. The security problem begins when those claims are treated as proof. A user can rename a file. A client can send an arbitrary Content-Type value. A file can satisfy one superficial check while still being unsuitable for the parser, storage location, or download behavior that follows. If the application accepts the wrong file, the consequence may be unsafe parsing, unexpected active content, storage abuse, or a file being served in a context the application never intended.

Cybersecurity 06 Sep 2026 9 min read

Treat Request Hosts as Untrusted Input

Web applications often need to know their own public hostname. A framework may expose it as request.host, a reverse proxy may forward it in a header, and application code may use it to build an absolute URL. That is convenient, but it can quietly turn request-controlled data into a security decision. If an application accepts an arbitrary request host and later places that value into a password-reset link, redirect, cache entry, or routing decision, an attacker may be able to make trusted application output point at an unintended host. The exact consequence depends on where the value is used, but the underlying mistake is the same: treating a routing identifier supplied with a request as if it were trusted configuration.

Cybersecurity 06 Sep 2026 10 min read

Normalize Before Making Security Decisions

A security check can inspect the right data and still reach the wrong decision if another component changes that data afterward. A path may be validated before path resolution removes .. segments. A percent-encoded value may pass a character check and then gain different characters when a later layer decodes it. Two names that look different to one component may be treated as equivalent by another. The consequence is a representation mismatch: the security decision is made about one form of a value, while the sensitive operation uses another. An attacker does not need to defeat the policy itself if they can make the validator and the consumer disagree about what the input means.

Cybersecurity 06 Sep 2026 11 min read

Bound Work Before Processing Untrusted Input

An input does not need to be malicious code to hurt a service. It only needs to make the service spend far more memory, CPU time, storage, or concurrency than the sender spent creating the request. A parser may accept deeply nested data. A compressed upload may expand far beyond its transfer size. A search endpoint may allow a query that is valid but unusually expensive. If enough work begins before the application applies a limit, a small amount of incoming traffic can consume resources needed by legitimate users.

Cybersecurity 05 Sep 2026 10 min read

Prevent Log Injection with Structured Events

Security logs are useful only when their meaning survives the journey from an application to the people and systems that read them. If untrusted text can change where one event appears to end, create convincing fake fields, or confuse a downstream parser, an attacker may be able to make suspicious activity harder to interpret. This problem is commonly called log injection or log forging. It happens when data controlled by an external party is treated as part of the log format rather than as data inside a log event.

Cybersecurity 05 Sep 2026 9 min read

Keep Untrusted Paths Inside an Intended Directory

Applications often need to turn input into a file operation: download a report, store an attachment, load a template, or unpack an archive. A dangerous mistake is treating an input path as if it were only a name. Paths contain structure, and that structure can redirect the operation somewhere the application did not intend. If an application expects a file under one directory but lets untrusted input influence the resolved location, a path traversal flaw can expose or overwrite files outside that directory. The consequence depends on what the process can access: configuration, application data, credentials, or other users’ files may fall within reach.

Cybersecurity 05 Sep 2026 11 min read

Do Not Trust the Request Host for Security-Sensitive URLs

Applications sometimes need to create an absolute URL. A password-reset email, email-verification message, or security notification may need a link such as https://accounts.example.com/reset/... rather than a relative path. A tempting implementation takes the host name from the current HTTP request and combines it with the path. That is convenient, but it can quietly move a security decision into attacker-controlled input. If the deployment accepts an unexpected host value, the application may generate a valid security token inside a link pointing at the wrong site.

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 9 min read

Treat Deserialization as a Trust Boundary

Applications constantly turn bytes into useful values. A request body becomes a set of fields, a cached value becomes a record, or a message from a queue becomes a command. This conversion is called deserialization when the bytes represent a previously encoded data structure. The security problem begins when deserialization does more than recover inert data. Some serialization systems can reconstruct application-specific object types or trigger behavior while rebuilding an object graph. If an attacker can influence that serialized input, the parser may be asked to create types or invoke mechanisms that the application never intended to expose at that boundary.

Cybersecurity 04 Sep 2026 10 min read

Normalize Security-Sensitive Input Before Making Decisions

Security checks often compare names, paths, identifiers, hosts, or other values against a rule. The rule may be correct and the comparison may look correct, yet the system can still make the wrong decision if different components interpret the same input differently. For example, one layer may treat two textual forms as equivalent while another treats them as different. A validator can approve one representation, then a later component can normalize or decode it into a different value before using it. The security check and the operation are no longer reasoning about the same thing.

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 11 min read

Keep File Access Inside an Intended Directory

Applications often let a caller identify a file: download an invoice, open an exported report, read a template, or retrieve an uploaded document. The dangerous version of this design treats a caller-controlled path as if it were already a permitted file. A path can describe movement through a filesystem, not just a filename. If untrusted input is combined with an application directory without a reliable containment check, the resulting path may resolve somewhere outside that directory. A read operation can expose configuration or private data; a write or delete operation can have more serious consequences.

Cybersecurity 04 Sep 2026 9 min read

Keep Data Separate from Interpreter Syntax

Applications constantly move data into systems that interpret syntax: databases parse queries, shells parse commands, browsers parse HTML, and template engines parse expressions. A security problem appears when data that should remain inert can change the structure of those instructions. That is the core of injection. If an attacker can influence where instructions end and data begins, the receiving interpreter may perform work the developer never intended. The consequence depends on the interpreter: unauthorized database operations, unintended operating-system actions, or active content in a browser are all possible outcomes of the same design mistake.

Cybersecurity 04 Sep 2026 9 min read

Allowlist Writable Fields to Prevent Mass Assignment

An API endpoint may look harmless because it updates only the current user’s profile. The danger can appear one layer lower: if the framework automatically copies every supplied request field into the stored user object, the client may be able to change properties that the interface never intended to expose. For example, a profile request might legitimately accept display_name and timezone. The underlying user record may also contain role, account_status, or billing_limit. If the update path treats every recognized object property as client-writable, authorization decisions made elsewhere can be bypassed through an ordinary update operation.

Cybersecurity 03 Sep 2026 10 min read

Validate Untrusted Input at Trust Boundaries

Applications constantly receive data they did not create: HTTP parameters, uploaded metadata, webhook payloads, queue messages, imported files, configuration from external systems, and values read from shared storage. The security problem is not that every external value is malicious. The problem is that application code can make unsafe assumptions about values whose shape, size, meaning, or origin has not been established. Boundary validation reduces that risk by checking untrusted data before the rest of the application relies on it. The goal is simple: turn vague external input into explicit internal invariants.

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.