Skip to content

Junrar: RarVM VM_JMP maxOpCount bypass causes infinite CPU loop during RAR4 extraction

High severity GitHub Reviewed Published Jul 21, 2026 in junrar/junrar • Updated Oct 15, 2026

Package

maven com.github.junrar:junrar (Maven)

Affected versions

<= 7.6.0

Patched versions

7.6.1

Description

Summary

Junrar's RAR virtual machine can be forced into a deterministic infinite loop while extracting a crafted RAR4 archive. The RarVM.ExecuteCode loop is intended to be bounded by maxOpCount, but jump instructions can bypass this limit when setIP() is called with a target instruction pointer greater than or equal to codeSize.

An unauthenticated attacker who can provide a RAR archive to an application using Junrar.extract() can cause the extraction thread to spin forever, consuming CPU and blocking the process. The issue is a denial of service vulnerability, not remote code execution.

Details

The root cause is in src/main/java/com/github/junrar/unpack/vm/RarVM.java.

setIP() returns early when the target IP is outside the prepared VM program:

private boolean setIP(int ip) {
    if ((ip) >= codeSize) {
        return (true);
    }

    if (--maxOpCount <= 0) {
        return (false);
    }

    IP = ip;
    return true;
}

When ip >= codeSize, this branch:

  • does not update IP;
  • does not decrement maxOpCount;
  • returns true, so callers treat it as success.

The VM_JMP handler and the other jump-like handlers discard the return value of setIP() and immediately continue the main VM loop:

case VM_JMP:
    setIP(getValue(false, mem, op1));
    continue;

Because of the continue, execution also skips the loop-end accounting:

IP++;
--maxOpCount;

As a result, a VM program containing a single VM_JMP instruction can freeze both IP and maxOpCount:

  1. IP points to the VM_JMP instruction.
  2. The jump target resolves to codeSize or larger.
  3. setIP() returns before modifying IP or decrementing maxOpCount.
  4. The caller ignores the return value and continues.
  5. The same VM_JMP instruction is executed again forever.

Impact

This is a CPU denial of service vulnerability. Any application that uses junrar to extract untrusted RAR archives can have an extraction worker thread permanently blocked by a small crafted archive. In services that process uploads or attachments automatically, repeated submissions can exhaust worker capacity and degrade or stop archive-processing functionality.

The RAR VM does not provide native code execution, reflection, or process execution primitives, and Java array bounds checks prevent escaping the VM memory array. The expected security impact is availability only.

References

@gotson gotson published to junrar/junrar Jul 21, 2026
Published to the GitHub Advisory Database Oct 15, 2026
Reviewed Oct 15, 2026
Last updated Oct 15, 2026

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

EPSS score

Exploit Prediction Scoring System (EPSS)

This score estimates the probability of this vulnerability being exploited within the next 30 days. Data provided by FIRST.
(33rd percentile)

Weaknesses

Loop with Unreachable Exit Condition ('Infinite Loop')

The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop. Learn more on MITRE.

CVE ID

CVE-2026-97370

GHSA ID

GHSA-h9h9-2rmf-rvhp

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.