Safeguard
Application Security•

CWE-230 Improper Handling of Missing Values: Blank Parameters

A parameter name with no value, a blank header or a null field can crash code or leak errors. CWE-230 explained with a validation example.

Safeguard Security Team
2 min read

CWE-230, Improper Handling of Missing Values, covers a product that does not handle, or mishandles, a parameter, field or argument that is named but has no value: empty, blank or null.

Web servers, parsers, API handlers and any code reading headers or form fields can hit it.

How it happens

Developers test for "present" and "valid", and forget "present but empty". MITRE's observed examples show how often that gap matters:

// Vulnerable: key exists, value is the empty string
const id = req.query.id;            // "?id=" gives ""
const user = db.users[id.toLowerCase()].profile;   // throws on undefined

The thrown error may then reach the user, which is its own weakness (see CWE-211).

What an attacker gains

MITRE lists integrity: the product moves into an unexpected state. Two of the examples above went on to leak information, and one crashed the product.

How to find it

MITRE lists no detection methods. For every parameter, header and field, send the name with an empty value, with whitespace only, and with an explicit null where the format allows. Watch for crashes and verbose errors.

How to fix it

MITRE gives no mitigations. Practical steps:

  1. Treat empty and absent as separate cases and decide for each whether it is acceptable.
  2. Validate before use, and return a plain 400 with a generic message for bad input.
  3. Keep error pages generic so a missed case does not leak a path or query.
const id = (req.query.id || "").trim();
if (!id) return res.status(400).send("Bad request");

Quick check

Why test an empty value separately from a missing one?

They take different code paths. A name with no value passes a presence check but can still break code that expects content.

Sources

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.