Server Side Request Forgery (SSRF) (ãµãŒã㌠ãµã€ã ãªã¯ãšã¹ã ãã©ãŒãžã§ãª (SSRF))¶
æŠèŠ¶
ãã¹ãåããŠãŒã¶ãŒã«ãã£ãŠå¶åŸ¡ãããããŒã¿ããæ§ç¯ãããŠããå Žåãæ»æè ã API ãšåããããã¯ãŒã¯ã§å®è¡ãããŠãããã©ã€ããŒããªãµãŒãã¹ãªã©ã®äºæããªããªãœãŒã¹ã«ã¢ã¯ã»ã¹ã§ããå¯èœæ§ããããŸãããããã£ããã©ã€ããŒããªãµãŒãã¹ãžã®ã¢ã¯ã»ã¹ã¯ãæš©éãææ ŒããããããŒã¿ããªãŒã¯ããããIP ãã£ã«ã¿ãŒãè¿åããããè匱æ§ã®ãããµãŒãã¹ãæ»æãããããããšã«å©çšãããå ŽåããããŸãã
SSRF ã®åœ±é¿ã¯ãAPI ãéä¿¡ã§ãããµãŒãã¹ãæ»æè ãã©ã®çšåºŠãã€ããŒããå¶åŸ¡ã§ããããã¬ã¹ãã³ã¹ãæ»æè ã«è¿ããããã©ããã«ãã£ãŠç°ãªããŸããæ»æè ã¯ä»¥äžãå¯èœãªå ŽåããããŸãã
- ãã©ã€ããŒã ãããã¯ãŒã¯ããããããŠãåŸã®æ»æã§å©çšå¯èœãªå éšãµãŒãã¹ã«é¢ããæ å ±ãåéããã
- ã¯ã©ãŠã ã¡ã¿ããŒã¿ ãµãŒãã¹ãå«ãå éšçãªãã©ã€ããŒã ãµãŒãã¹ã«ã¢ã¯ã»ã¹ããããã®ãããªã¢ã¯ã»ã¹ãéããŠãæ»æè ã¯ã¯ã©ãŠãåºç€ãå®å šãŸãã¯éšåçã«å¶åŸ¡ããããŒãå ¥æã§ããå ŽåããããŸãã
- CRLF è匱æ§ãšçµã¿åããããšããªã¢ãŒã ã³ãŒãå®è¡ã«ãšã¹ã«ã¬ãŒãããå¯èœæ§ãããã
URL ã³ãŒã«ããã¯ãŸã㯠Webhook ãåãåããšã³ããã€ã³ãã¯ãäžè¬çã« SSRF æ»æã«å¯ŸããŠè匱ã§ãã
ããã«ãXML ãŸã㯠SVG ããŒãµãŒãªã©ã®å ¥å解æãè¡ãã©ã€ãã©ãªã¯ç¹ã«ãäºæããªããŠãŒã¶ãŒå¶åŸ¡ãããã¯ãŒã¯ ãªã¯ãšã¹ãã«ã€ãªããããã®è匱æ§ã®åœ±é¿ãåããå¯èœæ§ããããŸãã
æšå¥šäºé ¶
æ¢åã®ã©ã€ãã©ãªã䜿çšããå Žåã§ã䜿çšããªãå Žåã§ããã»ãã¥ãªã㣠ããŒã ãšååããSSRF 軜æžçãçå®ããŠæ€èšŒããããšãæšå¥šããŸãããã§ã«èª¬æããããã«ãSSRF æ»æã¯é©åã«è»œæžããã®ãéåžžã«å°é£ã§ãã
å ¥åæ€èšŒ¶
ãŠãŒã¶ãŒå ¥åã Web ãªã¯ãšã¹ãã®æ§ç¯ã«äœ¿çšããåã«æ€èšŒããŸããWeb ãã¬ãŒã ã¯ãŒã¯ã«å«ãŸããã©ã€ãã©ãªã䜿çšããŠããŠãŒã¶ãŒå ¥åããæ§ç¯ããã URL ãæ€èšŒããããšã匷ãæšå¥šããŸããã©ã€ãã©ãªã以äžã«å¯Ÿããä¿è·ãæäŸããããšã確èªããŸãã
- IPv4 ããã³ IPv6 ã®ãã©ã€ããŒã IP
- ãã©ã€ããŒã IP ã«è§£æ±ºããããããªã㯠ãã¡ã€ã³
- ãããªã㯠ID ã«è§£æ±ºãããããHTTP ããã©ã€ããŒã IP ã«ãªãã€ã¬ã¯ããããã¡ã€ã³
- DNS ãªãã€ã³ãã£ã³ã°ãDNS ãªãã€ã³ãã£ã³ã°ã§ã¯ããã¡ã€ã³åããæ€èšŒæã¯å®å šãªãããªã㯠IP ã«è§£æ±ºãããŸããããã©ã€ããŒã IP ã«åãæ¿ããããŸãã
æè¯ã®ã©ã€ãã©ãªã¯ãéåžžã® HTTP ã¯ã©ã€ã¢ã³ã ã©ã€ãã©ãªãšåãã€ã³ã¿ãŒãã§ã€ã¹ãæã¡ãèåŸã§ãããã®å®å šæ§ãã§ãã¯ããã¹ãŠå®è¡ããŸãã
äžè¬ç㪠SSRF æ€èšŒãè¿åããæã¯å€æ°ãããŸããæ¢åã®ã©ã€ãã©ãªãåå©çšã§ããªãå Žåããã©ã€ããŒã IP ãžã®ãã¹ãŠã®æ¥ç¶ããããã¯ããå¿ èŠããããŸãã
- 127.0.0.1/8
- ::1 (IPv6)
- 10.0.0.0/8
- 172.16.0.0/12
- 169.254.0.0/16
- 192.168.0.0/24
- HTTP æ¥ç¶ã®å Žåãªãã€ã¬ã¯ããç¡å¹åãããããªãã€ã¬ã¯ãå ãæ€èšŒããŸãã
- DNS ãªãã€ã³ãã£ã³ã°æ»æã軜æžãããããïŒ åºŠ DNS ã解決ãããã¡ã€ã³åã§ã¯ãªãæ€èšŒåŸã® IP ã䜿çšããŸãã
URL ã¹ããŒãã®å¶é¶
API ã䜿çšãã URL ã¹ããŒãã ããèš±å¯ããŸããAPI ã«å¿
èŠã§ã¯ãªãå Žåãftp://
ãfile://
ãããã㯠http://
ãæå¹åããå¿
èŠã¯ãããŸããã
å éšãµãŒãã¹ã§ã®èªèšŒã®æå¹å¶
ãããã¯ãŒã¯å éšã§å®è¡ãããŠãããã¹ãŠã®ãµãŒãã¹ã«ã€ããŠãèªèšŒãå¿ èŠãšããŠããªãå Žåã§ãå¿ ãèªèšŒãæå¹åããŸããredisãmongo ãªã©ã®ãµãŒãã¹ã¯ãããã©ã«ãã§ã¯èªèšŒãèŠæ±ããªããããSSRF ã®ã¿ãŒã²ããã«ãªããããããšãæå³ããŸãã
èªèšŒã®è¿œå ã容æã§ã¯ãªãå Žåã匷床ã¯å£ãã容æãªéžæè¢ã¯ãå
éšãµãŒãã¹ã«ã¢ã¯ã»ã¹ããéã«ã«ã¹ã¿ã ããããŒãèŠæ±ããããšã§ããããšãã°ããããããããã¿ãŒã²ããã§ãã Google Cloud ã®ã¡ã¿ããŒã¿ ãµãŒããŒã¯ãçŸåšããªã¯ãšã¹ãã«æ¬¡ã® HTTP ããããŒãå«ãŸããŠããããšãèŠæ±ããŸããMetadata-Flavor: Google
éåžžãSSRF ãªã¯ãšã¹ãã«ã¯ããã®ããããŒã¯å«ãŸããŸããããã®ãããSSRF ãªã¯ãšã¹ãã¯æåŠãããŸããã«ã¹ã¿ã ããããŒãã€ã³ãžã§ã¯ãããã«ã¯ãæ»æè
㯠SSRF è匱æ§ãš CRLF ã€ã³ãžã§ã¯ã·ã§ã³ãé£çµããå¿
èŠããããããæ»æè
ã«ãšã£ãŠã®é£åºŠãäžãããŸãã
ãããã·¶
API ããŠãŒã¶ãŒã®ä»£ããã«ãªã¯ãšã¹ããè¡ãå Žåãå€éšãããã·ã䜿çšããã®ã¯ããèãã§ãããããã·ã¯ãå éšãããã¯ãŒã¯ ãªãœãŒã¹ãžã®ã¢ã¯ã»ã¹ããªãéé¢ããããµãŒããŒã«ãã¹ããããŸããçæ³çã«ã¯ãã¯ã©ãŠã ãããã€ããŒãå©çšããŠãéèŠãªãªãœãŒã¹ãããã®ãšã¯å¥ã®ã¢ã«ãŠã³ãã§ã»ãã ã¢ããããã¹ãã§ãã
ãã¡ã€ã¢ãŠã©ãŒã«ããã³ãããã¯ãŒã¯ ã»ã°ã¡ã³ããŒã·ã§ã³¶
å€ãã® API ãµãŒããŒã¯ãå éšãããã¯ãŒã¯ã®ãã¹ãŠã®ãµãŒãã¹ã«ã¢ã¯ã»ã¹ããæ©èœãå¿ èŠãšããŸããããããã¯ãŒã¯ ã»ã°ã¡ã³ããŒã·ã§ã³ãŸãã¯ãã¡ã€ã¢ãŠã©ãŒã«ã䜿çšãããšãAPI ããå€éšãžã®æ¥ç¶ã«å¯ŸããŠæå°æš©éã®ååãé©çšããSSRF è匱æ§ã®æ·±å»åºŠãæå°åããã®ã«åœ¹ç«ã¡ãŸãã
ãµã³ã㫶
åèè³æ¶
- OWASP: SSRF.
- OWASP: SSRF Prevention Cheat Sheet.
- Common Weakness Enumeration: CWE-918.