695
According to SOAR, the following detection techniques may be useful: Cost effective for partial
coverage: Manual Source Code Review (not inspections)
Effectiveness = SOAR Partial
Automated Static Analysis - Source Code
According to SOAR, the following detection techniques may be useful: Cost effective for partial
coverage: Source code Weakness Analyzer Context-configured Source Code Weakness
Analyzer
Effectiveness = SOAR Partial
Automated Static Analysis
According to SOAR, the following detection techniques may be useful: Cost effective for partial
coverage: Configuration Checker
Effectiveness = SOAR Partial
Architecture or Design Review
According to SOAR, the following detection techniques may be useful: Highly cost effective:
Inspection (IEEE 1028 standard) (can apply to requirements, design, source code, etc.) Formal
Methods / Correct-By-Construction
Effectiveness = High
Potential Mitigations
Phase: Architecture and Design
Strategy = Libraries or Frameworks
Use an authentication framework or library such as the OWASP ESAPI Authentication feature.
Demonstrative Examples
Example 1:
The following code intends to ensure that the user is already logged in. If not, the code performs
authentication with the user-provided username and password. If successful, it sets the loggedin
and user cookies to "remember" that the user has already logged in. Finally, the code performs
administrator tasks if the logged-in user has the "Administrator" username, as recorded in the user
cookie.
Example Language: Perl (Bad)
my $q = new CGI;
if ($q->cookie('loggedin') ne "true") {
if (! AuthenticateUser($q->param('username'), $q->param('password'))) {
ExitError("Error: you need to log in first");
}
else {
# Set loggedin and user cookies.
$q->cookie(
-name => 'loggedin',
-value => 'true'
);
$q->cookie(
-name => 'user',
-value => $q->param('username')
);
}
}
if ($q->cookie('user') eq "Administrator") {
DoAdministratorTasks();
}
CWE Version 4.14
CWE-287: Improper Authentication
CWE-287: Improper Authentication