GHSL-2025-058: Denial of Service (DoS) because of memory corruption in 7-Zip - CVE-2025-53816
A miscalculation in the RAR5 decoder's error recovery causes zeroes to be written past the allocated heap buffer. An attacker can control the number of bytes overwritten via the size of a previous archive item, leading to memory corruption and denial of service.
Zeroes written outside heap buffer in RAR5 handler may lead to memory corruption and denial of service.
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 report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the recovery code calculates the remaining bytes to zero using an end position that depends on the attacker-controlled size of a previous item, without checking that the write stays within the allocated window.
Impact
The attacker may control how many bytes are overwritten with zeroes, which could lead to denial of service due to memory corruption; arbitrary code execution is unlikely.
What the attacker needed
Victim opens a crafted RAR5 archive
The fix
The issue was fixed in version 25.00.
How it was found
- Compile 7-Zip with AddressSanitizer.
- Create a malicious RAR5 archive that triggers the recovery path.
- Extract the archive using the 7zz command with the -so option.
- Observe the heap buffer overflow reported by AddressSanitizer.
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 7-Zip opens a RAR5 archive, it sometimes tries to recover from corrupted data by filling a memory area with zeroes. A calculation mistake means it can write too many zeroes, going past the end of the memory it reserved. This can crash the program, and the attacker controls how far past the end it writes.
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.