Difference between revisions of "Duplicate key in associative list (alist)"

From OWASP
Jump to: navigation, search
(Related Vulnerabilities)
(Reverting to last version not containing links to www.textcarolibasb.com)
 
(One intermediate revision by one user not shown)

Latest revision as of 13:28, 27 May 2009

This is a Vulnerability. To view all vulnerabilities, please see the Vulnerability Category page.



Last revision (mm/dd/yy): 05/27/2009

Vulnerabilities Table of Contents

Description

Associative lists should always have unique keys, since having non-unique keys can often be mistaken for an error.

Consequences

Unspecified.

Exposure period

  • Design: The use of a safe data structure could be used.

Platform

  • Languages: Although alists generally are used only in languages like Common Lisp - due to the functionality overlap with hash tables - an alist could appear in a language like C or C++.
  • Operating platforms: Any

Required resources

Any

Severity

Medium

Likelihood of exploit

Low


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.


Risk Factors

TBD


Examples

In Python:

alist = []
while (foo()):
  #now assume there is a string data with a key basename
  queue.append(basename,data)
queue.sort()

Since basename is not necessarily unique, this may not sort how one would like it to be.


Related Attacks


Related Vulnerabilities

Related Controls

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

Related Technical Impacts


References

TBD