Skip to main content

Insecure service configuration - OTP

Description

The OTP mock is still enabled in the application.

Impact

  • Attacker with information from a user of the application gets to the point where the OTP is requested.
  • Enters default OTP and successfully logs in to the application.

Recommendation

Remove the OTP mock so that you can only login to the application with the OTP sent to the email.

Threat

Unauthorized user with access to the application.

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: 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 OTP service is securely configured, verifying the uniqueness of the code generated

const otpGenerator = require('otp-generator');
const { OTP_LENGTH, OTP_CONFIG } = require('../constants/constants');
//Implement a secure version of the OTP generator
module.exports.generateOTP = () => {
const OTP = otpGenerator.generate(OTP_LENGTH, OTP_CONFIG);
return OTP;
};

OTP_CONFIG: {
upperCaseAlphabets: true,
specialChars: false,
},

Non compliant code

The OTP service is insecurely configured to allow default access

const otpGenerator = require('otp-generator');
const { OTP_LENGTH, OTP_CONFIG } = require('../constants/constants');
//The code still contains the default OTP used during development
module.exports.generateOTP = () => {
const OTP = "OneTimeValue";
return OTP;
};

OTP_CONFIG: {
upperCaseAlphabets: true,
specialChars: false,
},

Requirements

free trial

Search for vulnerabilities in your apps for free with our automated security testing! Start your 21-day free trial and discover the benefits of our Continuous Hacking Machine Plan. If you prefer a full service that includes the expertise of our ethical hackers, don't hesitate to contact us for our Continuous Hacking Squad Plan.