An attacker who controls part of a file path can make it point outside the folder your app meant to allow, so your app reads or writes a file somewhere else on the server.

How it works

Symfony's Path class treated any text before :// as the root of a path, and didn't resolve the .. segments inside that prefix. PHP only sees a scheme at the very start of a string, so it opened a different file than the one Path approved. Apps that check a user-supplied path with Path::isBasePath() or Path::canonicalize() before opening it can be sent outside the allowed folder.

The Symfony advisory also names AssetMapper on 6.4 and later. A malicious or compromised package can make importmap:require or importmap:install write a file of its choice outside assets/vendor.

The fix only treats a prefix as a scheme when PHP would. Real stream wrappers such as phar:// and file:// keep working.

Reported and fixed by Nicolas Grekas.