https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-11996

 

이번 Apache Tomcat HTTP/2 취약점의 경우,

Tomcat의 Http2UpgradeHandler의 Exception 처리하는 반복문(for)을 악용한 방법입니다.

(AWS ALB를 이용중이라면, Clinet → HTTP/2 → ALB → HTTP/1.1 → Target 으로 전달되기에 영향이 없습니다.)

 

업그레이드를 통해 수정된 내용도 Http2UpgradeHandler의 이 부분을 삭제 및 수정하여 조치되었습니다.

HTTP/2 Enable이 되어 있지 않다면, 해당 Handler를 호출할 일이 없기에 영향이 없을 것으로 보입니다.

 

# Tomcat 8.5.15 이상에서 HTTP 2 Enable 방법.

  • UpgradeProtocol 태그를 추가하여서 Http2Protocol class 호출.

<Connector port="8080" protocol="HTTP/1.1"

               connectionTimeout="20000"

               redirectPort="8443">

      <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />

    </Connector>

 

# HTTP2 취약점 Upgrade 소스 수정 내용.(Fix BZ 64467. Improve performance of closing idle streams)

 

 java/org/apache/coyote/http2/Http2UpgradeHandler.java

    }

 

     
     
  -

    private void closeIdleStreams(int newMaxActiveRemoteStreamId) throws Http2Exception {

  -

        for (int i = maxActiveRemoteStreamId + 2; i < newMaxActiveRemoteStreamId; i += 2) {

  -

            Stream stream = getStream(i, false);

  -

            if (stream != null) {

  -

                stream.closeIfIdle();

  +

    private void closeIdleStreams(int newMaxActiveRemoteStreamId) {

  +

        for (Entry<Integer,Stream> entry : streams.entrySet()) {

  +

            if (entry.getKey().intValue() > maxActiveRemoteStreamId &&

  +

                    entry.getKey().intValue() < newMaxActiveRemoteStreamId) {

  +

                entry.getValue().closeIfIdle();

   

            }

   

        }

   

        maxActiveRemoteStreamId = newMaxActiveRemoteStreamId;

   

https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-11996

 

이번 Apache Tomcat HTTP/2 취약점의 경우,

Tomcat의 Http2UpgradeHandler의 Exception 처리하는 반복문(for)을 악용한 방법입니다.

(AWS ALB를 이용중이라면, Clinet → HTTP/2 → ALB → HTTP/1.1 → Target 으로 전달되기에 영향이 없습니다.)

 

업그레이드를 통해 수정된 내용도 Http2UpgradeHandler의 이 부분을 삭제 및 수정하여 조치되었습니다.

 

현재 우리가 설치하여 사용중인 Tomcat은 Http 2로 Protocol 업그레이드를 하여 사용하지 않아서,

이 Handler 호출이 이루어질 수 없기에 해당이 없을 것으로 보입니다.

 

# Tomcat 8.5.15 이상에서 HTTP 2 Enable 방법.

  • UpgradeProtocol 태그를 추가하여서 Http2Protocol class 호출.

<Connector port="8080" protocol="HTTP/1.1"

               connectionTimeout="20000"

               redirectPort="8443">

      <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />

    </Connector>

 

# HTTP2 취약점 Upgrade 소스 수정 내용.(Fix BZ 64467. Improve performance of closing idle streams)

 

 

    }

 

     
     
  -

    private void closeIdleStreams(int newMaxActiveRemoteStreamId) throws Http2Exception {

  -

        for (int i = maxActiveRemoteStreamId + 2; i < newMaxActiveRemoteStreamId; i += 2) {

  -

            Stream stream = getStream(i, false);

  -

            if (stream != null) {

  -

                stream.closeIfIdle();

  +

    private void closeIdleStreams(int newMaxActiveRemoteStreamId) {

  +

        for (Entry<Integer,Stream> entry : streams.entrySet()) {

  +

            if (entry.getKey().intValue() > maxActiveRemoteStreamId &&

  +

                    entry.getKey().intValue() < newMaxActiveRemoteStreamId) {

  +

                entry.getValue().closeIfIdle();

   

            }

   

        }

   

        maxActiveRemoteStreamId = newMaxActiveRemoteStreamId;