使用file_get_content是否可以进行注入攻击?

问题描述 投票:0回答:1
class TemplateController
{
    public function get(string $template): string
    {
        return file_get_contents(_DIST . '/resources/templates/' . $template . '.html');
    }
}

我使用$ _GET或地址栏的直接参数从SPA应用程序导入模板。这会引起问题吗?

我在输入中使用引号来运行命令以访问不可访问的文件等。>>

class TemplateController {公共函数get(string $ template):字符串{return file_get_contents(_DIST。'/ resources / templates /'。$ template。'.html'); }}我使用$ _GET或...

php laravel file-get-contents code-injection
1个回答
1
投票

[有人可能会向使用$template../导航到您在参数中设置的目录的/变量中传递值。

© www.soinside.com 2019 - 2024. All rights reserved.