We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.任意文件删除 代码 app\modules\polygon\controllers\ProblemController 89行到113行
public function actionDeletefile($id, $name) { $model = $this->findModel($id); if ($name == 'in') { $files = $model->getDataFiles(); foreach ($files as $file) { if (strpos($file['name'], '.in')) { @unlink(Yii::$app->params['judgeProblemDataPath'] . $model->id . '/' . $file['name']); } } } else if ($name == 'out') { $files = $model->getDataFiles(); foreach ($files as $file) { if (strpos($file['name'], '.out')) { @unlink(Yii::$app->params['judgeProblemDataPath'] . $model->id . '/' . $file['name']); } if (strpos($file['name'], '.ans')) { @unlink(Yii::$app->params['judgeProblemDataPath'] . $model->id . '/' . $file['name']); } } } else { @unlink(Yii::$app->params['judgeProblemDataPath'] . $model->id . '/' . $name); } return $this->redirect(['test-data', 'id' => $model->id]); }
unlink的时候没有对传入的文件做校验,可以导致任意文件删除,请求url http://127.0.0.1/jnoj/web/polygon/problem/deletefile?id=1&name=../../../../jnoj/composer.lock
2.任意文件读取
代码 app\modules\polygon\controllers\ProblemController 115行到121行
public function actionViewfile($id, $name) { $model = $this->findModel($id); echo '<pre>'; echo file_get_contents(Yii::$app->params['judgeProblemDataPath'] . $model->id . '/' . $name); echo '</pre>'; }
请求url http://127.0.0.1/jnoj/web/polygon/problem/viewfile?id=1&name=../../../../../../../etc/passwd
修复建议:对传入的文件名称做校验.
The text was updated successfully, but these errors were encountered:
97a2071
ok,感谢反馈
Sorry, something went wrong.
Fixes shi-yang#53: 修复一些漏洞
e866223
3f3d0f5
Former-commit-id: bfcd740fb538730c51952d02993b5439c1f0bae5
No branches or pull requests
1.任意文件删除
代码 app\modules\polygon\controllers\ProblemController 89行到113行
unlink的时候没有对传入的文件做校验,可以导致任意文件删除,请求url
http://127.0.0.1/jnoj/web/polygon/problem/deletefile?id=1&name=../../../../jnoj/composer.lock
2.任意文件读取
代码 app\modules\polygon\controllers\ProblemController 115行到121行
请求url
http://127.0.0.1/jnoj/web/polygon/problem/viewfile?id=1&name=../../../../../../../etc/passwd
修复建议:对传入的文件名称做校验.
The text was updated successfully, but these errors were encountered: