Summary
A log injection and framing weakness in LogTape's syslog package allows attacker-controlled structured data to introduce control characters or invalid property names into formatted syslog messages. When applications forward untrusted values or keys with structured data enabled, an attacker may forge records that appear to originate from arbitrary hosts, applications, processes, facilities, or severity levels.
Affected context
The issue may affect applications using the @logtape/syslog package to transmit structured syslog messages over RFC 6587 non-transparent TCP framing. Risk is highest when untrusted users or external systems can influence structured data values or property keys and the resulting messages are consumed by collectors, monitoring platforms, or SIEM systems.
Exploit preconditions
- Attack surface: Applications that emit structured syslog messages through the affected package
- Required access: Ability to influence a logged property value or property key
- Trigger point: Structured-data formatting before transmission over a non-transparent TCP syslog stream
- Why exploitation is possible: Control characters, including newline characters, are not fully neutralized in values, while property keys are not validated against the RFC 5424 SD-NAME grammar
Why this happens
The vulnerability results from insufficient neutralization and validation during syslog message construction. The formatter permits C0 control characters in structured data values and inserts property keys without enforcing the allowed SD-NAME grammar. A newline can terminate a non-transparent RFC 6587 frame, while forbidden key characters can alter structured-data boundaries or corrupt the record. This behavior maps primarily to CWE-93: Improper Neutralization of CRLF Sequences ('CRLF Injection'), with a related CWE-117: Improper Output Neutralization for Logs condition.
Potential impact
- Attackers may forge syslog records that appear to come from trusted sources
- Downstream collectors may interpret attacker-controlled bytes as separate RFC 5424 messages
- SIEM searches, alerts, dashboards, and audit trails could contain misleading data
- Facilities, severity levels, process identifiers, hosts, or applications may be falsified
- Incident response and compliance investigations could be impaired
General mitigation guidance
Mitigation generally focuses on enforcing protocol-safe output boundaries and reducing trust in logged data.
Common defensive patterns include:
- Normalize or reject control characters in structured data values before formatting
- Validate property keys against the RFC 5424 SD-NAME grammar
- Use protocol-aware encoders that guarantee one valid record per transmitted frame
- Treat user-controlled values and keys as untrusted at every logging boundary
- Apply structured logging policies that restrict dynamic field names
- Preserve least-privilege access for logging services and downstream collectors
- Add integrity checks or trusted transport controls where audit records require stronger assurance
How teams detect issues like this
Organizations can identify this class of issue through:
- Static analysis rules that flag direct interpolation of untrusted data into syslog formats
- Code review checks for missing control-character escaping and SD-NAME validation
- Tests containing newline, carriage-return, bracket, quotation-mark, and backslash characters
- Protocol conformance tests verifying that each transmitted frame produces exactly one record
- SIEM or collector policies detecting unexpected source identities, malformed structured data, or abrupt record-boundary changes
- Automated dependency and code review tools that identify unsafe logging formatter patterns

