(CVE-2025-71031) Denial of Service in Melon C library
Summary
The 'Melon HTTP' component doesn't have any maximum length. As a result, an excessive request header could cause a denial of service by consuming RAM memory.
Details
Vulnerable component: Melon HTTP - https://github.com/Water-Melon/Melon/blob/master/src/mln_http.c
Version: commit 9df9292 and below
Melon HTTP source code
The web server checks buffers until it finds \n (new line). If the condition is not satisfy it returns the M_HTTP_RET_OK response. if not, it returns M_HTTP_RET_DONE.
M_HTTP_RET_OK means parsing is not completed but no error occurs, continue to pass in new data to complete the parsing.
M_HTTP_RET_DONE means parsing completed.
MLN_FUNC(static inline, int, mln_http_line_length, \
(mln_http_t *http, mln_chain_t *in, mln_size_t *len), \
(http, in, len), \
{
mln_buf_t *b;
mln_u8ptr_t p, end;
mln_size_t length = 0;
while (in != NULL) {
b = in->buf;
if (b == NULL || b->in_file || mln_buf_left_size(b) <= 0) {
in = in->next;
continue;
}
for (p = b->left_pos, end = b->last; p < end; ++p) {
if (*p == (mln_u8_t)'\n') break;
++length;
}
if (p >= end) {
in = in->next;
continue;
}
break;
}
if (in == NULL) return M_HTTP_RET_OK;
*len = length;
return M_HTTP_RET_DONE;
})Steps to reproduce
Compile the Melon library using your prefer method. More methods can be found - https://github.com/Water-Melon/Melon
Melon HTTP source code example - https://github.com/Water-Melon/Melon/blob/master/docs/book/en/http.md
Compile the Melon HTTP source code to an executable.
Initiate the web server
Run this exploit. Adjust the payload as you see fit.
Observe CPU and RAM consumption spike
Proof of Concept
Last updated