ãããã®ãã°ã«é¢ããæ å ±ãæåã«å ¬éãããŠããé·ãæéãçµã¡ãŸããã ããããäžžäžå¹Žã ã¡ããã©1幎åãç§ã¯J2EE SAPãšã³ãžã³ã®ã»ãã¥ãªãã£ãããã¯ã«é¢ããã¬ããŒããæã£ãŠBlackHatã«è¡ããŸããã ãã®ãã°ã«ã€ããŠè©±ããŠã¯ãããã§ããããã ç¹ã« ã ZeroNightsã®çããããªãé€ãã°ãRuNetã®BlackHatã§æ瀺ããããã¹ãŠã詳现ã«èª¬æããæããŸã å±ããŠããªãã®ã§ ãããªãåä»ã§ããã
ãã®ç 究ã¯SAP NetWeaver J2EE Engineãã©ãããã©ãŒã ã«æ§ãããããã®ã§ãããABAPãšã³ãžã³ã«é¢ããæ å ±ã¯éåžžã«å°ãªããäžçäžã®ã»ãã¥ãªãã£ã«é¢ããç 究ã¯ã»ãšãã©ãããŸããã ãããã Digital Security Research Groupã¯ãã³ãé£ã¹ããããä»ã®èª°ããããããŠããªãå Žæã§äœããå£ãããã«ããŸãã äžè¬ã«ãæåã¯SAPãäœã§ããããããžãã¹ã«ãšã£ãŠãããã©ã®ããã«éèŠã§ãããã«ã€ããŠããã€ãã®äžè¬çãªèšèããããç®èå±ãã¹ã¯ããŒã«ããŠã³ã§ããããã«ããŸãã
ããããã®æ°Ž
SAPã®ãã¹ãŠã®ããžãã¹ã¢ããªã±ãŒã·ã§ã³ã¯ã2ã€ã®ãã©ãããã©ãŒã ã®ããããã«åºã¥ããŠãããå€ããœãªã¥ãŒã·ã§ã³ããµããŒãã¢ããªã±ãŒã·ã§ã³ãã«ãŠã³ãããŠããŸããã ããæ£ç¢ºã«ã¯ã3çªç®ã®ãã©ãããã©ãŒã -SAP Business ObjectsããããŸããããã¯å€ãã®ã·ã¹ãã ãå®è¡ããŸãããäžè¬çã«ã¯ããŸãäžè¬çã§ã¯ãªããNetWeaver J2EE Engineã«äŒŒãŠããŸãã
ã»ãã¥ãªãã£ã®èŠ³ç¹ããæãå€ããæãããç¥ãããå€ããå°ãªããç 究ãããŠãããã©ââãããã©ãŒã çªå·1ã¯ãSAP NetWeaver ABAPã§ãã ãã®ã¢ããªã±ãŒã·ã§ã³ãµãŒããŒã«åºã¥ããŠãERPãCRMãSRMãPLMãããã³ãã®ä»ã®3æåã®ç¥èªãªã©ã®ã·ã¹ãã ã䜿çšãããŸãããããã¯éåžžãã¹ããŒããªäººã®ç®ãåŒãããã«ãªã¹ããããŠããŸãã ããããã¹ãŠã®ã¢ããªã±ãŒã·ã§ã³ã¯ãããžãã¹ããã»ã¹ãèªååãããšããå ±éã®ç®æšã«ãã£ãŠçµåãããŠããŸãã ãããæå³ããããšã¯ãå€ãã¯ãŸã ææ°ã§ã¯ãããŸãããããã®èšäºã§ã¯éèŠã§ã¯ãããŸããã
2çªç®ã®ãã©ãããã©ãŒã ã¯SAP NetWeaver J2EE EngineïŒä»¥äžãJ2EEãšã³ãžã³ããšåŒã³ãŸããèšäºã®J2EEãšã³ãžã³ã¯ãJAVAä»®æ³ãã·ã³ã®ã³ã¢ã§ã¯ãªãããã¹ãŠã®ã¢ããªã±ãŒã·ã§ã³ãå«ãã¢ããªã±ãŒã·ã§ã³ãµãŒããŒãã©ãããã©ãŒã å šäœãæããŸãïŒã å®éããã®ãã©ãããã©ãŒã ã¯ããžãã¹ã¢ããªã±ãŒã·ã§ã³ãçµåããããã«èšèšãããŠããŸããã€ãŸããããèªäœã¯éèŠãªæ å ±ãå«ãŸãªãããšãå€ãããããã仲ä»è ãšããŠæ©èœããŸãã NetWeaver J2EEãã©ãããã©ãŒã ã«åºã¥ããã®ãããªã¢ããªã±ãŒã·ã§ã³ã®ãªã¹ãã«ã¯ãSAPããŒã¿ã«ãå«ãŸããŸããSAPããŒã¿ã«ã¯ãSSOãªã©ãä»ããŠããŸããŸãªãªãœãŒã¹ãžã®çµ±åã¢ã¯ã»ã¹ãæäŸãããŠãããŒãµã«ãšã³ã¿ãŒãã©ã€ãºããŒã¿ã«ã®äžçš®ã§ãã ããŒã¿ã«ã§ã¯ãå€ãã®å Žåãå éšSCADAã·ã¹ãã ã®ã€ã³ã¿ãŒãã§ãŒã¹ãžã®ãªã³ã¯ãèŠã€ããããšãã§ããŸããããã¯çŽæ¥å©çšã§ããŸããããæ©èœã®äžéšã¯ããŒã¿ã«ã«éä¿¡ãããŸãã ãããäœãè ãããã¯ç解ã§ãããšæããŸãã ããŒã¿ã«ã«å ããŠãJ2EEãšã³ãžã³ã¯ãããšãã°ãšã³ã¿ãŒãã©ã€ãºçµ±åãã¹ã§ãããããŸããŸãªããžãã¹ã¢ããªã±ãŒã·ã§ã³ãšä»ã®å€ãã®ã¢ããªã±ãŒã·ã§ã³éã®äº€æãæäŸããSAP XI / PIã¢ããªã±ãŒã·ã§ã³ã«åºã¥ããŠããŸãã äžè¬çã«ããªãç§ã¯ãããã¹ãŠã§ããïŒ
åäžã®äŒç€Ÿã§ããžãã¹ãããŒãå¶åŸ¡ããå¿ èŠããããšããŸãïŒãªããããå¿ èŠãªã®ãããã®äŸãã©ã®ããã«æãæµ®ããã ã®ãã¯å°ããŸããïŒã ãããè¡ãã«ã¯ãããŒã¿ãåŠçããå€æ°ã®ãµãŒããŒãããããªã³ã¯ã§ãããµãŒããŒã«ãããã³ã°ããæ¹ãã¯ããã«ç°¡åã§ãã ããã«ãABAPãšã³ãžã³ã®ã»ãã¥ãªãã£ã«é¢ããéãããã§ã«å€ãã®ç 究ãè¡ãããŠãããåŸã ã«å®å šæ§ãé«ãŸã£ãŠããŸãããã€ã³ã人ã«ãã£ãŠå®å šã«éçºãããJAVAãšã³ãžã³ã§ã¯ããã§ã¯ãããŸããã
ããã§ãJ2EEã®éšåãåæããããšã«ããŸããã 2009幎ã«éå§ãããJAVAãšã³ãžã³ã®ã»ãã¥ãªãã£èª¿æ»ã«ãããçŽ200ã®è匱æ§ãçºèŠãããŸãããããã®ã»ãšãã©ã¯çŸåšè£œé å ã«ãã£ãŠééãããŠããŸãã 倧éã®XSS-okãæ å ±æŒããã®è匱æ§ããã®ä»ã®æ¯èŒçãããµããåé¡ã«å ããŠãããèå³æ·±ããã°ããããŸãããå®éãããã«ã€ããŠè©³ãã説æããŸãã
ããããèªã
æ°ããã¯ã©ã¹ãçºèŠããå Žåãå€ãã®äŸãèŠã€ããããšãã§ããã®ã§ãè匱æ§ã®ã¯ã©ã¹å šäœïŒãŸãã¯å°ãªããšããµãã¯ã©ã¹ïŒãåå¥ã®åé¡ãããæ€åºããæ¹ãã¯ããã«ã¯ãŒã«ã§ããããšã¯èª°ããç¥ã£ãŠããŸãã J2EEãšã³ãžã³ã®äŸã§ã¯ãSAP NetWeaver J2EE Engineãã©ãããã©ãŒã ã¯Javaã§èšè¿°ãããã¢ããªã±ãŒã·ã§ã³ããã¹ãã§ããJ2EEæšæºã¢ããªã±ãŒã·ã§ã³ãµãŒããŒã§ããããããŸã£ããåé¡ã¯ãããŸããã ããã¯ãApache Tomcatã®ãããªãã®ã§ãããã100åã®å€§ããã§ãããè€éã§ç解ãã«ãããã®ã§ããè€éãªéšåã§ã¯ã確å®ã«è匱æ§ãçŸããŸãã å®éããã®ãµãŒããŒã«ã¯ãSAP PortalãSAP XIãSAP PIãªã©ã®ããžãã¹ã·ã¹ãã èªäœããåå¥ã®ã¢ããªã±ãŒã·ã§ã³ãŸãã¯äžé£ã®ã¢ããªã±ãŒã·ã§ã³ãããã³ç¬èªã®éçºã¢ããªã±ãŒã·ã§ã³ãšããŠé 眮ãããŠããŸãã ãã®ãããªå€§èŠæš¡ã·ã¹ãã ã¯ãããå°ããªã¢ããªã±ãŒã·ã§ã³ïŒã¢ããªã±ãŒã·ã§ã³ïŒã§æ§æãããŠãããåã¢ããªã±ãŒã·ã§ã³ã¯ãè€éããã³ãŒãã®ãµã€ãºã®ç¹ã§ãå°ããªWebãããžã§ã¯ãã«å¹æµããããšããããããŸãã ãã®ãããªã¢ããªã±ãŒã·ã§ã³ã¯ããã©ã«ãã§å€æ°ã€ã³ã¹ããŒã«ãããŠããŸãã ãããã£ãŠãNetWeaverããŒãžã§ã³6.40ã«ã¯çŽ500ããããããŒãžã§ã³7.2ã«ã¯ãã§ã«1200ããããŸããåœç¶ãåã¢ããªã±ãŒã·ã§ã³ã«ã¯ç¬èªã®ãã°ãå«ãŸããŠããŸãããããããæ€çŽ¢ããå¿ èŠã¯ãªãããã¹ãŠç¹å®ã§ãã ããäžè¬çãªãã®ãããçš®ã®å€§èŠæš¡ãªè匱æ§ãã€ãŸããã¹ãŠã®ã¢ããªã±ãŒã·ã§ã³ã«æœåšçã«ååšãããã®ãèŠã€ããããšèããŸããã
ããããè¯ã
J2EEã¢ããªã±ãŒã·ã§ã³ã«ç²ŸéããŠãã人ãªãããããããã¹ãŠãå°ãªããšã1ã€ã®ãã¡ã€ã«web.xmlã«ãã£ãŠçµåãããŠããããšãç¥ã£ãŠããã§ãããã ãã®ãã¡ã€ã«ãšSAPã«ããã«ç²ŸéããŠãã人ã ã¯ãã»ãšãã©ã®å Žåããã§ã«ãããäœã§ããããæšæž¬ããŠããŸãã ãã ããæåã«ãå žåçãªWEB.XMLãã¡ã€ã«ã®æ§é ãèŠãŠãã ããã
<servlet> <servlet-name>CriticalAction</servlet-name> <servlet-class>com.sap.admin.Critical.Action</servlet-class> </servlet> <servlet-mapping> <servlet-name>Critical</</servlet-name> <url-pattern>/admin/criticalfunc</url-pattern> </servlet-mapping> <security-constraint> <web-resource-collection> <web-resource-name>Restrictedaccess</web-resource-name> <url-pattern>/admin/*</url-pattern> <http-method>GET</http-method> </web-resource-collection> <auth-constraint> <role-name>admin</role-name> </auth-constraint> </security-constraint>
ãšã©ãŒãã©ãã«ããã®ãã誰ããæ¢ã«ç解ããŠããã ãã...ãããéããããŠããªãã¿ã°ã«æãçªãããã«æ¥ãã§ã¯ãããŸãããç§ã¯åãªãã¿ã€ããã¹ã§ã¯ãªããæ²ããçµæã«ã€ãªããè匱æ§ãæå³ããŸãã èŠã€ãããŸããã§ãããïŒ æ¬¡ã«ãèªãããšããå§ãããŸãã J2EEãšã³ãžã³ã«ã¯ãInvoker Servletã®ãããªã¡ã«ããºã ããããŸãã ããã«ãããéçºè ããããã°ã¢ãŒãã§çŽæ¥ã¯ã©ã¹ã«ã¢ã¯ã»ã¹ããã®ã«äŸ¿å©ãªããã«ãã¯ã©ã¹ã®ååã§çŽæ¥è¡ã§ä»»æã®ãµãŒãã¬ããïŒãµãŒããŒäžã§æ©èœãå®è¡ããã¢ããªã±ãŒã·ã§ã³ã®äžéšïŒãåŒã³åºãããšãã§ããŸãã ãããã«ãããããã¯ãã®ããã«èª¬æãããŠããã®ã§ãç§ã¯è°è«ããªãã§ããããå€åããã¯æ¬åœã«äŸ¿å©ã§ãã ãããããã®ãµãŒãã¬ããã®ã¯ã©ã¹åã/ servlet / <servlet-name-or-class>ã®ããã«URLããŒã«å ¥åããããšã«ãããã»ãã¥ãªãã£èšå®ããã€ãã¹ããããšãç¹ã«äŸ¿å©ã§ãã
ãããŠããã§äžè¬çã«æãçŸå³ãã
åé¡ã¯ãå±éºãªã¢ã¯ã·ã§ã³ãå®è¡ãããµãŒãã¬ãããäœæãã/ adminãªã©ã®ãã£ã¬ã¯ããªã«é 眮ããadminããŒã«ãæã€ãŠãŒã¶ãŒãé€ããã¹ãŠã®ãŠãŒã¶ãŒã«å¯ŸããŠ<auth-constraint>ã䜿çšããŠã¢ã¯ã»ã¹ãéãããšãã«å§ãŸããŸãã ãã¡ã€ã«ã¯ã/ãµãŒãã¬ãããã£ã¬ã¯ããªãžã®çŽæ¥ã¢ã¯ã»ã¹ãäœããã®æ¹æ³ã§ãããã¯ãããŠããªãããããªã³ã¯/ãµãŒãã¬ãã/ <servlet-name-or-class>ã®Invokerã¡ã«ããºã ãéããŠçŽæ¥ãµãŒãã¬ããã«ã¢ã¯ã»ã¹ããèªèšŒãªãã§å¿ èŠãªããŒã¿ãååŸã§ããããšã§ãé²åŸ¡ã/ *ã«ç«ã£ãŠããå Žåããã¹ãŠãåé¡ãããŸããïŒã ããã¯éåžžã«åçŽã§ç°¡æœã§ãããJ2EEã¢ããªã±ãŒã·ã§ã³ã§ãããã¡ãªãŒããŒãããŒãçºçããããã®ãããªã¢ãŒããã¯ãã£äžã®ãã°ãçºçããå ŽåãJAVAã¿ã€ããCããå®å šã§ããããšã¯éèŠã§ã¯ãããŸããã
ç§ãã¡ã«ãšã£ãŠã®äž»ãªåé¡ã¯ã åã㊠ã500ã®ãã¹ãŠã®ã¢ããªã±ãŒã·ã§ã³ã®äžã§ãInvokerãµãŒãã¬ãããžã®ã¢ã¯ã»ã¹ããã£ã«ã¿ãªã³ã°ããããã®ãµãŒãã¬ãããä»ããŠå±éºãªã¢ã¯ã·ã§ã³ãå®è¡ããã¢ããªã±ãŒã·ã§ã³ã§ããçµå±ãå®éã®ãªã¹ã¯ã瀺ãå¿ èŠããããŸããããã¯çè«çã«ã¯ãç¹å¥ãªç¶æ³ã§ã¯ãa + bc * dãããŸãè¯ããªããã®ã«ã€ãªããå¯èœæ§ããããšããããšã§ããã
ããšãã°ããã楜ããWebãµãŒãã¹ã§ã¯ãOSããä»»æã®ãã¡ã€ã«ãèªã¿åãããšãã§ããŸããããã®ãã°ã«å¯ŸããŠè匱ã§ããã€ãŸãããµãŒããŒã«ä¿åãããŠãããã¡ã€ã«ãèªã¿åãããšãã§ããŸãã å¿ èŠã«å¿ããŠãDBMSããçŽæ¥ããŒã¿ãããŠã³ããŒãããéèååŒãæãäžããããšãã§ããŸããäž»ãªããšã¯ããã©ãŠã¶ãŒãæ°ã®ã¬ãã€ãã®ãã¡ã€ã«ãéããŠããŠã³ããŒãããããšã«äŸåããŠããªãããšã§ãããããã¯ãŸã£ããå¥ã®è©±ã§ãã
ç§ã¯ããŸãããŸãã
ãã®è匱æ§ã«ã€ããŠã¯ãç§ãã¡ã«ãšã£ãŠäœãäžååãªãã®ã§ãããBlackHatã«ç§»åããããã«ç ²æããªããã°ããªãããã®åœ¢ã§å€±æããŸããã ãããŠãç§ã¯ããã«æ€çŽ¢ãå§ããŸããïŒWEB.XMLã§ä»ã«äœãã§ããã§ããããïŒ ãããŠãåè©æ¹ããã®ãããªè匱æ§ã«é¢ããå€ãèšäºãæãåºããŸããã çè«äžã¯éåžžã«æå¹ãªãã°ã§ãããå®éã®ã·ã¹ãã ã«ã¯å®çšçãªäŸã¯ãããŸããã§ããã åœç¶ã®ããšãªãããè©ŠããŠã¿ãããšã«ããŸãããããŸããã£ããã幞éãæåŸ ããŠããªãã®ã«ãæã®ããŒããããããŒãé£ãããã«ãªããŸãã...æ¬åœã«å¹ããŸã-ã§ããŸããã ãããïŒ
æ ç±ãèœã¡çããåŸãç§ã¯æ¬åœã«äœãããªããã°ãªããªãããç解ããŸãããããã¯ãã¢ãŒããã¯ãã£ã®åé¡ãæ€åºããããšãšããã®ãããªè匱æ§ãååšããå®éã®äŸãèŠã€ããããšã ããã§ãã ãã ããåé¡ã¯äœãã説æããŸãã ãããã£ãŠãããã§ããã¢ã¯ã»ã¹å¶åŸ¡ãæ åœããææã®WEB.XMLãŸãã¯ãã®äžéšã®äŸã瀺ããŸãã
<url-pattern>/admin/*</url-pattern> <http-method>GET</http-method> </web-resource-collection> <auth-constraint> <role-name>admin</role-name> </auth-constraint>
ãã®äŸã§ã¯ãadminããŒã«ãæã€ãŠãŒã¶ãŒã®ã¿ã/ adminãã£ã¬ã¯ããªã«ããã¢ããªã±ãŒã·ã§ã³ã«ã¢ã¯ã»ã¹ããGETã¡ãœããã®ã¿ãå®è¡ã§ããããšã瀺ãããŠããŸãã ãããªãã§ïŒ ã©ããªå Žåã§ããæ瀺çã«çŠæ¢ãããŠããªããã®ã¯ãã¹ãŠèš±å¯ãããŠããããšãããããŸãããããšãã°ãGETãšãŸã£ããåãã§ããããŠãŒã¶ãŒã«çµæã衚瀺ããªãHEADã¡ãœããã䜿çšãããšãå¿åã§å®è£ ã§ããŸãã ããŠãŒã¶ãŒãããŒã«ããŸã£ãããããŸããã ãªãã§ïŒ ã¯ãããã¡ã€ã«ã§ããèšã£ãŠããããïŒç®¡çè ã®ã¿ãGETã¡ãœããã䜿çšããŠ/ adminãã£ã¬ã¯ããªã«ã¢ã¯ã»ã¹ã§ããŸãã ãããŠä»ã®æ¹æ³ã§-誰ã«ã§ãïŒ ã€ãŸããã¡ãœããã®ååãæ瀺çã«ç€ºãããŠããªãå Žåãããã¯ç®¡çè ã®ã¿ããã¹ãŠã®ã¡ãœããã䜿çšã§ãããã¹ãŠãåé¡ãªãããšãæå³ããŸãã ãããŠã1ã€ã®æ¹æ³ã瀺ãããã®ã§ãä»ã®ãã¹ãŠããªã¹ãããŠãã ããã
幞ãã«ãªãããã§ããïŒ ã¯ãããããŸããã§ãããä»ãå¹²ãèã®å±±ããŸãã¯å°ãªããšããJ2EEãšã³ãžã³ã«ã€ã³ã¹ããŒã«ãããŠããå°ãªããšãããã€ãã®ã¢ããªã±ãŒã·ã§ã³ã§éãæ¢ãå¿ èŠããããŸãã
â¢åè©ã®æ¹ããã«å¯Ÿããè匱æ§
â¢HEADãªã¯ãšã¹ãããµããŒãããGETãšåãæ¹æ³ã§åŠçããŸã
â¢éèŠãªã¢ã¯ã·ã§ã³ãå®è¡ããŸããå¿çæ¬æã¯ãHEADã§ããããéèŠã§ã¯ãããŸããã
â¢åãªããã¢ãšããŠã§ã¯ãªãããã¹ãŠã®ã€ã³ã¹ããŒã«ã«ååšããããšãæãŸãã
ã¯ããç²ããŸããã ã¯ããããŸããã
äžè¬çã«ããã®ã¢ããªã±ãŒã·ã§ã³ã¯...ãšåŒã°ããŸãããã¡ãªã¿ã«ããã®æçš¿ã泚ææ·±ãèªããšããããŸãã ãããŠãããã¯Webã€ã³ã¿ãŒãã§ãŒã¹ãåããJ2EEãšã³ãžã³ã®ã³ã³ãããŒã«ã«ä»ãªããŸããã ã€ãŸããã·ã¹ãã ã«ãŠãŒã¶ãŒãäœæã§ããŸããããŠãŒã¶ãŒã¯ããã«ããŸãïŒ åœŒã«ä»»æã®ããŒã«ãå²ãåœãŠãããšãã§ããOSã³ãã³ããå®è¡ã§ãããµãŒããŒããªã¢ãŒãã§åæ¢ã§ããŸããããããã¹ãŠã1ã€ã®åçŽãªHEADãªã¯ãšã¹ãã§å®è¡ã§ããŸãã
åæã«ãJ2EEãšã³ãžã³ã䜿çšããSAP Portalã¯ãç°¡åã«ãªã³ã©ã€ã³ã§ã°ãŒã°ã«æ€çŽ¢ã§ããŸãã ããšãã°ã次ã®ããã«ãªããŸããinurlïŒ/ irj / portal
ã¹ããŒãªãŒã®æãã¯ãŒã«ãªéšåã¯ãSecurityByteã«ã³ãã¡ã¬ã³ã¹ïŒãããããã€ã³ãã·ãªã³ã³ãã¬ãŒãïŒã§ãã³ã¬ããŒã«ã«è¡ã£ãŠããã®ãããã¯ã«é¢ãããã¬ãŒã³ããŒã·ã§ã³ãè¡ã£ãŠãããšãã«ã誰ãç§ã«è¿ã¥ããªãã£ãããšã§ãããã®éåžžã«è匱ãªã€ã³ã¿ãŒãã§ã€ã¹ã®éçºè ãããã«ãã£ãŠç§ã®çãã¯æ£åœåãããŸããã ã¡ãªã¿ã«ãéçºè ã¯ã¯ãŒã«ãªç·ã§ããããšãå€æããŸããããã¡ãããç§ã¯åœŒãBla c kHa tã«åå ããã®ãæäŒã£ãŠãããããšã«æè¬ããŸããã åè«ã§ãã
ä»æ¥ã¯ä»¥äžã§ããkHat2012ã§Blaã®ã©ã¹ãã¬ã¹ã«é£ã¶é£è¡æ©ã«ãããã®è¡ãè¿œå ããŸããããã§ãéåžžã«ãšã¬ã¬ã³ããªãã°ã1ã€çŽ¹ä»ããŸã-ã¡ãªã¿ã«ãSAPã§ãJavaã§ããã¬ããŒãããåŸ ã¡ãã ãã...