CWE-200 信息暴露

Information Exposure

结构: Simple

Abstraction: Class

状态: Draft

被利用可能性: High

基本描述

An information exposure is the intentional or unintentional disclosure of information to an actor that is not explicitly authorized to have access to that information.

扩展描述

The information either:

Many information exposures are resultant (e.g. PHP script error revealing the full path of the program), but they can also be primary (e.g. timing discrepancies in cryptography). There are many different types of problems that involve information exposures. Their severity can range widely depending on the type of information that is revealed.

相关缺陷

  • cwe_Nature: ChildOf cwe_CWE_ID: 668 cwe_View_ID: 1000 cwe_Ordinal: Primary

适用平台

Language: {'cwe_Class': 'Language-Independent', 'cwe_Prevalence': 'Undetermined'}

Paradigm: {'cwe_Name': 'Mobile', 'cwe_Prevalence': 'Undetermined'}

常见的影响

范围 影响 注释
Confidentiality Read Application Data

检测方法

Automated Static Analysis - Binary or Bytecode

According to SOAR, the following detection techniques may be useful:

Cost effective for partial coverage:
  • Bytecode Weakness Analysis - including disassembler + source code weakness analysis
  • Inter-application Flow Analysis

Dynamic Analysis with Automated Results Interpretation

According to SOAR, the following detection techniques may be useful:

Highly cost effective:
  • Web Application Scanner
  • Web Services Scanner
  • Database Scanners

Dynamic Analysis with Manual Results Interpretation

According to SOAR, the following detection techniques may be useful:

Cost effective for partial coverage:
  • Fuzz Tester
  • Framework-based Fuzzer
  • Automated Monitored Execution
  • Monitored Virtual Environment - run potentially malicious code in sandbox / wrapper / virtual machine, see if it does anything suspicious

Manual Static Analysis - Source Code

According to SOAR, the following detection techniques may be useful:

Highly cost effective:
  • Manual Source Code Review (not inspections)

Automated Static Analysis - Source Code

According to SOAR, the following detection techniques may be useful:

Highly cost effective:
  • Context-configured Source Code Weakness Analyzer
Cost effective for partial coverage:
  • Source code Weakness Analyzer

Architecture or Design Review

According to SOAR, the following detection techniques may be useful:

Highly cost effective:
  • Formal Methods / Correct-By-Construction
Cost effective for partial coverage:
  • Attack Modeling
  • Inspection (IEEE 1028 standard) (can apply to requirements, design, source code, etc.)

可能的缓解方案

MIT-46 Architecture and Design

策略: Separation of Privilege

Compartmentalize the system to have "safe" areas where trust boundaries can be unambiguously drawn. Do not allow sensitive data to go outside of the trust boundary and always be careful when interfacing with a compartment outside of the safe area. Ensure that appropriate compartmentalization is built into the system design and that the compartmentalization serves to allow for and further reinforce privilege separation functionality. Architects and designers should rely on the principle of least privilege to decide when it is appropriate to use and to drop system privileges.

示例代码

The following code checks validity of the supplied username and password and notifies the user of a successful or failed login.

bad Perl

my $username=param('username');
my $password=param('password');

if (IsValidUsername($username) == 1)
{
if (IsValidPassword($username, $password) == 1)
{
print "Login Successful";
}
else
{
print "Login Failed - incorrect password";
}
}
else
{
print "Login Failed - unknown username";
}

In the above code, there are different messages for when an incorrect username is supplied, versus when the username is correct but the password is wrong. This difference enables a potential attacker to understand the state of the login function, and could allow an attacker to discover a valid username by trying different values until the incorrect password message is returned. In essence, this makes it easier for an attacker to obtain half of the necessary authentication credentials.

While this type of information may be helpful to a user, it is also useful to a potential attacker. In the above example, the message for both failed cases should be the same, such as:

result

"Login Failed - incorrect username or password"

This code tries to open a database connection, and prints any exceptions that occur.

bad Java

try {
openDbConnection();
}
//print exception message that includes exception message and configuration file location
catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), '\n';
echo 'Check credentials in config file at: ', $Mysql_config_location, '\n';
}

If an exception occurs, the printed message exposes the location of the configuration file the script is using. An attacker can use this information to target the configuration file (perhaps exploiting a Path Traversal weakness). If the file can be read, the attacker could gain credentials for accessing the database. The attacker may also be able to replace the file with a malicious one, causing the application to use an arbitrary database.

In the example below, the method getUserBankAccount retrieves a bank account object from a database using the supplied username and account number to query the database. If an SQLException is raised when querying the database, an error message is created and output to a log file.

bad Java

public BankAccount getUserBankAccount(String username, String accountNumber) {
BankAccount userAccount = null;
String query = null;
try {
if (isAuthorizedUser(username)) {
query = "SELECT * FROM accounts WHERE owner = "
+ username + " AND accountID = " + accountNumber;
DatabaseManager dbManager = new DatabaseManager();
Connection conn = dbManager.getConnection();
Statement stmt = conn.createStatement();
ResultSet queryResult = stmt.executeQuery(query);
userAccount = (BankAccount)queryResult.getObject(accountNumber);
}
} catch (SQLException ex) {
String logMessage = "Unable to retrieve account information from database,\nquery: " + query;
Logger.getLogger(BankManager.class.getName()).log(Level.SEVERE, logMessage, ex);
}
return userAccount;
}

The error message that is created includes information about the database query that may contain sensitive information about the database or query logic. In this case, the error message will expose the table name and column names used in the database. This data could be used to simplify other attacks, such as SQL injection (CWE-89) to directly access the database.

This code stores location information about the current user:

bad Java

locationClient = new LocationClient(this, this, this);
locationClient.connect();
currentUser.setLocation(locationClient.getLastLocation());
...

catch (Exception e) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Sorry, this application has experienced an error.");
AlertDialog alert = builder.create();
alert.show();
Log.e("ExampleActivity", "Caught exception: " + e + " While on User:" + User.toString());
}

When the application encounters an exception it will write the user object to the log. Because the user object contains location information, the user's location is also written to the log.

分析过的案例

标识 说明 链接
CVE-2001-1483 Enumeration of valid usernames based on inconsistent responses https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2001-1483
CVE-2001-1528 Account number enumeration via inconsistent responses. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2001-1528
CVE-2004-2150 User enumeration via discrepancies in error messages. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-2150
CVE-2002-0515 Product sets a different TTL when a port is being filtered than when it is not being filtered, which allows remote attackers to identify filtered ports by comparing TTLs. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2002-0515
CVE-2004-0778 Version control system allows remote attackers to determine the existence of arbitrary files and directories via the -X command for an alternate history file, which causes different error messages to be returned. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-0778
CVE-2000-1117 Virtual machine allows malicious web site operators to determine the existence of files on the client by measuring delays in the execution of the getSystemResource method. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2000-1117
CVE-2003-0190 Product immediately sends an error message when a user does not exist, which allows remote attackers to determine valid usernames via a timing attack. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2003-0190
CVE-2008-2049 POP3 server reveals a password in an error message after multiple APOP commands are sent. Might be resultant from another weakness. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-2049
CVE-2007-5172 Program reveals password in error message if attacker can trigger certain database errors. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-5172
CVE-2007-1409 Direct request to library file in web application triggers pathname leak in error message. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-1409
CVE-2005-0603 Malformed regexp syntax leads to information exposure in error message. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2005-0603

分类映射

映射的分类名 ImNode ID Fit Mapped Node Name
PLOVER Information Leak (information disclosure)
OWASP Top Ten 2007 A6 CWE More Specific Information Leakage and Improper Error Handling
WASC 13 Information Leakage

相关攻击模式

  • CAPEC-116
  • CAPEC-13
  • CAPEC-169
  • CAPEC-22
  • CAPEC-224
  • CAPEC-285
  • CAPEC-287
  • CAPEC-290
  • CAPEC-291
  • CAPEC-292
  • CAPEC-293
  • CAPEC-294
  • CAPEC-295
  • CAPEC-296
  • CAPEC-297
  • CAPEC-298
  • CAPEC-299
  • CAPEC-300
  • CAPEC-301
  • CAPEC-302
  • CAPEC-303
  • CAPEC-304
  • CAPEC-305
  • CAPEC-306
  • CAPEC-307
  • CAPEC-308
  • CAPEC-309
  • CAPEC-310
  • CAPEC-312
  • CAPEC-313
  • CAPEC-317
  • CAPEC-318
  • CAPEC-319
  • CAPEC-320
  • CAPEC-321
  • CAPEC-322
  • CAPEC-323
  • CAPEC-324
  • CAPEC-325
  • CAPEC-326
  • CAPEC-327
  • CAPEC-328
  • CAPEC-329
  • CAPEC-330
  • CAPEC-472
  • CAPEC-573
  • CAPEC-574
  • CAPEC-575
  • CAPEC-576
  • CAPEC-577
  • CAPEC-59
  • CAPEC-60
  • CAPEC-616
  • CAPEC-643
  • CAPEC-646
  • CAPEC-651
  • CAPEC-79

引用