Symmetric denial of service
Description
The server is rendered unresponsive by successively repeating a request which consumes a lot of resources or takes too long to be processed.
Impact
Deny temporary or permanently the access to one or several application services.
Recommendation
Define a time-out when a query or a search is taking a lot of time processing the information
Threat
Anonymous attacker from the 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: L
- Privileges required: N
- User interaction: N
- Scope: U
- Confidentiality: N
- Integrity: N
- Availability: H
Temporal
- Exploit code madurity: X
- Remediation level: X
- Report confidence: X
Result
- Vector string: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H/E:X/RL:X/RC:X
- Score:
- Base: 7.5
- Temporal: 7.5
- Severity:
- Base: High
- Temporal: High
Code Examples
Compliant code
If a very large query needs to be used, include a time-out limit to avoid crashing the server
public class QueryTimeout {
public static void main(String[] args) {
try {
Statement stmt = connection.createStatement();
//Set a query timeout limit
stmt.setQueryTimeout(60);
// Execute sql query
ResultSet rs = stmt.executeQuery("select * from products");
while (rs.next()) {
System.out.println("code: " + rs.getString("code")
+ " ,product: " + rs.getString("name")
+ " ,price: " + rs.getDouble("price"));
}
} catch (SQLException e) {
//Code to handle exception
}
}
}
Non compliant code
The application contains queries that retrieve possible large amounts of information without any limits
public class QueryTimeout {
public static void main(String[] args) {
Statement stmt = connection.createStatement();
// Execute sql query
ResultSet rs = stmt.executeQuery("select * from products");
while (rs.next()) {
System.out.println("code: " + rs.getString("code")
+ " ,product: " + rs.getString("name")
+ " ,price: " + rs.getDouble("price"));
}
}
}
Requirements
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.