- 악성 코드 다운로드:
- 개발자가 인터넷에서 다운로드한 라이브러리, 코드, 도구 등에 악성 코드가 포함될 수 있음.
- C&C 서버와의 통신, 백도어 설치 등의 가능성.
- 의도치 않은 민감 데이터 유출:
- 개발 중 생성된 로그나 디버그 데이터가 인터넷으로 전송될 위험.
- 라이선스 위반:
- 인터넷에서 무단으로 오픈소스 코드를 사용하는 경우, 라이선스 위반 가능성.
- 취약점 코드 포함:
- 다운로드한 코드나 라이브러리에서 알려진 취약점(CVE)이 존재할 가능성.
- 의도하지 않은 네트워크 활동:
- 개발 도중 테스트용 네트워크 호출이 외부로 유출될 수 있음.
위험 탐지를 위한 Snort 룰
1. 악성 코드 다운로드 탐지
alert tcp any any -> any 80 (msg:"Potential Malware Download via HTTP"; content:"User-Agent|3A|"; http_header; content:".exe"; http_uri; nocase; flow:to_server,established; classtype:trojan-activity; sid:100001; rev:1;)
설명:
- HTTP를 통해 .exe 파일을 다운로드하는 요청을 탐지.
- 특정 User-Agent를 사용하는 경우를 감지.
2. C&C 서버 통신 탐지
alert tcp any any -> any any (msg:"Suspicious C&C Communication Detected"; content:"POST"; http_method; content:"malicious-domain"; http_host; nocase; flow:to_server,established; classtype:trojan-activity; sid:100002; rev:1;)
설명:
- 특정 도메인(예: malicious-domain)으로 POST 요청이 발생하는 경우 탐지.
- 필요 시 악성 도메인 목록을 추가하여 탐지 범위 확장.
3. 민감 데이터 유출 탐지
alert tcp any any -> any any (msg:"Potential Sensitive Data Exfiltration"; content:"Authorization|3A| Basic"; http_header; flow:to_server,established; classtype:data-theft; sid:100003; rev:1;)
설명:
- HTTP 헤더에서 인증 정보(Authorization 헤더)를 포함한 요청을 탐지.
위험 탐지를 위한 YARA 룰
1. 악성 코드 파일 다운로드 탐지
rule MalwareDownload {
meta:
description = "Detects malware file downloads"
author = "Security Officer"
strings:
$malicious_url = "http://malicious-domain.com"
$suspicious_ext = ".exe"
condition:
all of them
}
2. 민감 데이터 유출 관련 파일 탐지
rule SensitiveDataLeak {
meta:
description = "Detects sensitive data in files"
author = "Security Officer"
strings:
$api_key = "api_key"
$auth_token = "Authorization: Bearer"
$password = "password"
condition:
any of them
}
3. 의심스러운 네트워크 통신 코드 탐지
rule SuspiciousNetworkCommunication {
meta:
description = "Detects suspicious network communication in source code"
author = "Security Officer"
strings:
$socket_open = "socket("
$http_post = "POST"
$malicious_host = "malicious-domain"
condition:
any of them
}
적용 및 테스트 방법
- Snort 설정:
- 위 Snort 룰을 Snort 설정 파일(snort.conf)에 추가.
- 테스트 명령:
snort -c /path/to/snort.conf -r /path/to/test.pcap
- YARA 적용:
- 위 YARA 룰을 .yar 파일로 저장.
- 테스트 명령:
yara -r /path/to/rules.yar /path/to/scan/directory
- 주기적 모니터링:
- Snort 및 YARA를 CI/CD 파이프라인, 개발자 워크스테이션에서 주기적으로 실행.