Skip to content

CMDB/augments loaders log attacker-influenceable strings unescaped and uncapped #60

Open

Description

@djbclark

Found by an adversarial review of the CMDB branches (#57, #58, #59); nothing here is fixed yet.

CMDB and augments loaders echo attacker-influenceable JSON strings into log lines with %s and no length cap or escaping. Log() formats with StringVFormat, which escapes nothing, and ERR/WARNING lines also reach syslog.

Trigger (host_specific.json, needs CMDB write access): {"vars":{"k":"$(x)\n error: forged line"}} (a JSON \n) prints a second, fake error: line. A value up to the 5 MB HOST_SPECIFIC_DATA_MAX_SIZE is formatted in full.

Existing sites: libpromises/cmdb.c echoes the class value at ERR level on master; #57 adds one more (offending value) and #58 echoes the key at WARNING.

Proposed: one small helper that caps and escapes control characters for logged JSON strings, used by these sites. Separate PR after #57/#58 land on the fork.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions