Skip to content

Cleartext HTTP used in Spring RestTemplate

Description

Data transmitted over HTTP is unencrypted, which can lead to man-in-the-middle attacks and exposure of sensitive information. To ensure confidentiality, it is recommended to use HTTPS instead of HTTP.

Examples

Insecure Code

java
RestTemplate restTemplate = new RestTemplate(); restTemplate.getForObject("http://example.com", String.class);

Secure Code

java
RestTemplate restTemplate = new RestTemplate(); restTemplate.getForObject("https://example.com", String.class);

Remediation

Replace HTTP with HTTPS in the RestTemplate URL to ensure encrypted communication.

Rule Details

FieldValue
IDCODE-0461
CategoryCrypto
SeverityMEDIUM
CWECWE-319
ConfidenceMEDIUM
ImpactMEDIUM
LikelihoodMEDIUM
ExploitabilityEASY
TagsRestTemplate, HTTPS
OWASPA3:2017-Sensitive Data Exposure, A02:2021-Cryptographic Failures

References