
The test checks behavior/reaction in Spring Framework with and without the CVE-2024-38828 vulnerability.
In ByteArrayHttpMessageConverter, memory is allocated in ByteArrayOutputStream based on the Content-Length request header,
which may not match reality if the body is 0 bytes. With a sharp increase in such requests (DoS), memory is used
suboptimally, regular GC cleanups occur, and the application starts lagging. I will show how to implement/fix this and the metrics.

CVE-2024-38828 is a Denial of Service (DoS) vulnerability in Spring Framework that allows an attacker to cause memory exhaustion on the server via a Spring MVC controller with a byte[] parameter.
HttpMessageConverter for handling byte arrays.
├── src/
│ └── main/
│ └── java/
│ └── me/
│ └── func/
│ └── demo/
│ ├── config/
│ │ └── WebConfig.java
│ ├── converter/
│ │ └── SafeByteArrayHttpMessageConverter.java
│ ├── controller/
│ │ └── DemoController.java
│ └── DemoApplication.java
├── tests/
│ ├── load_test.py
│ └── results/
│ ├── результаты_теста.png
│ └── метрики.json
└── README.md
def send_request(url):
try:
response = requests.post(
url,
data=b'0', # Minimal payload
headers={
'Content-Type': 'application/octet-stream',
'Content-Length': str(2**31 - 1) # Maximum size
}
)
return response.status_code, response.text
except Exception as e:
return f"Error: {str(e)}", None
pip install -r requirements.txt
python tests/load_test.py