1. 개요
https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2014-3581
Apache HTTP Server 2.4.10 이하 버전에 영향을 주는 보안 취약점인 CVE-2014-3581을 해결하기 위한 소스 파일(cache_util.c) 변경 사항입니다.
핵심은 ap_make_content_type()의 반환값을 바로 apr_table_setn()에 전달하지 않고, 먼저 NULL 여부를 확인한 뒤 Content-Type 헤더를 설정하도록 수정한 점입니다. 이처럼 반환값 검사를 추가하면 예외적인 상황에서 잘못된 포인터가 사용되는 문제를 줄일 수 있습니다.
2. 소스 파일
httpd/httpd/branches/2.4.x/modules/cache/cache_util.c
- 이전 소스
if (r->content_type
&& !apr_table_get(headers_out, "Content-Type")) {
apr_table_setn(headers_out, "Content-Type",
ap_make_content_type(r, r->content_type));
}
if (r->content_encoding
- 변경 소스
if (r->content_type
&& !apr_table_get(headers_out, "Content-Type")) {
const char *ctype = ap_make_content_type(r, r->content_type);
if (ctype) {
apr_table_setn(headers_out, "Content-Type", ctype);
}
}
if (r->content_encoding
3. 변경 사항 요약
ap_make_content_type(r, r->content_type)의 결과를ctype변수에 저장합니다.ctype이 유효할 때만Content-Type헤더를 설정합니다.- 기존 동작은 유지하면서, 반환값이 없을 수 있는 경우에 대한 방어 코드를 추가한 형태입니다.
4. 확인 방법
운영 중인 Apache HTTP Server가 2.4.10 이하라면 배포판 보안 업데이트 또는 Apache HTTP Server의 수정 릴리스 적용 여부를 먼저 확인하는 것이 좋습니다. 소스 기준으로는 위와 같이 modules/cache/cache_util.c에서 ap_make_content_type() 호출 결과를 별도 변수에 담고 NULL 검사를 수행하는지 확인할 수 있습니다.