Safeguard
Application Security•

CWE-1043 Data Element With Too Many Non-Primitive Elements

A structure that bundles a large number of nested objects slows code and hides bugs. CWE-1043 explains the risk and what CISQ suggests as a limit.

Safeguard Security Team
2 min read

CWE-1043 is about size and shape. The product uses a data element, such as a structure or an aggregated object, that has an excessively large number of sub-elements with non primitive data types. MITRE lists it as a Base weakness in any language.

How it happens

Objects grow. A developer adds one more nested object to a record rather than refactoring, and a few years later the type has dozens of members, each a structure itself.

MITRE notes that what counts as excessively large varies by product or developer, and that CISQ recommends a default of 5 sub-elements. Treat that as a guide rather than a law.

# A grab bag type that keeps accumulating nested parts
class Order:
    customer: Customer
    billing: Address
    shipping: Address
    items: ItemList
    payment: PaymentInfo
    tax: TaxInfo
    audit: AuditTrail

The consequence in the record is reduced performance. The issue can make the product slower, and if the relevant code is reachable by an attacker, that might introduce a vulnerability, for example through expensive operations on huge objects. No CVEs are observed.

How to find it

MITRE lists no detection methods. Code metrics tools can count members per type. Review code that copies or serializes very large objects.

How to fix it

MITRE lists no formal mitigations. Reasonable steps:

  1. Split large types into focused ones with clear roles.
  2. Pass only what a function needs instead of the whole aggregate.
  3. Avoid deep copies of large structures on hot paths.
  4. Set a team threshold and check it in code review or CI.

Quick check

What default limit does CISQ recommend?

5 sub-elements, though MITRE notes the right number varies by product or developer.

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.