Skip to content

Commit 7e16694

Browse files
authored
Merge pull request #9 from krissss/8-remote-code-execution-rce-via-line-parameter-in-tail-function
fix: RCE
2 parents a08b19f + 1209e93 commit 7e16694

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.idea
2+
composer.lock
3+
vendor

composer.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,16 @@
1717
"psr-4": {
1818
"kriss\\logReader\\": "src"
1919
}
20+
},
21+
"repositories": [
22+
{
23+
"type": "composer",
24+
"url": "https://asset-packagist.org"
25+
}
26+
],
27+
"config": {
28+
"allow-plugins": {
29+
"yiisoft/yii2-composer": true
30+
}
2031
}
2132
}

src/controllers/DefaultController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ public function actionDownload($slug, $stamp = null)
160160
public function actionTail($slug, $line = 100, $stamp = null)
161161
{
162162
$log = $this->find($slug, $stamp);
163+
$line = intval($line);
163164
if ($log->isExist) {
164165
$result = shell_exec("tail -n {$line} {$log->fileName}");
165166

0 commit comments

Comments
 (0)