tlog 터미널 로그에서 chmod 명령어로 실행 권한 부여 시 탐지합니다.
Overview
| Priority | Medium |
|---|---|
| Type | Stream |
| Log schema | scribery-tlog-recording |
| Message | $hostname에서 $user 계정이 파일 실행 권한 부여 ($pattern) |
| Output field order | _log_time, pattern, hostname, user, term_type, cmd_line, output, in_bin, out_bin |
| MITRE Techniques | T1222.002 File and Directory Permissions Modification: Linux and Mac File and Directory Permissions Modification |
| MITRE tactics | TA0005 Defense Evasion |
Query
1| eval pattern = groups(cmd_line, "(\\bchmod\\s+\\+x\\b)|(\\bchmod\\s+777\\b)|(\\bchmod\\s+755\\b)|(\\bchmod\\s+-R\\s+755\\b)")
2| search isnotnull(pattern)
3| eval pattern = trim(strjoin("\n", foreach(if(isnull(_1), "", _1), pattern)))
명령줄에서 아래 명령어 패턴을 탐지합니다.
- chmod +x
- chmod 777
- chmod -R 755
Threat analysis
- 공격자는 취약점을 이용하여 악성 스크립트를 /tmp 등 임시 디렉터리에 생성하고, 해당 파일에 실행 권한을 부여한 후 실행합니다.
False positives
- 정상적인 실행 퍼미션 부여 시에도 탐지되므로, 이후에 이어지는 TTP 이벤트를 추적하여 이상 여부를 확인해야 합니다.
Response actions
- 의도하지 않은 파일에 실행 권한이 부여되었다면 실행 권한을 제거합니다. 해당 파일이 악성인 경우 파일 유입 경로를 조사하고 재발하지 않도록 대응 조치합니다.