Skip to content

CWE-1287: Improper Validation of Specified Type of Input

Base

The product receives input that is expected to be of a certain type, but it does not validate or incorrectly validates that the input is actually of the expected type.

When input does not comply with the expected type, attackers could trigger unexpected errors, cause incorrect actions to take place, or exploit latent vulnerabilities that would not be possible if the input conformed with the expected type. This weakness can appear in type-unsafe programming languages, or in programming languages that support casting or conversion of an input to another type.

Consequences

  • Other: Varies by Context

How to prevent it

  • Implementation: Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does. When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue." Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright.

Recent advisories

  • GHSA-f9x3-7vq9-cph6 — Laravel TokenGuard authentication bypass through non-string API credentials
  • GHSA-w8jc-g24h-crhw — GitPython command wrappers omit unsafe protocol and option checks
  • RUSTSEC-2026-0325 — Mis-typed WebAssembly tag imports can lead to GC heap corruption
  • GHSA-v39v-59xw-j98g — Open WebUI: Any authenticated user can suppress calendar alerts instance-wide via a non-numeric alert value
  • EEF-CVE-2026-82741 — Ash.Type.Union with :map_with_tag does not force the tag on dump, enabling tag confusion
  • GHSA-w7cw-xp7h-6j5j — Microsoft Security Advisory CVE-2026-50524 – .NET Denial of Service Vulnerability
  • GHSA-fj8f-m44g-c479 — PraisonAI: Prompt Injection Defense Bypassed for HIGH-Level Threats
  • GHSA-89v6-j5x6-cmj3 — YesWiki: SQL injection via the `recentchanges` action `period` argument leads to arbitrary DB read
  • GHSA-7h4p-rffg-7823 — vLLM: temperature=NaN and temperature=Infinity bypass validation and propagate to GPU kernels
  • GHSA-3hrh-pfw6-9m5x — Hono: Cookie helper does not sanitize sameSite and priority, allowing Set-Cookie injection
  • GHSA-29fc-p6c4-24cg — Symfony's OidcTokenHandler Accepts JWTs Missing aud/iss/exp Claims
  • GHSA-rmvv-8v8w-rf7x — Mattermost doesn't validate user-supplied input in API request handlers
  • GHSA-f54h-78c9-c24h — Concrete CMS: OAuth 2.0 Authorization-Code Handler Bypasses Account Status
  • GHSA-794g-x443-36f7 — Keycloak: Unauthorized access via improper validation of encrypted SAML assertions
  • GHSA-2v3w-6g35-5f9v — Mattermost fails to properly validate User-Agent header tokens

All advisories for CWE-1287

Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor