Skip to content

Fix Prototype Pollution Vulnerability in Template Engine #24

@ragsav

Description

@ragsav

Description:
The custom template engine resolves nested object paths using double-mustache syntax (e.g., {{step.data.user}}). The logic used to parse, split, and deeply merge or resolve these paths does not sanitize reserved object keys. If a user inputs a payload containing proto, constructor, or prototype, the resolver may modify the base Object.prototype globally across the Node.js process.

Impact:
Application-wide Denial of Service, logic bypasses, or potential privilege escalation if authentication checks rely on undefined object properties.

Affected Components:

apps/backend/utils/templateEngine/resolver.js

apps/backend/utils/templateEngine/tokenizer.js

apps/backend/utils/templateEngine/parsers.js

Suggested Remediation:

Implement strict key validation in the path resolution logic.

Explicitly drop or throw an error if a path segment contains proto, constructor, or prototype.

Use Object.create(null) for internal dictionaries where possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions