Skip to content
DoS Write-up Intermediate

Fuzzing Golang msgpack for fun and panic

A Go MessagePack library crashed with an index out of range panic when decoding a malformed MessagePack file. An attacker who can supply a crafted MessagePack byte stream could cause a denial of service.

redcanary.com

Published on redcanary.com

Subscribe

The author, on redcanary.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

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

How it worked

Root cause

Likely a missing bounds check when reading an offset from untrusted MessagePack data, leading to an index out of range panic.

Impact

If an adversary can input a MessagePack file or byte stream of their choosing, this panic would likely lead to denial-of-service of the application.

What the attacker needed

Attacker can supply a MessagePack file or byte stream

How it was found

  1. Generate a corpus of valid MessagePack files using the library's Marshal function.
  2. Write a fuzz function that calls Unmarshal on the input and returns 0 on error, 1 on success.
  3. Run go-fuzz-build and go-fuzz to mutate the corpus and look for crashes.
  4. Re-run the crashing file through the unmarshal script to observe the panic.

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 write-up has not been written yet. The Original tab links to the source.

MessagePack is a compact binary format like JSON. The library that reads it did not check that a number inside the data pointed to a valid position, so a malformed file made the program crash. If an attacker can send such a file, they can stop the service from working.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.