Skip to main content
Vulnerability Database/CVE-2026-112021

CVE-2026-112021: snac2 Buffer Overflow Vulnerability

CVE-2026-112021 is a heap-based buffer overflow flaw in snac2 that enables remote attackers to corrupt heap memory and crash servers. This post explains its technical details, affected versions, impact, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-112021 Overview

CVE-2026-112021 is a heap-based buffer overflow [CWE-122] in the snac2 ActivityPub server affecting versions before 2.93. The flaw resides in the _xs_json_load_lexer() function within the project's JSON parser. Unauthenticated remote attackers can send a single crafted application/activity+json POST request to activitypub_post_handler(), which parses the payload before performing signature checks. JSON strings containing a \\u0000 escape sequence overflow heap allocations, corrupting memory and crashing the server.

Critical Impact

Remote unauthenticated attackers can crash snac2 instances by sending a single malformed JSON payload, causing denial of service for the federated ActivityPub server.

Affected Products

  • snac2 versions prior to 2.93
  • The xs_json.h parser component (_xs_json_load_lexer())
  • activitypub_post_handler() request path for application/activity+json

Discovery Timeline

  • 2026-10-18 - CVE-2026-112021 published to the National Vulnerability Database
  • 2026-10-19 - Last updated in NVD database

Technical Details for CVE-2026-112021

Vulnerability Analysis

The vulnerability resides in _xs_json_load_lexer(), the lexer routine used by the snac2 JSON parser. When processing string tokens, the lexer handles Unicode escape sequences of the form \uXXXX. The handler mismeasures the output buffer required for a \\u0000 escape, writing past the end of a heap allocation.

Because activitypub_post_handler() parses inbound application/activity+json payloads before HTTP signature verification, no authentication is required to reach the vulnerable code path. A single malformed POST request is enough to trigger heap corruption and crash the server process.

The issue is tracked as [CWE-122: Heap-based Buffer Overflow]. Exploitation primarily yields a reliable denial of service against federated instances. The upstream fix landed in commit ec2c5c2046e0381bc942ec5d0d05ec861fe377e7 and shipped in release 2.93.

Root Cause

The lexer's Unicode escape handling in xs_json.h (lines 283-285 in tag 2.92) incorrectly accounts for the byte length required when a \\u0000 escape is decoded, allowing writes beyond the allocated heap buffer. See the upstream source for xs_json.h for the pre-patch logic.

Attack Vector

An attacker sends an unauthenticated HTTP POST to any ActivityPub inbox endpoint handled by activitypub_post_handler() with the application/activity+json content type. Because signature validation occurs after JSON parsing, the malicious payload is processed regardless of origin. The payload contains a JSON string value with an embedded \\u0000 escape that overflows the heap buffer during lexing.

Technical details and proof-of-concept discussion are published in the snac2 JSON vulnerability writeup and the VulnCheck advisory.

Detection Methods for CVE-2026-112021

Indicators of Compromise

  • Unexpected crashes or restarts of the snac2 server process shortly after receiving inbound federation traffic.
  • HTTP POST requests to ActivityPub inbox endpoints with Content-Type: application/activity+json containing \\u0000 escape sequences in string values.
  • Core dumps or segmentation faults originating from the _xs_json_load_lexer symbol.

Detection Strategies

  • Inspect reverse-proxy and web server logs for POST requests to ActivityPub endpoints that correlate with snac2 process termination events.
  • Deploy WAF or request-filtering rules that flag JSON bodies containing literal \\u0000 sequences inside string tokens.
  • Monitor process supervisors (systemd, runit) for abnormal restart frequency of the snac2 binary.

Monitoring Recommendations

  • Enable crash reporting and retain core dumps for post-incident analysis of the snac2 process.
  • Alert on anomalous POST request volume targeting /inbox and user-specific ActivityPub endpoints from unknown remote servers.
  • Track the running snac2 version across hosts and alert when any instance reports a version earlier than 2.93.

How to Mitigate CVE-2026-112021

Immediate Actions Required

  • Upgrade snac2 to version 2.93 or later from the official Codeberg release page.
  • If immediate patching is not possible, restrict inbound ActivityPub traffic to known peers using upstream reverse-proxy allowlists.
  • Review process supervision configuration to ensure automatic restarts, limiting denial-of-service duration.

Patch Information

The fix is included in snac2 2.93, delivered via commit ec2c5c20. The patch corrects buffer sizing within _xs_json_load_lexer() so that \\u0000 Unicode escapes no longer write past the end of the allocated heap region. Administrators should rebuild from source or install updated packages, then restart the snac2 service.

Workarounds

  • Place a reverse proxy such as nginx or Caddy in front of snac2 and drop POST requests whose JSON body contains \\u0000 escape sequences.
  • Temporarily disable federation inbox endpoints if the instance is not required to accept remote ActivityPub traffic.
  • Run snac2 under a process supervisor configured for rapid restart to reduce the window of unavailability following a crash.

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.