-
[Spring Boot] Log4j2 취약점에 대한 대응책 (CVE-2021-44228, CVE-2021-45105)취약점대응 2021. 12. 12. 02:59
해당 글은 아래서도 확인이 가능합니다.
https://rlog.or.kr/post/96[Spring Boot] Log4j2 취약점에 대한 대응책 (CVE-2021-44228)
Log4j2 취약점(CVE-2021-44228)으로 인한 스프링 서버 대응책. 스프링 재단에서 권고하는 버전인 Log4j (v2.15.0)로 강제 업데이트를 진행.
rlog.or.kr
⚙️ 수정내역
1. 취약점 : CVE-2021-45105
취약버전 : 2.0-beta9 ~ 2.16.0 버전 (Log4j 2.12.3 제외)
취약점 CVE-2021-45105으로 인해서 log4j 2.17.0으로 업데이트가 필요하다.취약점 CVE-2021-45105으로 인해서 log4j 2.17.1으로 업데이트가 필요하다.
https://www.krcert.or.kr/data/secNoticeView.do?bulletin_writing_sequence=36397
KISA 인터넷 보호나라&KrCERT
KISA 인터넷 보호나라&KrCERT
www.boho.or.kr
2. 취약점 : CVE-2021-45105, CVE-2021-45046 and CVE-2021-44228
- Java 6 : 2.3.2
- Java 7 : 2.12.4
- Java 8, 8+ : 2.17.1
https://logging.apache.org/log4j/2.x/
Log4j – Apache Log4j 2
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apa
logging.apache.org
🚀 들어가며...
2021년 12월 10일 오전 9시 40분
아파치 소프트웨어 재단에서 개발한 자바 기반의 라이브러리인
Log4j2에서 엄청난 취약점이 발견되었다.
자세히는 모르겠지만, JNDI와 관련되어 서버 PC를 원격으로 조종할 수 있는 취약점이다.
국내는 2021년 12월 11일 KISA에서 대응책을 발표하였다.
취약점은 이 글을 참고
https://www.randori.com/blog/cve-2021-44228/CVE-2021-44228 - Log4j 2 Vulnerability Analysis - Randori Attack Team
CVE-2021-44228 is a high severity vulnerability impacting Apache Log4j 2. Randori has developed a working exploit and provided a technical analysis.
www.randori.com
문제의 소스는 아래를 참고
https://logging.apache.org/log4j/2.x/Log4j – Apache Log4j 2
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apa
logging.apache.org
위의 공식 사이트를 보니, 해당 부분이 문제인것 같다.log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class
나는 개인 웹 서비스가 Spring Boot가 Maven 기반이기에
스프링 재단에서 권고하는 버전인
Log4j(v2.15.0)(v2.17.0)으로 강제 업데이트를 진행하였다.(2021.12.20 수정 : 취약점 CVE-2021-45105으로 인해서
log4j 2.17.0,log4j 2.17.1으로 업데이트가 필요하다.)
(해당 포스트는 메이븐을 예시로 했으니, 메이븐이 아닌 경우 아래 레퍼런스를 참고 바랍니다)🔗 레퍼런스
위키
스프링 블로그
https://spring.io/blog/2021/12/10/log4j2-vulnerability-and-spring-boot
Log4J2 Vulnerability and Spring Boot
<p>As you may have seen in the news, a new zero-day exploit has been reported against the popular Log4J2 library which can allow an attacker to remotely execute code. The vulnerability has been reported with <a href="https://nvd.nist.gov/vuln/detail/CVE-20
spring.io
이스트시큐리티 (알약)
Apache Log4j2 원격코드실행 취약점 주의!
log4j는 프로그램을 작성하는 도중에 로그를 남기기 위해 사용되는 자바 기반 로깅 유틸리티 입니다. 이번에 발견된 취약점은 Log4j-2중에 존재하는 JNDI인젝션 취약점으로, 대부분의
blog.alyac.co.kr
KISA 한국인터넷진흥원
https://www.krcert.or.kr/data/secNoticeView.do?bulletin_writing_sequence=36389
KISA 인터넷 보호나라&KrCERT
KISA 인터넷 보호나라&KrCERT
www.boho.or.kr
💌 보완
1. 버전 업그레이드 (required jdk >= 1.8)
메이븐의 경우 아래의 절차를 따르면 된다.
의존성이 추가된 log4j를 찾아보자../mvnw dependency:list | grep log4j
출력이 2.15.0 버전보다 낮다면
pom.xml에 아래를 추가해준다.<properties> <!-- Apache Log4j Update Update 2.17.1 due to Vulnerability. https://spring.io/blog/2021/12/10/log4j2-vulnerability-and-spring-boot --> <log4j2.version>2.17.1</log4j2.version> </properties>
변경된 의존성을 적용해주고 (mvn install 명령어를 통해서)
log4j의 버전을 확인한다../mvnw dependency:list | grep log4j
이때2.15.0 버전2.17.0버전 으로 업데이트가 되었다면, 성공이다.(2021.12.20 수정 : 취약점 CVE-2021-45105으로 인해서 log4j 2.17.1으로 업데이트가 필요하다.)
2. 실행 옵션 추가라이브러리 버전 업그레이드가 어려운 경우, 사용(2021.12.20 수정 : 실행 옵션을 통해서, 해결 가능한지 검토 중입니다. )
java -Dlog4j2.formatMsgNoLookups=true -jar [appName].jar
(2021.12.20 수정 : 취약점 CVE-2021-45105으로 인해서 log4j 2.17.1으로 업데이트가 필요하다.)
📑 결과
1. log4j 버전 업그레이드
log4j를 업데이트를 하여 취약점 보완완료 (2021.12.20 수정 : 취약점 CVE-2021-45105으로 인해서 log4j 2.17.0으로 업데이트가 필요하다.)(2022.05 수정 : 취약점 CVE-2021-45105으로 인해서 log4j 2.17.1으로 업데이트가 필요하다.)
2. 실행 커맨드 옵션 확인# 띄어쓰기 주의 # 옵션 : 프로세스 아이디, 실행 계정, 수행 기간, 실행 커맨드 ps -eo pid,user,etime,cmd | grep java | grep log4j
java 프로세스의 커맨드에 log4j 옵션이 달려 있는지 확인하자.🙋🏻♂️ 후기
- Log4j가 문제가 많은 건 알았지만, 이번 사건으로 인해서 사용이 급감할 것 같다.
+ 추가내용
취약점 대상
apache log4j2 : 2.0-beta9 ~ 2.14.1
전자정부 프레임워크
전자정부 표준 프레임워크는 3.1부터 Log4j2.0을 사용하고 있다.
(전자정부 프레임워크가 버전 1이여서 상관없다는 말은 정확한 말이 아니다. 오히려 버전1은 과거 해킹 기법에 취약해서 업그레이드 + KISA 권장 조취가 필요하다)전자정부 프레임워크 버전 (log4j 취약)
공지사항 | 표준프레임워크 포털 eGovFrame
처리중입니다. 잠시만 기다려주십시오.
www.egovframe.go.kr
----------------------------
3.1 : Log4j 2.0
3.5 : Log4j 2.1
3.6 : Log4j 2.5
3.7 : Log4j 2.8.2
3.8 : Log4j 2.10.0
3.9 : Log4j 2.11.2
3.10 : Log4j 2.12.1
4.0(베타) : : Log4j 2.14.0
----------------------------
현재 각 보안사들은 무료로 log4j 스캐너 제공 중이다.
https://labrador.iotcube.com/labrador
labrador.iotcube.com
위에서 보지 못한 분을 위해서 추가
취약점 : CVE-2021-45105
취약버전 : 2.0-beta9 ~ 2.16.0 버전 (Log4j 2.12.3 제외)
취약점 CVE-2021-45105으로 인해서
log4j 2.17.0log4j 2.17.1으로 업데이트가 필요하다.https://www.krcert.or.kr/data/secNoticeView.do?bulletin_writing_sequence=36397
KISA 인터넷 보호나라&KrCERT
KISA 인터넷 보호나라&KrCERT
www.boho.or.kr
https://logging.apache.org/log4j/2.x/
Log4j – Apache Log4j 2
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apa
logging.apache.org
KISA에서 종 정리한 글이다.
https://www.krcert.or.kr/data/secNoticeView.do?bulletin_writing_sequence=36389
KISA 인터넷 보호나라&KrCERT
KISA 인터넷 보호나라&KrCERT
www.boho.or.kr
취약점 : CVE-2021-45105, CVE-2021-45046 and CVE-2021-44228
https://logging.apache.org/log4j/2.x/
Log4j – Apache Log4j 2
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apa
logging.apache.org
반응형'취약점대응' 카테고리의 다른 글
Log4j 버전을 확인하자 (Log4j 버전 확인) (2) 2021.12.15