Yii:$app->request->get() - Returns GET parameter with a given name. If name isn't specified, returns an array of all GET parameters.
www.yiiframework.com/doc-2.0/yii-web-request.html#...
Соответственно, можно написать фильтр, который будет отслеживать все левые параметры и выдавать 404 ошибку.