fix(security): 예약 작업·언어팩·인스톨러의 차단목록을 허용목록으로 전환
KISA 신고포상제 접수 3건(KVE-2026-1677/1678/1679)의 공통 원인은 하나다 — "위험한 것을 골라 막았고, 목록 밖으로 우회됐다". 세 지점 모두 판정을 뒤집는다. 예약 작업 Artisan (KVE-2026-1679) 차단 9개 / 허용 229개였던 구조를 허용목록으로 바꾸고 명령마다 허용 옵션을 선언한다. 검증 과정에서 보고서보다 짧은 경로를 추가로 발견했다 — 검증기는 preg_split 의 첫 토큰을 명령명으로 봤지만 실행부는 문자열째 넘겼고, parameters 가 비면 Laravel 이 StringInput 으로 재파싱한다. 따옴표 한 쌍이면 차단목록의 tinker 가 그대로 실행됐다 (마커 파일로 확인). 파서를 엄격 형태 하나로 고정하고 실행은 (명령명, 인자배열)로 넘겨 재해석 지점 자체를 없앴다. 언어팩 (KVE-2026-1678) 위험 함수 11개를 정규식으로 나열하던 검사를 토큰 상태기계로 교체해 "번역 배열만" 통과시킨다. 목록에 없는 함수도, 함수 이름을 아예 쓰지 않는 형태도 원리적으로 막힌다. 파일 형식·PHP 위치·심볼릭 링크도 화이트리스트로 뒤집었다. 활성 승격이 require 배선의 필수 조건이므로 설치와 활성화의 권한 경계를 네 설치 경로 전부에 같은 강도로 건다 — 경로별 면제는 곧 우회로가 되기 때문이다. 화면은 운영자의 활성화 권한을 보고 auto_activate 를 실을지 결정하므로 재설치 흐름은 그대로 동작한다. 인스톨러 (KVE-2026-1677) 실행 바이너리 자리에 인자가 들어가는 것을 형태 규칙으로 차단한다. escapeshellarg 는 "하나의 인자" 임만 보장할 뿐 그 인자가 실행 파일인지 스크립트인지는 보장하지 않는다. 판정을 의존성 0 공용 정책으로 모아 진단 API·설치 워커·저장 시점이 같은 규칙을 쓴다. stat 은 호출하지 않는다 — 접근이 제한된 서버에서 정상 경로가 거부되던 회귀를 재발시키지 않기 위함이다. 검증: 백엔드 392건 + 프론트 7건 green(skip 1, symlink 미지원 환경). PoC 마커로 red 를 먼저 확보하고, 수정 후 stash 역회귀로 다시 red 가 되는 것까지 확인했다.
This commit is contained in:
1 parent
30867e0e0b
commit
4b6adf4788
45 files changed
+4382
-301
No files matched your search
@@ -25,8 +25,11 @@ return [
|
||||
'errors' => [
|
||||
'manifest_not_found' => 'language-pack.json file not found in archive.',
|
||||
'manifest_invalid_json' => 'language-pack.json contains invalid JSON.',
|
||||
'php_outside_backend' => 'PHP file detected outside the backend/ directory (:file).',
|
||||
'unsafe_php_pattern' => 'Disallowed code pattern detected in PHP file (:file).',
|
||||
'php_outside_backend' => 'PHP files are only allowed at backend/{locale}/{group}.php (:file).',
|
||||
'php_file_not_literal_array' => 'PHP files may only contain a translation array. Line :line of :file contains code that is not part of an array.',
|
||||
'unsupported_file_type' => 'This file type cannot be included in a language pack (:file — :extension). Only json, php and md files are allowed.',
|
||||
'symlink_not_allowed' => 'Language packs cannot contain symbolic links (:file).',
|
||||
'auto_activate_requires_manage' => 'Activating the pack right after installation requires the language pack management permission. Installation proceeds normally without this option.',
|
||||
'core_locale_missing' => 'A core language pack for ":locale" must be active first.',
|
||||
'target_not_installed' => 'Target :scope (":target") is not installed.',
|
||||
'target_inactive' => 'Target :scope (":target") is inactive. Activate it first.',
|
||||
|
||||
@@ -514,6 +514,10 @@ return [
|
||||
'schedule_command' => [
|
||||
'shell_not_allowed' => 'This shell command is not allowed. Only executables registered on the server may be used, and special characters such as pipes (|) or semicolons (;) are not permitted.',
|
||||
'artisan_denied' => 'This Artisan command cannot be run as a schedule for security reasons.',
|
||||
'artisan_not_allowlisted' => 'This Artisan command is not allowed to run on a schedule. Only maintenance commands such as cache clearing and queue processing can be registered.',
|
||||
'artisan_malformed' => 'The Artisan command format is invalid. Quotes, backslashes, and short options (-v) are not allowed; use "command --option[=value]" only.',
|
||||
'artisan_option_denied' => 'This Artisan command contains an option that is not allowed.',
|
||||
'artisan_argument_denied' => 'This Artisan command does not accept additional arguments.',
|
||||
],
|
||||
|
||||
// Component existence validation messages
|
||||
|
||||
@@ -25,8 +25,11 @@ return [
|
||||
'errors' => [
|
||||
'manifest_not_found' => 'ZIP 안에서 language-pack.json 파일을 찾을 수 없습니다.',
|
||||
'manifest_invalid_json' => 'language-pack.json 의 JSON 형식이 올바르지 않습니다.',
|
||||
'php_outside_backend' => 'backend/ 디렉토리 외에 PHP 파일이 포함되어 있습니다 (:file).',
|
||||
'unsafe_php_pattern' => 'PHP 파일에 허용되지 않는 코드 패턴이 포함되어 있습니다 (:file).',
|
||||
'php_outside_backend' => 'PHP 파일은 backend/{언어코드}/{그룹}.php 위치에만 둘 수 있습니다 (:file).',
|
||||
'php_file_not_literal_array' => 'PHP 파일에는 번역 배열만 담을 수 있습니다. :file 파일 :line 번째 줄에 배열이 아닌 코드가 있습니다.',
|
||||
'unsupported_file_type' => '언어팩에 넣을 수 없는 파일 형식입니다 (:file — :extension). json, php, md 파일만 포함할 수 있습니다.',
|
||||
'symlink_not_allowed' => '언어팩에는 심볼릭 링크를 포함할 수 없습니다 (:file).',
|
||||
'auto_activate_requires_manage' => '설치 후 바로 켜기는 언어팩 관리 권한이 필요합니다. 이 항목을 빼면 설치는 그대로 진행됩니다.',
|
||||
'core_locale_missing' => '코어 언어팩(:locale)이 먼저 활성화되어야 합니다.',
|
||||
'target_not_installed' => '대상 :scope (:target)이 설치되어 있지 않습니다.',
|
||||
'target_inactive' => '대상 :scope (:target)이 비활성 상태입니다. 먼저 활성화해야 합니다.',
|
||||
|
||||
@@ -513,6 +513,10 @@ return [
|
||||
'schedule_command' => [
|
||||
'shell_not_allowed' => '허용되지 않은 쉘 명령입니다. 서버에 등록된 실행 파일만 사용할 수 있으며, 파이프(|)·세미콜론(;) 등 특수문자는 쓸 수 없습니다.',
|
||||
'artisan_denied' => '이 Artisan 명령은 보안상 스케줄로 실행할 수 없습니다.',
|
||||
'artisan_not_allowlisted' => '예약 실행이 허용된 Artisan 명령이 아닙니다. 캐시 정리·큐 처리 등 유지보수 명령만 등록할 수 있습니다.',
|
||||
'artisan_malformed' => 'Artisan 명령 형식이 올바르지 않습니다. 따옴표·역슬래시·단축 옵션(-v)은 쓸 수 없고 "명령명 --옵션[=값]" 형태만 등록할 수 있습니다.',
|
||||
'artisan_option_denied' => '이 Artisan 명령에 허용되지 않은 옵션이 포함되어 있습니다.',
|
||||
'artisan_argument_denied' => '이 Artisan 명령에는 추가 인자를 붙일 수 없습니다.',
|
||||
],
|
||||
|
||||
// 컴포넌트 존재 여부 검증 메시지
|
||||
|
||||
Reference in new issue
Block a user