/

CVE-2026-33250

Severity:

HIGH RISK

(7.5)

Memory Corruption / Buffer Overflow in Freeciv21 Network

CVE-2026-33250

Deferred

Vulnerability type

Category:

Memory Corruption / Buffer Overflow

CWE:

CWE-20, CWE-121

Impact:

Denial of Service via Remote Crash

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Freeciv21 versions prior to 3.1.1 contain a stack-based buffer overflow in the network packet handling logic that can be triggered by specially crafted packets.

An unauthenticated remote attacker can exploit this flaw to crash a public server, while a malicious server can crash the game client of connecting players under typical multiplayer conditions.

Affected context

The vulnerability exists in Freeciv21's networked multiplayer mode, specifically in code that parses incoming game protocol packets.

It becomes relevant when:

  • A client connects to an untrusted or malicious server; or
  • A public or internet-exposed server accepts connections from untrusted clients.

Local single-player games, where connections are restricted to the current user, are generally not exposed to untrusted network traffic and are therefore not impacted in typical configurations.

Exploit preconditions

  • Attack surface (server-side):
  • Freeciv21 server listening on a reachable network interface (e.g., public or LAN).
  • Attacker can open a network connection and send crafted packets.
  • Attack surface (client-side):
  • Player's game client connects to an untrusted or compromised Freeciv21 server.
  • Required access:
  • No authentication required; the vulnerability is reachable during early packet processing.
  • Trigger point:
  • Parsing and handling of specially crafted game protocol packets that exceed expected bounds or violate assumptions.
  • Why exploitation is possible:
  • Insufficient validation of incoming packet data (CWE-20) allows data to be copied or written into a fixed-size stack buffer without proper bounds checks (CWE-121), causing a stack overflow and process crash.

Why this happens

The core issue is a classic stack-based buffer overflow in the network packet handling logic.

Incoming packets are treated as trustworthy in terms of length and structure, and their contents are written into fixed-size stack-allocated buffers without strict size validation.

This combination of insufficient input validation (CWE-20) and unsafe copying into stack buffers (CWE-121) allows oversized or malformed packets to overwrite adjacent stack memory.

While the observed impact is a crash (denial of service), this pattern is a well-known memory corruption bug class that should be treated as high risk in network-exposed components.

Potential impact

  • Remote crash of a public Freeciv21 server, disrupting all connected players.
  • Crash of the game client when connecting to a malicious or compromised server.
  • Repeated denial of service against community or tournament servers by unauthenticated attackers.
  • Loss of in-progress game state if the server or client is not regularly saving.

General mitigation guidance

Effective mitigation focuses on strengthening input handling and limiting the damage from malformed network data:

  • Validate all incoming packet lengths and fields against protocol specifications before copying them into buffers.
  • Replace raw stack-allocated buffers and unsafe copy operations with safer abstractions that enforce bounds checks.
  • Apply strict limits on maximum packet sizes and reject packets that exceed those limits early in the parsing pipeline.
  • Separate parsing and validation from processing: only operate on data that has passed structural and size checks.
  • Run servers with least-privilege OS accounts and apply network-level controls (e.g., firewalls, allowlists) so only trusted clients can connect where feasible.
  • Improve logging around packet parsing failures to aid in identifying malformed traffic, while avoiding logging raw untrusted data blindly.

How teams detect issues like this

Detection generally involves code-centric and operational approaches:

  • Static analysis: Configure tools to flag:
  • Uses of unsafe copy functions into fixed-size stack buffers.
  • Packet parsing routines that rely on client-supplied length fields without explicit bounds checks.
  • Code review: Pay special attention to:
  • Network protocol parsers and serialization/deserialization logic.
  • Functions that handle variable-length fields, strings, or arrays originating from the network.
  • Fuzzing and testing:
  • Apply network protocol fuzzers against the server and client to discover additional malformed-packet edge cases.
  • Integrate fuzzing into the CI pipeline to continuously test packet handling robustness.
  • Runtime monitoring:
  • Monitor for repeated crashes or abnormal exits of game servers associated with inbound connection patterns.
  • Correlate crash dumps with packet parsing code paths to verify and prioritize fixes.

Sources

SourceLink
github.comgithub.com/longturn/freeciv21/commit/ad8e18ca22595529599782b2984bf44df8d69ed6
github.comgithub.com/longturn/freeciv21/releases/tag/v3.1.1
github.comgithub.com/longturn/freeciv21/security/advisories/GHSA-f76g-6w3f-f6r3
redmine.freeciv.orgredmine.freeciv.org/issues/1955

Frequently asked

questions

Yes. Any Freeciv21 server that is reachable over the network and accepts connections from untrusted clients can be remotely crashed by sending specially crafted packets. Similarly, a client that connects to a malicious or compromised server can be crashed by hostile responses.

No. The vulnerability is reachable without authentication during early connection or packet processing. An attacker does not need to join a game legitimately to trigger the crash.

The safest pattern is to introduce rigorous input validation and safe memory handling: enforce strict bounds on all packet fields, avoid writing unvalidated data into stack buffers, and use safer buffer-management APIs that make overflows difficult or impossible by design.

Treat all network data as untrusted, design protocol parsers with explicit length and structure checks, prefer high-level parsing abstractions over manual buffer management, and routinely apply fuzzing and static analysis to packet-handling code before release. Integrating these practices into the development lifecycle greatly reduces the chance of recurring buffer overflow vulnerabilities.

Find out what's already
exploitable in your codebase.