Skip to content

Security: Log injection via unsanitized username/lineId in WHIP/WHEP log output #287

Description

@LucasMaupin

Summary

The username, lineId, and productionId path parameters in POST /api/v1/whip/:productionId/:lineId/:username (and the WHEP equivalent) are URL-decoded by Fastify and interpolated directly into log messages without sanitization.

Location

  • src/api_whip.ts lines ~131, ~210
  • WHEP equivalent routes

Details

The TypeBox schema only enforces maxLength: 200 with no pattern constraint on username. An attacker can send a username containing newline characters (%0a), carriage returns (%0d), or ANSI escape codes (%1b[31m), which allows forging fake log entries or corrupting log files.

Example attack:

POST /api/v1/whip/1/line1/admin%0aFAKE%20INFO%20message%20injected

The lineId and productionId parameters in WHIP/WHEP routes also lack the numeric-only pattern constraint that other production routes enforce.

Recommendation

Add a restrictive pattern to the username, lineId, and productionId schema entries in WHIP/WHEP routes:

username: Type.String({ maxLength: 200, pattern: '^[\\w\\s.-]{1,200}$' })

Alternatively, sanitize log output by stripping or encoding control characters before logging user-supplied values.

Severity

MEDIUM

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

securitySecurity vulnerability or hardening

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions