343
Scope Impact Likelihood
Confidentiality Read Memory
Modify Memory
A single fault could allow either an overflow (CWE-788) or
underflow (CWE-786) of the array index. What happens
next will depend on the type of operation being performed
out of bounds, but can expose sensitive information,
cause a system crash, or possibly lead to arbitrary code
execution.
Detection Methods
Automated Static Analysis
This weakness can often be detected using automated static analysis tools. Many modern tools
use data flow analysis or constraint-based techniques to minimize the number of false positives.
Automated static analysis generally does not account for environmental considerations when
reporting out-of-bounds memory operations. This can make it difficult for users to determine
which warnings should be investigated first. For example, an analysis tool might report array
index errors that originate from command line arguments in a program that is not expected to run
with setuid or other special privileges.
Effectiveness = High
This is not a perfect solution, since 100% accuracy and coverage are not feasible.
Automated Dynamic Analysis
This weakness can be detected using dynamic tools and techniques that interact with the
software using large test suites with many diverse inputs, such as fuzz testing (fuzzing),
robustness testing, and fault injection. The software's operation may slow down, but it should not
become unstable, crash, or generate incorrect results.
Black Box
Black box methods might not get the needed code coverage within limited time constraints, and a
dynamic test might not produce any noticeable side effects even if it is successful.
Potential Mitigations
Phase: Architecture and Design
Strategy = Input Validation
Use an input validation framework such as Struts or the OWASP ESAPI Validation API. Note that
using a framework does not automatically address all input validation problems; be mindful of
weaknesses that could arise from misusing the framework itself (CWE-1173).
Phase: Architecture and Design
For any security checks that are performed on the client side, ensure that these checks are
duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side
checks by modifying values after the checks have been performed, or by changing the client
to remove the client-side checks entirely. Then, these modified values would be submitted to
the server. Even though client-side checks provide minimal benefits with respect to serverside
security, they are still useful. First, they can support intrusion detection. If the server
receives input that should have been rejected by the client, then it may be an indication of an
attack. Second, client-side error-checking can provide helpful feedback to the user about the
expectations for valid input. Third, there may be a reduction in server-side processing time for
accidental input errors, although this is typically a small savings.
Phase: Requirements
Strategy = Language Selection
CWE Version 4.14
CWE-129: Improper Validation of Array Index
CWE-129: Improper Validation of Array Index