Your template fills placeholders from a credential, gated by an allowlist. When the allowlist is null the gate is skipped, and a caller-picked pointer can pull the whole object into the output.
What goes wrong
A rendering step takes a template, finds placeholders, and swaps each one for a value pulled from the credential by a pointer. To keep that safe, there is an allowlist of fields a placeholder is allowed to reach. Sensible design.
The allowlist defaults to null. And when it is null, the check that consults it is skipped entirely, so every field is fair game. A caller who controls the placeholder can point at anything, including the empty pointer that selects the whole object, and watch it get serialized straight into the output. The same thing happens when the render definition simply has no allowlist attached.
This is the classic fail-open default. Absent configuration reads as permission rather than denial. The feature works in every test because the tests supply an allowlist. Production supplies attackers who do not.
The pattern
def render(template, credential, allowlist):
for ph in template.placeholders:
if allowlist is not None:
requireAllowed(ph.pointer, allowlist)
value = credential.resolve(ph.pointer) # any field
template.replace(ph, serialize(value))
return templatedef render(template, credential, allowlist):
if not allowlist:
raise Error('no fields permitted for rendering')
for ph in template.placeholders:
requireAllowed(ph.pointer, allowlist) # always
rejectRootPointer(ph.pointer)
value = credential.resolve(ph.pointer)
template.replace(ph, serialize(value))
return templateEvery gate held. The exploit path was reproduced against a negative control, the impact was calibrated, and the finding was signed report-ready.
Why it matters to you
Fail-open defaults show up anywhere a config value can be missing. An empty allowlist should mean nothing is allowed, but too often it means the check gets skipped. The difference is whether a misconfiguration leaks data or just breaks the feature, and breaking the feature is the outcome you want.
Here the leak is the entire credential, handed back through a rendering path nobody thinks of as an API. Any code that resolves a caller-chosen pointer into serialized output deserves the suspicion you give a raw query endpoint.
Check your own code
- Search for allowlist checks guarded by a null or empty test
- Confirm an absent allowlist denies everything, not skips the check
- Reject root or empty selectors that resolve to a whole object
- Treat template and placeholder resolution as an untrusted read