Skip to content
Memory corruption Disclosed report Advanced CVE-2019-9805

Two potential loads from uninitialized memory in Prio serial_read_mp_array and read_packet_client

Two functions in the Prio library declare a msgpack_unpacked structure without initialising it, then jump to a cleanup label that calls msgpack_unpacked_destroy on the uninitialised memory. An attacker could potentially trigger a load from uninitialised memory, though the text does not describe a concrete exploit.

mlfbrown Follow

Originally disclosed on Mozilla

  • Fixed in 24 days
  • Paid in 31 days
  • Disclosed after 24 days
Text
The same potential issue exists in both serial_read_mp_array and read_packet_client:

SECStatus rv = SECSuccess;
P_CHECKCB(upk != NULL); // NOTE: potential problem
... possibly more P_CHECKCB conditions 
msgpack_unpacked res;

The P_CHECKCB macro goes to cleanup, which does this:

cleanup:
  msgpack_unpacked_destroy(&res);

The msgpack_unpacked_destroy function does this with the uninitialized memory:

static inline void msgpack_unpacked_destroy(msgpack_unpacked* result)
{
    if(result->zone != NULL) {
        msgpack_zone_free(result->zone);
        result->zone = NULL;
        memset(&result->data, 0, sizeof(msgpack_object));
    }
}


Functions at:
https://dxr.mozilla.org/mozilla-central/source/third_party/prio/prio/serial.c?q=%2Bfunction%3A%22serial_read_packet_client%28msgpack_unpacker+%2A%2C+PrioPacketClient%2C+const_PrioConfig%29%22&redirect_type=single#117 (serial_read_mp_array)

and

https://dxr.mozilla.org/mozilla-central/source/third_party/prio/prio/serial.c?q=%2Bfunction%3A%22serial_read_packet_client%28msgpack_unpacker+%2A%2C+PrioPacketClient%2C+const_PrioConfig%29%22&redirect_type=single#325 (serial_read_packet_client)

The original report as published on Mozilla's Bugzilla, by mlfbrown. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the msgpack_unpacked structure is not initialised before an early error path jumps to cleanup, which then calls msgpack_unpacked_destroy on uninitialised memory.

Impact

The text only states a potential problem; it does not show that the uninitialised load can be turned into a crash or code execution.

What the attacker needed

None

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When a program reserves space for a variable but does not put a value in it, that space holds leftover data from earlier use. Here, a cleanup routine reads that leftover data as if it were a valid pointer and may try to free it. This is a bug because the program is acting on garbage values.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

More by mlfbrown

View all

1 more disclosed report, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.