Skip to main content

Business information leak - DB

Description

From sensitive information stored in the source code, business information is obtained, such as:

  • Users who have made recent transactions, document number and full name.
  • Wallet IDs.
  • Versions and operating system names.
  • Transaction codes.
  • Endpoints available to, and consumed by each user.
  • Associated credit cards.
  • Available balance.

Impact

  • Obtain information about users and their common transactions.
  • Obtain information about the applications APIs, and the parameters required to query them.
  • Identify the devices a user uses to access the application.
  • Associate a user with an account number, credit card number, and available balance.

Recommendation

According to the classification of the found information, establish the necessary controls, so the information is accessible only to the indicated persons.

Threat

Authorized attacker with the credentials obtained from the source code, on Internet.

Expected Remediation Time

⌚ 60 minutes.

Score

Default score using CVSS 3.1. It may change depending on the context of the vulnerability.

Base

  • Attack vector: N
  • Attack complexity: H
  • Privileges required: H
  • User interaction: N
  • Scope: U
  • Confidentiality: H
  • Integrity: L
  • Availability: N

Temporal

  • Exploit code madurity: X
  • Remediation level: X
  • Report confidence: X

Result

  • Vector string: CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:L/A:N/E:X/RL:X/RC:X
  • Score:
    • Base: 5.0
    • Temporal: 5.0
  • Severity:
    • Base: Medium
    • Temporal: Medium

Code Examples

Compliant code

The application uses a secure method to access the db without showing credentials in the source code

function getUserInfo(isLoggedIn, user){
const connection = createSQLConnection(user.Credentials);
connection.query('SELECT * FROM employee', function (error, results, fields) {
if (error) throw error;
results.forEach(result => {
//Code to handle the results
});
});
}

Non compliant code

The source code shows the db credentials directly

let connection = mysql.createConnection({
host: 'localhost',
user: 'root',
password: '1234',
database: 'clients'
});

function getUserInfo(isLoggedIn, user){
connection.query('SELECT * FROM employee', function (error, results, fields) {
if (error) throw error;
results.forEach(result => {
//Code to handle the results
});
});
}

Requirements