Skip to content

fix(security): resolve @FILE and @INCLUDE paths before trusting them - #2446

Open
elcreator wants to merge 1 commit into
evolution-cms:3.5.xfrom
elcreator:fix-harden-file-inclusion
Open

fix(security): resolve @FILE and @INCLUDE paths before trusting them#2446
elcreator wants to merge 1 commit into
evolution-cms:3.5.xfrom
elcreator:fix-harden-file-inclusion

Conversation

@elcreator

Copy link
Copy Markdown

Four bindings turned a string into a path and only one of them checked the resolved path. atBindInclude() compared the string as typed against EVO_MANAGER_PATH, which a .. segment walked straight past - and it includes the file rather than reading it. The custom_widget output format and the custom_tv form element, both duplicated in functions/tv.php and functions/actions/mutate_content.php, concatenated EVO_BASE_PATH with the binding and used the result with no check at all; custom_tv: did the same with a name out of the TV's type column.

Containment now lives in one place, Core::atBindFilePath(), built on the resolver @file was hardened with in 3.5.8. Search paths and legitimate syntax are unchanged, including a traversal that normalises back inside the tree.

A refused binding no longer echoes the absolute path it tried, and a TV with no output option no longer reads a missing array key.

Four bindings turned a string into a path and only one of them checked the
resolved path. atBindInclude() compared the string as typed against
EVO_MANAGER_PATH, which a `..` segment walked straight past - and it includes
the file rather than reading it. The custom_widget output format and the
custom_tv form element, both duplicated in functions/tv.php and
functions/actions/mutate_content.php, concatenated EVO_BASE_PATH with the
binding and used the result with no check at all; custom_tv:<widget> did the
same with a name out of the TV's type column.

Containment now lives in one place, Core::atBindFilePath(), built on the
resolver @file was hardened with in 3.5.8. Search paths and legitimate syntax
are unchanged, including a traversal that normalises back inside the tree.

A refused binding no longer echoes the absolute path it tried, and a TV with no
output option no longer reads a missing array key.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P9k7KBwVFZ6PSWH27ePZuJ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant