Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
📦
📦 npm🐍 PyPI
Not in CISA KEV
MEDIUM severity

GHSA-7fqq-q52p-2jjg opencc

MEDIUMFix: BYVoid/OpenCC#1005

GHSA-7fqq-q52p-2jjg is a medium-severity (CVSS 6.5) remote code execution vulnerability in opencc. A fix is available for opencc — see the affected versions and patch details below.

OpenCC has an Out-of-bounds read when processing truncated UTF-8 input

Published
Mar 29, 2026
Updated
Mar 29, 2026
Affected
2 pkgs
Patched
2 / 2
Exploits
None indexed
Exploitation data as of Mar 29, 2026 · OSV.dev, FIRST.org (EPSS)

Real-World Exposure

2 pkgs affected

How broadly this vulnerability is actually deployed: weekly install volume shows current usage, and reverse-dependency count shows how many other packages break if it stays unpatched.

25other npm packages depend on this — each one inherits the vulnerability until it's patched upstream
openccnpm
2Kdownloads / week

Description

Summary

OpenCC versions before 1.2.0 contain two CWE-125: Out-of-bounds Read issues caused by length validation failures in UTF-8 processing. When handling malformed or truncated UTF-8 input, OpenCC trusted derived length values without enforcing the invariant that processed length must not exceed the remaining input buffer. This could result in out-of-bounds reads during segmentation or conversion.

Details

Two independent code paths in OpenCC failed to enforce the invariant:

matchedLength <= remainingLength

Both paths assumed derived length values were valid and within input bounds, but did not validate that assumption against the remaining buffer. This created the following failure chain:

invalid UTF-8 -> incorrect derived length -> incorrect pointer advance -> remaining-length desynchronization -> out-of-bounds read

In MaxMatchSegmentation::Segment, this could desynchronize remaining-length tracking and cause out-of-bounds reads during prefix matching.

In Conversion::Convert(const char*), similar logic could advance processing past the end of the input string and read beyond the null terminator into adjacent memory. In some cases, unintended heap bytes could be propagated into the conversion result.

PR #1005 fixes both issues by explicitly tracking input boundaries, recomputing remaining length on each iteration, and clamping processed lengths so the buffer-bound invariant is preserved.

Affected versions:

  • All versions before 1.2.0

Patched version:

  • 1.2.0

PoC

Build a vulnerable version with AddressSanitizer enabled and process input ending with a truncated UTF-8 sequence, such as a missing final byte of a 3-byte character. The original report and ASan reproduction are available in Issue #997.

Impact

This vulnerability may cause process crashes and limited, non-deterministic information disclosure when OpenCC processes malformed or attacker-controlled UTF-8 input. The issue does not indicate arbitrary write or code execution.

OpenCC is distributed through system and language-specific package managers, prebuilt binaries, container images, and downstream software, so affected versions may be present even when it is not listed as a direct dependency. Users should upgrade all installed or bundled copies of OpenCC to 1.2.0 or later.

Credit

OpenCC thanks @oneafter for reporting the issue.

Affected Packages

2 total 2 fixed
EcosystemPackageVulnerable rangeFix
📦npmopenccall versions1.2.0npm install opencc@1.2.0
🐍PyPIopenccall versions1.2.0pip install --upgrade 'opencc==1.2.0'

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for opencc, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update opencc to 1.2.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-7fqq-q52p-2jjg is resolved across your whole dependency graph.

  3. Workarounds

    If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.

  4. How O3 protects you

    O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like GHSA-7fqq-q52p-2jjg can be triaged on real exposure rather than presence alone.

Tailored to GHSA-7fqq-q52p-2jjg. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.

Frequently Asked Questions

### Summary OpenCC versions before 1.2.0 contain two `CWE-125: Out-of-bounds Read` issues caused by length validation failures in UTF-8 processing. When handling malformed or truncated UTF-8 input, OpenCC trusted derived length values without enforcing the invariant that processed length must not exceed the remaining input buffer. This could result in out-of-bounds reads during segmentation or conversion. ### Details Two independent code paths in OpenCC failed to enforce the invariant: `matchedLength <= remainingLength` Both paths assumed derived length values were valid and within input
O3 Security · Impact-Aware SCA

Is GHSA-7fqq-q52p-2jjg in your dependencies?

O3 Security finds GHSA-7fqq-q52p-2jjg across npm, PyPI dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.

GHSA-7fqq-q52p-2jjg: opencc (Medium 6.5) | O3 Security