Safeguard
Application Security•

CWE-1067 Excessive Sequential Searches of a Data Resource

SQL queries that skip indexes force full table scans. CWE-1067 explains how this slows a product and how to check your queries.

Safeguard Security Team
2 min read

CWE-1067 covers a data query against an SQL table or view that does not use an index and may cause sequential searches. Anyone running a relational database behind an application can hit it, usually as tables grow.

How it happens

A query filters on a column with no index, or wraps an indexed column in a function so the index cannot be used. The database reads every row.

-- Pattern to avoid: the function on the column defeats a plain index
SELECT * FROM orders WHERE LOWER(email) = 'a@example.com';
-- Better: index the expression, or compare the stored value directly
CREATE INDEX idx_orders_email_lower ON orders (LOWER(email));

Expression indexes exist in several databases but not all, so check yours.

What an attacker gains

MITRE lists an availability consequence: reduced performance. If an attacker can reach the code, the performance problem "might introduce a vulnerability." A request that forces a full scan is cheap to send and expensive to serve.

How to find it

The record lists no detection methods. Run your database's query plan tool, such as EXPLAIN, on frequent queries and look for sequential or full scans on large tables.

How to fix it

  1. Add indexes on columns used in filters and joins.
  2. Rewrite queries so indexed columns are compared directly.
  3. Limit result sizes and require filters on public endpoints.

Quick check

How can you see if a query scans the whole table?

Run the database's plan command, such as EXPLAIN, and look for a sequential or full table scan.

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.