Skip to content
Memory corruption Write-up Advanced

Exploitable Vulnerability in libotr

An integer overflow in libotr's handling of large OTR data messages leads to a heap overflow, allowing a remote attacker to crash or execute arbitrary code.

x41-dsec.de

Published on x41-dsec.de

A remote attacker may crash or execute arbitrary code in libotr by sending large OTR messages. While processing specially crafted messages, attacker controlled data on the heap is written out of bounds.

Markus Vervier, on x41-dsec.de

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 an integer overflow when adding 1 to a 32-bit length value, causing a small buffer allocation followed by a large out-of-bounds copy.

Impact

A remote attacker could crash the application or execute arbitrary code, though the exploit requires sending gigabytes of data and heap grooming.

What the attacker needed

OTR enabled (default in many clients); Ability to send messages to victim; Send over 5.5 GB of data

The fix

The vulnerability was fixed in libotr 4.1.1.

How it was found

  1. Establish an OTR conversation with the victim.
  2. Send a data message with a length field set to 0xFFFFFFFF.
  3. Ensure the message is large enough to pass the length check, using fragmentation if needed.
  4. The library allocates a zero-size buffer and then copies 4 GB of data into it, causing a heap overflow.

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.

libotr is a library for secure messaging. A remote attacker can send a very large message that causes a memory error, potentially letting them run their own code on the victim's computer.

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.

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.