Summary
Netatalk can misinterpret a DSI header field as a payload offset for command types where that interpretation does not apply. An unauthenticated client may leave attacker-controlled bytes to be read as the next header, potentially disrupting protocol state or causing denial of service.
Affected context
The issue occurs in Netatalk's DSI stream handling when processing command packets. It affects implementations that interpret the dsi_code/dsi_doff union field as a data offset for command types other than DSIWrite; a nonzero value smaller than the packet's declared payload length can leave residual bytes in the readahead buffer.
Exploit preconditions
- Attack surface: The DSI network protocol exposed by a Netatalk file server
- Required access: No authentication is required
- Trigger point: Processing a non-WRITE
DSIFUNC_CMDpacket - Why exploitation is possible: A nonzero
dsi_codesmaller thandsi_lencan cause the receiver to consume only part of the payload, leaving attacker-controlled bytes to be interpreted as the next DSI header
Why this happens
The stream parser applies a union field's data-offset meaning without first restricting that interpretation to the DSI command type that defines it. This inconsistent handling of protocol fields and message boundaries maps to CWE-444: Inconsistent Interpretation of HTTP Requests (also applicable to inconsistent interpretation of other protocol messages). Residual payload bytes can then be parsed as a separate header.
Potential impact
- A client may be able to desynchronize the DSI protocol stream
- Sessions could close or protocol state could become corrupted
- Repeated or crafted input could trigger an infinite-read denial of service
General mitigation guidance
Defensive approaches focus on enforcing protocol semantics and message boundaries:
- Interpret command-specific fields only for the command types that define them
- Validate payload lengths and offsets against the complete frame before consuming data
- Reject malformed or inconsistent packets rather than carrying residual bytes into subsequent parsing
- Use a strict, stateful protocol parser with explicit framing rules
- Apply resource limits and isolate the file server process with least privilege
How teams detect issues like this
- Review parser code for union fields or header values interpreted without checking the message type
- Use static analysis and code review checks for unchecked length, offset, and buffer-consumption logic
- Test protocol parsers with malformed frames, boundary values, and cases where declared lengths differ from consumed lengths
- Monitor for repeated malformed DSI packets, unexpected session closures, or stalled reads
- Enforce protocol validation policies at network boundaries where feasible

