Possible HTTP Parameter Pollution detected

Overview

  • Rule ID: java_lang_http_parameter_pollution

  • Applicable Languages: Java

  • Weakness ID: CWE-88

Description

Constructing a URL with unsanitized user input can result in HTTP Parameter Pollution (HPP) attacks. In these attacks, an attacker can manipulate the URL or request parameters to modify requests or access concealed information.

Remediation Guidelines

  • Avoid using direct or unsanitized user input when constructing URLs or URL parameters.

  • Use alternative and secure methods to incorporate user input into URLs. For example, a lookup table:

    HashMap<String, String> lookupTable = new HashMap<>();
    // ... populate hash map
    String rawUserInput = request.getParameter("someParam");
    String value = lookupTable.getOrDefault(rawUserInput, "someDefault");
    HttpGet httpget = new HttpGet("https://example.com/?param=" + value);
  • Always sanitize user input before using it in your URLs to ensure that any harmful characters or attempts to manipulate the URL are neutralized.

References

Configuration

To omit this rule during a scan, and to provide you with continuous 24/7 code-level scanning, you can employ our SAST TOOL

Last updated