Apache TomcatÎļþ°üÀ¨Îó²îÆÊÎö

Ðû²¼Ê±¼ä 2020-02-21

Ò»¡¢Îó²î¸ÅÊö


2020Äê2ÔÂ20ÈÕ£¬¹ú¼ÒÐÅÏ¢Çå¾²Îó²î¹²Ïíƽ̨£¨CNVD£©Ðû²¼¹ØÓÚApache TomcatµÄÇ徲ͨ¸æ£¬Apache TomcatÎļþ°üÀ¨Îó²î£¨CNVD-2020-10487£¬¶ÔÓ¦CVE-2020-1938£© ¡£Tomcat AJPЭÒéÓÉÓÚ±£´æʵÏÖȱÏݵ¼ÖÂÏà¹Ø²ÎÊý¿É¿Ø£¬¹¥»÷ÕßʹÓøÃÎó²î¿Éͨ¹ý½á¹¹Ìض¨²ÎÊý£¬¶ÁÈ¡·þÎñÆ÷webappϵÄí§ÒâÎļþ ¡£Èô·þÎñÆ÷¶Ëͬʱ±£´æÎļþÉÏ´«¹¦Ð§£¬¹¥»÷Õ߿ɽøÒ»²½ÊµÏÖÔ¶³Ì´úÂëµÄÖ´ÐÐ ¡£


¶þ¡¢Îó²îÆÊÎö


ͨ¹ý¶ÔApache TomcatÔ´Âë¾ÙÐÐÆÊÎö£¬·¢Ã÷TomcatÔÚ´¦Öóͷ£ajpЭÒéʱ±£´æÎó²î£¬¿Éͨ¹ýŲÓÃrequest.setAttributeΪTomcatÉèÖÃí§ÒârequestÊôÐÔ£¬ÈçÏÂͼËùʾ£º


ÓÅ·¢¹ú¼Ê¡¤ËæÓŶø¶¯Ò»´¥¼´·¢


̫ͨ¹ýÎö¸´ÏÖ·¢Ã÷Tomcat ajpЭÒé±£´æwebĿ¼ÏÂí§ÒâÎļþ¶ÁÈ¡Îó²îÒÔ¼°JSPÎļþ°üÀ¨Îó²î ¡£µ±ajp URIÉèÖÃΪ·Çjsp·¾¶Ê±£¬Tomcat»áŲÓÃDefaultServlet´¦Öóͷ££¬´Ëʱ»áµ¼ÖÂwebĿ¼í§ÒâÎļþ¶ÁÈ¡Îó²î ¡£µ±ajp URIÉèÖÃΪjsp·¾¶Ê±£¬Tomcat»áŲÓÃJspServlet´¦Öóͷ££¬´Ëʱ»áµ¼ÖÂJSPÎļþ°üÀ¨Îó²î ¡£


2.1 WebĿ¼í§ÒâÎļþ¶ÁÈ¡Îó²î


µ±ajp URIÉèÖÃΪ·Çjsp·¾¶Ê±£¬Tomcat»áŲÓÃDefaultServlet´¦Öóͷ£,ÎÒÃÇÐèÒª¿ØÖÆÈçÏÂÁ½¸öÊôÐÔ£º

javax.servlet.include.path_info

javax.servlet.include.servlet_path


ÆäÖУ¬javax.servlet.include.servlet_pathÊôÐÔΪĿ½ñÏîĿ·¾¶¡¢javax.servlet.include.path_infoÊôÐÔΪĿ¼·¾¶ ¡£È»ºó£¬Í¨¹ýDefaultServletÀàµÄgetRelativePathÒªÁì¾ÙÐÐÆ´½Ó»ñµÃpath·¾¶ ¡£ÈçÏÂͼËùʾ£º


ÓÅ·¢¹ú¼Ê¡¤ËæÓŶø¶¯Ò»´¥¼´·¢


×îºó£¬»á½«path´øÈëµ½getResource(path)ÒªÁìÖÐÔì³Éí§ÒâÎļþ¶ÁÈ¡ ¡£ÈçÏÂͼËùʾ£º


ÓÅ·¢¹ú¼Ê¡¤ËæÓŶø¶¯Ò»´¥¼´·¢


ʹÓøÃÎó²îÀֳɶÁÈ¡µ½/WEB-INF/Ŀ¼ÏÂweb.xmlÎļþ ¡£


ÓÅ·¢¹ú¼Ê¡¤ËæÓŶø¶¯Ò»´¥¼´·¢


2.2 JspÎļþ°üÀ¨Îó²î


µ±ajp URIÉèÖÃΪjsp·¾¶Ê±£¬Tomcat»áŲÓÃJspServletµÄserviceÒªÁì´¦Öóͷ££¬ÈçÏÂͼËùʾ£º


ÓÅ·¢¹ú¼Ê¡¤ËæÓŶø¶¯Ò»´¥¼´·¢


ͬÑù»á»ñÈ¡javax.servlet.include.path_info¡¢javax.servlet.include.servlet_pathÕâÁ½¸öÊôÐÔ£¨¾­ÓÉÉÏÃæµÄÆÊÎöÎÒÃÇÒѾ­ÖªµÀ¿ÉÒÔͨ¹ýajpЭÒé¿ØÖÆÕâÁ½¸öÊôÐÔ£© ¡£½«ÕâÁ½¸öÊôÐÔ¶ÔÓ¦µÄֵƴ½Óµ½jspURi±äÁ¿ÖУ¬×îºó½»¸øserviceJspFileÒªÁì´¦Öóͷ££¬ÈçÏÂͼËùʾ£º


ÓÅ·¢¹ú¼Ê¡¤ËæÓŶø¶¯Ò»´¥¼´·¢


Venus.txtÎļþ´úÂëÈçÏÂËùʾ£º


ÓÅ·¢¹ú¼Ê¡¤ËæÓŶø¶¯Ò»´¥¼´·¢


ÀÖ³ÉRCEЧ¹ûÈçÏÂͼËùʾ£º


ÓÅ·¢¹ú¼Ê¡¤ËæÓŶø¶¯Ò»´¥¼´·¢


Èý¡¢Ó°Ïì°æ±¾


Tomcat 6

Tomcat 7

Tomcat 8

Tomcat 9


ËÄ¡¢¹æ±Ü¼Æ»®


½«TomcatÁ¬Ã¦Éý¼¶µ½9.0.31¡¢8.5.51»ò7.0.100°æ±¾¾ÙÐÐÐÞ¸´ ¡£


½ûÓÃAJPЭÒé ¡£

±à¼­ /conf/server.xml£¬ÕÒµ½ÈçÏÂÐУº

<Connector port="8009"protocol="AJP/1.3" redirectPort="8443" />

½«´ËÐÐ×¢Ê͵ô£¨Ò²¿Éɾµô¸ÃÐУ©£º

<!--<Connectorport="8009" protocol="AJP/1.3"redirectPort="8443" />-->


ÉèÖÃsecretÀ´ÉèÖÃAJPЭÒéµÄÈÏ֤ƾ֤ ¡£


ÀýÈ磨עÖرØÐ轫YOUR_TOMCAT_AJP_SECRET¸ü¸ÄΪһ¸öÇå¾²ÐԸߡ¢ÎÞ·¨±»ÈÝÒײ½âµÄÖµ£©£º

<Connector port="8009"protocol="AJP/1.3" redirectPort="8443"address="YOUR_TOMCAT_IP_ADDRESS" secret="YOUR_TOMCAT_AJP_SECRET"/>