Categories
CVE-2026-107377 high CVSS 7.5

Path Traversal in datamodel-code-generator (CVE-2026-107377)

Summary

Path traversal in datamodel-code-generator (CVE-2026-107377). Data can be tampered with by attackers. Exploitable via __weak_imports__. Mitigation: upgrade to 0.81.0 or later.

Original description

The description as published by the source.

Summary

When processing an attacker-controlled Protobuf schema, vulnerable versions of
datamodel-code-generator could write a generated weak-import stub outside the
intended __weak_imports__ temporary directory. Absolute import paths and relative
paths containing .. could escape this directory.

An attacker could create directories and new files at locations writable by the
process. Relative path traversal could also overwrite existing writable files
because the existence check and the stub write used different base directories.
An existing absolute target was skipped by the existence check.

Written content was limited to a generated Protobuf syntax declaration,
syntax = "proto2"; or syntax = "proto3";, followed by a newline. This issue did
not provide fully attacker-controlled file contents, and direct arbitrary code
execution has not been demonstrated.

These filesystem side effects occurred before protoc ran. A subsequent
compilation error did not undo them. A user or CI job must process the
attacker-controlled schema for the issue to be triggered, whether the schema is
supplied as a local file or fetched via --url.

The fix has been merged into the parent repository's main branch in
5e94b8f. A patched package release is not yet available.
The technical details and PoC below describe the vulnerable implementation before
that fix.

##…

Source: GitHub Security Advisories (Global) NVD GitHub Advisory

Auto-generated summary

Assembled by SecPulse from the source data (CVSS, CWE, affected versions) using templates — no AI involved. Check the original description and references below for exact details.

A vulnerability tracked as CVE-2026-107377 has been found in datamodel-code-generator.
Attackers can target a specific entry point like __weak_imports__ over the network to misuse the product.
Data can be tampered with by attackers. CVSS score: 7.5/10.
What to do: upgrade datamodel-code-generator to 0.81.0 or later.
If unsure, ask your IT team or search "datamodel-code-generator CVE-2026-107377" on the vendor's site.

CVE-2026-107377 (datamodel-code-generator) — CWE-22 / CVSS v3 7.5
Attack vector: remote (network-reachable) / unauthenticated / no user interaction
Attack surface: __weak_imports__ / protoc / main / WEAK_IMPORT_PATTERN
Patched: 0.81.0 — apply immediately
Plan: 1) Audit SBOM/dependencies, 2) Stage→prod upgrade, 3) Add WAF/proxy monitoring on affected endpoints, 4) Hunt IOCs in logs.
Refs: see the GHSA / vendor advisory / patched release linked on this page.

❓ What is the problem

Path traversal (CWE-22) exists in datamodel-code-generator. Attackers reach the vulnerable code path via __weak_imports__ without authentication.

📍 Affected scope

Check the vendor advisory for the affected versions of datamodel-code-generator. Attack surface: __weak_imports__ / protoc / main / WEAK_IMPORT_PATTERN.

🔥 Severity

Severity: High (CVSS 7.5/10). Data can be tampered with by attackers.

🔧 How to fix

Update to 0.81.0.

🛡️ Workaround

Until the patch is applied: disable the affected feature, apply WAF rules, or restrict access via network ACLs.

🔍 Detection

Search webserver/proxy logs for unusual request patterns matching this CVE's known IOCs. Run grep -r 'datamodel-code-generator' . against your dependency files (package-lock.json, requirements.txt, go.sum) to find affected services.

Response actions

Concrete steps and command examples for SOC/SRE teams to execute in order

  1. 1
    Identify exposure identify
    grep -r 'datamodel-code-generator' . | grep -v node_modules

    リポジトリと本番環境の依存ファイル (package-lock.json / requirements.txt / go.sum / Gemfile.lock 等) で datamodel-code-generator を grep し、稼働しているサービス・バージョンを把握する。

  2. 2
    Apply patch patch
    Upgrade datamodel-code-generator to 0.81.0

    ステージング環境で 0.81.0 に上げて回帰テスト → 本番反映。回帰テストはアプリの主要ハッピーパスを含めること。

  3. 3
    Post-deployment verification verify
    Confirm patched version is live in production

    パッチ適用後、ステージングで PoC または同等の悪用パターンを再現して脆弱性が閉じたことを確認。本番ではアクセスログ・WAF でアラート再発が無いか継続監視。

Affected packages

pip datamodel-code-generator
[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"0.81.0"}]}]

References

We use cookies for analytics and ad measurement. This setting applies to all Game co., Ltd. sites. Details