Insecure service configuration - Non Masked Variables

Insecure service configuration - Non Masked Variables

Description

It is possible to bypass the masking of environment variables when they are printed in the job logs, therefore sensitive data such as passwords, tokens, users, among others are exposed. This is possible because production secrets are saved in unprotected variables of git, therefore a developer could leak these credentials when running pipelines.

Impact

- Get admin credentials.
- Read, write and modify Gitlab resources.
- Get customer information.
- Download information and evidences of customers.
- Delete fluid and registries of customer.

Recommendation

Verify that the user who is trying to access the functionalities effectively has the necessary permissions to do so. Encrypt all sensitive information that is transported or stored within the application according to the policies of the organization.

Threat

External attacker allowed to run pipelines.

Expected Remediation Time

⌚ 30 minutes.

Score

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

Base

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

Temporal

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

Result

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

Score 4.0

Default score using CVSS 4.0. It may change depending on the context of the src.

Base 4.0

  • Attack vector: N
  • Attack complexity: H
  • Attack Requirements: N
  • Privileges required: H
  • User interaction: N
  • Confidentiality (VC): H
  • Integrity (VI): N
  • Availability (VA): N
  • Confidentiality (SC): H
  • Integrity (SI): L
  • Availability (SA): L

Threat 4.0

  • Exploit maturity: X

Result 4.0

  • Vector string: CVSS:4.0/AV:N/AC:H/AT:N/PR:H/UI:N/VC:H/VI:N/VA:N/SC:H/SI:L/SA:L/E:X
  • Score:
    • CVSS-BT: 7.0
  • Severity:
    • CVSS-BT: High

Compliant code

All sensitive information is hashed before sending it in a response

                const accessRecoveryPasswd = (req, res) => {
  if (isValidUser(req.body.user)) {
    if (validateToken == req.body.token){
      //Implement a function to mask sensitive information
      const recoveryPasswd = getRecoveryPasswd(req.body.userId);
      const maskedPasswd = MaskData.maskJSONFields(recoveryPasswd, maskJSONOptions);
      res.end(maskedPasswd);
    }
  }
}

            

Non compliant code

The application contains functionality that displays sensitive information without hashing

                const accessRecoveryPasswd = (req, res) => {
  if (isValidUser(req.body.user)) {
    if (validateToken == req.body.token){
      //Implement a function to mask sensitive information
      const recoveryPasswd = getRecoveryPasswd(req.body.userId);
      const maskedPasswd = MaskData.maskJSONFields(recoveryPasswd, maskJSONOptions);
      //A log job in the code could be used to access the unmasked variable with sensitive information
      console.log(maskedPasswd)
      res.end(maskedPasswd);
    }
  }
}

            

Requirements

Fixes

Free trial message
Free trial
Search for vulnerabilities in your apps for free with Fluid Attacks' automated security testing! Start your 21-day free trial and discover the benefits of the Continuous Hacking Essential plan. If you prefer the Advanced plan, which includes the expertise of Fluid Attacks' hacking team, fill out this contact form.