Skip to main content

Business information leak - AWS

Description

Business information is obtained, such as:

  • Application flows, script and operation.
  • User list.
  • Employee information.
  • Customer information Through the use of AWS credentials found in plain text in the source code.

Impact

Gain access to cloud repositories will be able to gain access to sensitive information.

Recommendation

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

Threat

Attacker with access to the code.

Expected Remediation Time

⌚ 120 minutes.

Score

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

Base

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

Temporal

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

Result

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

Code Examples

Compliant code

The application correctly sets up access to the databases without showing credentials

const uploadFile = (fileName) => {
const fileContent = fs.readFileSync(fileName);
//Function to establish connection to the db without storing plain text credentials on the code
const s3 = establishBucketConnection();
// Setting up S3 upload parameters
const params = {
Bucket: BUCKET_NAME,
Key: 'file',
Body: fileContent
};
// Uploading files to the bucket
s3.upload(params, function(err, data) {
//Code to upload files and handle errors
});
};

Non compliant code

The source code shows the db credentials directly

const AWS = require('aws-sdk');
const ID = 'MyBucketID';
const SECRET = 'AccessKeyInCode';
const BUCKET_NAME = 'bucket';

const uploadFile = (fileName) => {
const fileContent = fs.readFileSync(fileName);
// Setting up S3 upload parameters
const params = {
Bucket: BUCKET_NAME,
Key: 'file',
Body: fileContent
};
// Uploading files to the bucket
s3.upload(params, function(err, data) {
//Code to upload files and handle errors
});
};

Requirements