burst(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.carrow-up-right

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_OKarrow-up-right means parsing is not completed but no error occurs, continue to pass in new data to complete the parsing.

M_HTTP_RET_DONEarrow-up-right 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

  1. Compile the Melon library using your prefer method. More methods can be found - https://github.com/Water-Melon/Melonarrow-up-right

  2. Compile the Melon HTTP source code to an executable.

  3. Initiate the web server

  4. Run this exploit. Adjust the payload as you see fit.

  1. Observe CPU and RAM consumption spike

Proof of Concept

Last updated