fix(security): 스케줄 셸 인터프리터 인라인 코드 우회 차단
셸 스케줄 검증이 첫 토큰 basename 만 화이트리스트와 대조하고 뒤 인자를 검증하지 않아, 운영자가 bash 를 등록하면 `bash -c id` 로 임의 OS 명령이 실행됐다(KVE-2026-1653). 인터프리터는 범용 크론 용도로 등록을 허용하되, 스크립트 자리(첫 인자)에 형태 규칙을 적용해 인라인 코드·상대경로·트래버설· artisan 우회·완전거부형(env/awk/make 등)을 저장·실행 양쪽에서 거부한다.
This commit is contained in:
1 parent
19424877e8
commit
2fb452aa44
12 files changed
+955
-7
No files matched your search
@@ -34,8 +34,24 @@ class AllowedShellCommand implements ValidationRule
|
||||
return;
|
||||
}
|
||||
|
||||
if (! ScheduleCommandValidator::isShellCommandAllowed($value)) {
|
||||
$fail(__('validation.schedule_command.shell_not_allowed'));
|
||||
$verdict = ScheduleCommandValidator::inspectShellCommand($value);
|
||||
|
||||
if ($verdict['allowed']) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 인터프리터에 인라인 코드/명령을 넘기거나 안전하지 않은 스크립트 경로를 지정한
|
||||
// 경우는 전용 안내로 구분한다 — 화이트리스트 미등재와는 조치 방법이 다르다.
|
||||
$interpreterReasons = [
|
||||
ScheduleCommandValidator::SHELL_REASON_INTERPRETER,
|
||||
ScheduleCommandValidator::SHELL_REASON_INLINE_CODE,
|
||||
ScheduleCommandValidator::SHELL_REASON_SCRIPT_PATH,
|
||||
];
|
||||
|
||||
$key = in_array($verdict['reason'], $interpreterReasons, true)
|
||||
? 'validation.schedule_command.shell_interpreter_denied'
|
||||
: 'validation.schedule_command.shell_not_allowed';
|
||||
|
||||
$fail(__($key));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user