#file_value_callbacks bypass the TrustedCallbackInterface protections

Created on 11 June 2021, about 4 years ago
Updated 19 June 2025, about 1 month ago

Problem/Motivation

In #2966327: Limit what can be called by a callback in render arrays to reduce the risk of RCE β†’ we added TrustedCallbackInterface to protect against arbitrary user-supplied callbacks
However ManagedFile element has #file_value_callbacks which can execute arbitrary functions

Steps to reproduce

Alter a managed file element add a #file_value_callbacks property e.g

$form['some_field']['widget'][0]['value']['#file_value_callbacks'] = ['die'];

Proposed resolution

Use the same trusted callback interface (\Drupal\Core\Render\Renderer::doCallback) that is used elsewhere.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component

file system

Created by

πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

Live updates comments and jobs are added and updated live.
  • Security improvements

    It makes Drupal less vulnerable to abuse or misuse. Note, this is the preferred tag, though the Security tag has a large body of issues tagged to it. Do NOT publicly disclose security vulnerabilities; contact the security team instead. Anyone (whether security team or not) can apply this tag to security improvements that do not directly present a vulnerability e.g. hardening an API to add filtering to reduce a common mistake in contributed modules.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024