Performance Impact
This document provides guidance on mitigating potential performance impacts associated with enabling One-Time Password (OTP) functionality in SAP Commerce during the customer login process.
Denial-of-Service Prevention
One-Time Password can add an additional layer of security, but it may also place a higher load on server resources, especially during high traffic periods or in case of malicious attack attempts. This guide outlines considerations to help ensure system stability, documents strategies to control load, and emphasizes best practices for OTP management.
Performance Impact on Customers
-
Increased request volume: Each login attempt that triggers the OTP functionality generates an additional request from the client to receive the OTP, and another one to validate it. This process results in an increased load.
-
Rate of authentication requests: When numerous users log in simultaneously, the system may experience a heightened load.
-
Effect on application availability: If the server is not scaled appropriately, it may struggle under high loads, leading to performance degradation, increased response times, and potential service unavailability.
To help manage these challenges, it's recommended to evaluate the potential performance impact before deploying the OTP functionality in production, taking into account customer-specific traffic patterns.
Utilizing Rate Limiting and Web Application Firewalls (WAFs)
To mitigate the risk of system overload from excessive OTP requests, customers should implement IP-based rate limiting and utilize a Web Application Firewall (WAF) as an additional protective measure.
-
Rate Limiting:
-
IP-based rate limiting helps control the frequency of OTP requests from individual IP addresses, which can prevent both accidental and intentional overuse of OTP requests.
-
Customers should configure rate limits for OTP requests based on typical usage patterns to allow legitimate users access while minimizing the risk of abuse or accidental overload.
-
-
Web Application Firewall (WAF):
-
A WAF can further protect the application from automated and malicious attempts to abuse the OTP functionality. By applying WAF rules, customers can detect and block suspicious patterns that may indicate a coordinated attack or excessive request generation from specific IP ranges.
-
Customers are encouraged to review and adjust their WAF settings in accordance with their application security and performance needs.
-
For more information, see the related links to SAP Commerce WAF documentation.
Detailed Rate-Limiting Configurations
There are also OTP-related properties that give you more control over rate limits.
-
otp.customer.login.token.maxcount.enabled:
This property specifies if there should be a maximum number of valid verification tokens that can be created. If this property is not added to the project.properties file, then it will be interpreted as value equal to true and the maximum number of valid verification tokens will be checked by default.
-
otp.customer.login.token.maxcount:
This property defines the maximum number of valid verification tokens which can exist. If this number is reached, the attempts to create a token will fail. The property is taken into account if otp.customer.login.token.maxcount.enabled is set to true.
Load Testing Requirements
To proactively identify performance bottlenecks, customers are strongly encouraged to perform load testing before activating the OTP functionality in a production environment, if load testing is permitted within their cloud application deployment.
Why Load Testing is Essential
-
Measure the impact of OTP on application performance, including CPU, memory, and network usage.
-
Assess server scaling needs for different levels of anticipated OTP traffic.
-
Identify any performance degradation that could affect end users.
Best Practices for Load Testing
-
Simulate peak traffic: Configure load tests to simulate your anticipated peak OTP request volume. It will help you understand how the system performs under stress.
-
Set thresholds: Define acceptable performance thresholds (for example, maximum response time or allowable error rates) to measure the OTP functionality impact on the login process.
-
Monitor system metrics: During the load test, track key metrics like response time, server load, memory usage, and network bandwidth to identify potential bottlenecks.
-
Scale as needed: Based on load test results, adjust scaling parameters of your system to handle the OTP load appropriately.
If load testing in your cloud environment is not permitted, consider conducting a controlled test in a separate environment to gauge performance impact before activating the OTP functionality in production.
Mitigation Steps Summary
Here is a summarized list of actions you should take to mitigate the potential impact of OTP on system performance:
-
Evaluate the expected load increase: Understand the additional load that OTP will generate for your login system, particularly under peak conditions.
-
Implement rate limiting: Configure IP-based rate limiting to control the rate of OTP requests, protecting against excessive demand.
-
Leverage WAF for security: Use WAF rules to detect and mitigate suspicious patterns or attacks targeting OTP endpoints.
-
Conduct load testing: Before activating OTP in production, perform a load test to measure how well your system handles increased OTP-related traffic and to assess scaling needs.
Following these guidelines will help ensure that the OTP functionality is deployed securely, sustainably, and with minimal impact on end-user experience.
Possibility of Unauthorized Access Due to DB Leaks
Issue Overview
-
Database dump leak: The attacker gains access to a database containing authentication tokens.
-
Weak token encoder: The token encoder in use is not secure, for example, using a plaintext encoder amplifies the risk since token codes would be stored in plain text.
-
Token ID retrieval: The attacker successfully retrieves a valid token ID corresponding to an active token. This requires computational effort to perform a collision attack on SHA512.
-
Token validity: The retrieved token remains valid within its default lifespan of 5 minutes. What is more, OTP tokens are one-time only, so if a rightful token owner provides a valid token code for the matching token id, the token is used. The used token is removed from the database and can't be reused to validate another authentication operation.
Mitigation Strategies
-
Database security:
-
Ensure database access is tightly secured by employing robust access control mechanisms.
-
Regularly update and patch the database management software to address known vulnerabilities.
-
-
Secure token encoder:
-
Use a secure encoder for token codes. The encoder can be configured using the otp.customer.login.token.code.encoder property. Refer to the documentation for details on setting this property.
-
Avoid using plaintext encoders for token generation to prevent trivial token extraction.
-
-
Token Time-to-Live Adjustment:
-
Reduce the default token lifespan from 5 minutes to a lower value (up to 1 minute) by configuring the otp.customer.login.token.ttlseconds property. Note that shorter lifespans may impact system performance and user experience.
-
-
Increase Token ID Complexity:
-
Enhance the complexity of token ID generation by configuring the otp.customer.login.token.id.generator.bits property to a higher value. Be aware that this change may also affect performance.
-
By implementing these mitigation measures, the risk of unauthorized access due to a database breach and token compromise can be significantly reduced.