Live Active security incident? Get immediate response
CWE Reference

CWE-462: Duplicate Key in Associative List (Alist)

Official CWE-462 CWE context with Glexia analysis, remediation guidance, related CVEs, and ATT&CK context.

Release 4.20weaknessIncomplete

Glexia's Take

CWE-462: Duplicate Key in Associative List (Alist)

Duplicate Key in Associative List (Alist) represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.

Executive Impact

  • Other: Quality Degradation,Varies by Context

Developer Pattern

CWE-462 is the kind of defect developers can usually prevent with explicit validation, safer framework defaults, and tests that exercise hostile input or unsafe state transitions.

Confidence

high confidence from CWE-462, 4.20.

Official CWE Definition

CWE-462: Duplicate Key in Associative List (Alist)

Duplicate keys in associative lists can lead to non-unique keys being mistaken for an error.

A duplicate key entry -- if the alist is designed properly -- could be used as a constant time replace function. However, duplicate key entries could be inserted by mistake. Because of this ambiguity, duplicate key entries in an association list are not recommended and should not be allowed.

Type
weakness
Abstraction
Variant
Status
Incomplete
Source
MITRE CWE definition

Developer And Remediation Guidance

How teams prevent and detect this weakness

Causes

  • The following code adds data to a list and then attempts to sort the data. Since basename is not necessarily unique, this may not sort how one would like it to be.

Remediation

  • Architecture and Design: Use a hash table instead of an alist.
  • Architecture and Design: Use an alist which checks the uniqueness of hash keys with each entry before inserting the entry.

Detection

  • Code review
  • SAST
  • DAST
  • Focused regression tests

Mappings

Related CVEs, CWEs, and ATT&CK context

Related CWEs

Related CVEs

Related CVE mappings appear after CVE records are cross-indexed.

Open CWE CVE mapping

ATT&CK Relevance

ATT&CK relevance is shown only when reviewed or responsibly inferred.