Skip to main content

Asymmetric denial of service

Description

The server is rendered unresponsive as a result of one of the following:

  • An amplification attack, which uses a single request to produce multiple responses.
  • A single malicious request that breaks the application or consumes an enormous amount of resources.

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 {
private static final String URL = "mydburl";
private static final String USERNAME = "root";
private static final String PASSWORD = "";

public static void main(String[] args) {
try (Connection connection =
DriverManager.getConnection(URL, USERNAME, PASSWORD)) {
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 {
private static final String URL = "mydburl";
private static final String USERNAME = "root";
private static final String PASSWORD = "";

public static void main(String[] args) {
Statement stmt = connection.createStatement();

// Possible sql query that could crash the server
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

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.