ã¯ããã«
ãããã«ã¡ã¯ãmickey-STRANGEã§ããæ¨å¹´ã«æ°åã§ã©ã¯ã¹ã«å ¥ç¤¾ãã¾ãã2å¹´ç®ã§ãã
ãæ°åã«æ¯ãçããç¨åº¦ã®æ°ç±³ã¨ã³ã¸ãã¢ã§ãããä»åã¯ãã®æ°å°ãªãæ¯ã®ä¸ããå¦çæ代ã«æèãããã¨ã®ãªãã£ããã®ã¨ãã観ç¹ã§èå¼±æ§ã®ã話ãé¸ã³ãè¨äºã«ãã¾ãããæ°ããWebéçºä¼æ¥ã«å ¥ç¤¾ããæ°åã®æ¹ã®å¦ç¿ã®æå©ãã«ãªãã°ã¨æãã¾ãã
ç®æ¬¡
- ã¯ããã«
- èå¼±æ§ã¨ã¯ï¼
- CSRF(ã¯ãã¹ãµã¤ããªã¯ã¨ã¹ããã©ã¼ã¸ã§ãª)
- ãããã«
èå¼±æ§ã¨ã¯ï¼
ãèå¼±æ§ã¨ã¯ãã»ãã¥ãªãã£ã®é¢ããã¿ãã·ã¹ãã ã®æ¬ é¥ã®ãã¨ã§ãã èå¼±æ§ãã¤ãã¦æ»æããã¦ãã¾ãã¨ãã¦ã¼ã¶ã«ã¯æ¬æ¥è¨±ããã¦ããªãæä½ãã§ãã¦ãã¾ã£ããããµã¼ãã«ã¦ã£ã«ã¹ãä»è¾¼ã¾ãã¦ãã¾ã£ããã¨ãã被害ãåºã¾ãã
ããã®è¨äºã§ã¯èå¼±æ§ã®ä¸ã§ããç§ãå®éã«ç解ã«æéã®ããã£ã
ã¨ããèå¼±æ§ã®æ¦è¦ã¨å¯¾çããç´¹ä»ãããã¨æãã¾ãã
CSRF(ã¯ãã¹ãµã¤ããªã¯ã¨ã¹ããã©ã¼ã¸ã§ãª)
æ¦è¦
ããµã¼ãã¹ã®å©ç¨è ã«æå³ããªãHTTPãªã¯ã¨ã¹ããéä¿¡ãããå©ç¨è ã®æå³ããªãå¦çããµã¼ãã¹ã«å®è¡ãããæ»æã§ããã¨ã1æã§æ¸ãã¦ã¯ã¿ããã®ã®ãããã ãã§ç解ã¯åºæ¥ãªãã¨æãã¾ã(ç§ãåå¼·ããã¨ãã¯ç解åºæ¥ã¾ããã§ãã)ã®ã§ãshop.example.comã¨ããæ¶ç©ºã®é販ãµã¤ãã§ç°¡åãªä¾ãæãã¦ã¿ã¾ãããã
ãshop.example.comã§ã¯ã¦ã¼ã¶ã¯IDã¨ãã¹ã¯ã¼ãã§ãã°ã¤ã³ãã¾ããå©ç¨ã¦ã¼ã¶ããã¹ã¯ã¼ããå¤æ´ãããã¨ããã¨ãï¼ã¦ã¼ã¶ãæ°ãããã¹ã¯ã¼ããå ¥åãã¦ç¢ºå®ãã¿ã³ãæ¼ããã¨ãï¼ã«éä¿¡ããããªã¯ã¨ã¹ããä¸ã®ãããªãã®ã ã£ãã¨ãã¾ãã
URL ãhttp://shop.example.com/password/change ãã©ã¡ã¼ã¿ ãnew_passï¼ãæ°ãããã¹ã¯ã¼ãã ãnew_pass_confï¼ãæ°ãããã¹ã¯ã¼ã(確èªå ¥åç¨)ã
ããã®ãªã¯ã¨ã¹ãã¨åããã®ãä½æãã¦éä¿¡ãããæªæã®ããWebãã¼ã¸ãæ»æè
ãç¨æãã¾ãã
å½è£
ãªã¯ã¨ã¹ããéä¿¡ããã§ããã°ããã®ã§Webãã¼ã¸ã®ç¨æã¯é£ãããã¨ã§ã¯ããã¾ãããå
·ä½çãªã³ã¼ãã¯ç¤ºãã¾ããããjavascriptã使ã£ã¦æ°è¡ã§å®ç¾åºæ¥ã¾ããGETã§ãããã°ä»ã®æ段ã§ãã£ã¨åç´ã«ãã³ã¼ãã¨ãã¦ã¯1è¡ã§ãååã«å®ç¾ã§ãã¦ãã¾ãã¾ãã(確å®å¦çã§GETã使ç¨ãããã¨èªä½ãè«å¤ã§ããã)
ããã¦ãshop.example.comã®ã¦ã¼ã¶Aããããæ»æè ã®ç¨æããæªæã®ããWebãã¼ã¸ãéãã¦ãã¾ã£ãã¨ãã¾ãããã
ãããã¨Aããã®ãã©ã¦ã¶ããä¸è¨ãªã¯ã¨ã¹ãã¨åããã®ãåæã«éä¿¡ããã¦ãã¾ãã¾ããæ£è¦ã«ãã¹ã¯ã¼ãå¤æ´ç»é¢ã§ç¢ºå®ãã¿ã³ãæ¼ããã¨ãã®ãªã¯ã¨ã¹ãã¨éãã¨ãããããã¨ããã°ããã©ã¡ã¼ã¿ã®ãã¹ã¯ã¼ãé¨åã¯æ»æè
ããç¥ããªããã®ã§ãããã¨ãããã¨ã ãã§ãã
ãã®ã¨ãAããã®ãã©ã¦ã¶ã«ãshop.example.comã«ãã°ã¤ã³ãã¦ããç¶æ
ã®ã»ãã·ã§ã³æ
å ±ããæ®ã£ã¦ããå ´åããã®æ
å ±ããã©ã¦ã¶ãåæã«éä¿¡ãã¦ãã¾ãã¾ãã
ãã®ãªã¯ã¨ã¹ããåãåã£ããµã¼ãå´ã®ããã°ã©ã ã¯Aãããæä½ãåéãã¦ããã¹ã¯ã¼ãã®å¤æ´ç¢ºå®ãã¿ã³ãæ¼ãã
ã¨èª¤èªãããã¹ã¯ã¼ãå¤æ´ã®å¦çãè¡ã£ã¦ãã¾ãã¾ãããã¹ã¯ã¼ãå¤æ´ã®å¦çãå®äºããã¨Aããã¯ãããã°ã¤ã³åºæ¥ãªããªã£ã¦ãã¾ãã¾ãã
ãCSRFã¯ãã°ã¤ã³æ¸ã¿ã®ã¦ã¼ã¶ã«ãæå³ããªãæä½ãå¼·å¶çã«å®è¡ããã¦ãã¾ãæ»æ
ã§ããã¨ããã¾ãã
ãä»åã®ä¾ã§ã¯ãã¹ã¯ã¼ãå¤æ´ã§ããããããè³¼å ¥ã決æ¸ã®ç¢ºå®å¦çã§èµ·ãã¦ãã¾ãã¨åãè¿ããã¤ããªãã¨ãããã¨ã¯ç°¡åã«æ³ååºæ¥ãã¨æãã¾ããã§ã¯CSRFãã©ã®ãããªèå¼±æ§ãåãã£ãã¨ããã§ãCSRFæ»æãé²ãããã«ã©ã®ãããªä»çµã¿ãå ¥ããã°ããããèãã¦ã¿ããã¨æãã¾ãã
対ç
ãã§ã¯CSRFã®å¯¾çãèãã¦ã¿ã¾ãããã
ä¸è¨ã®éããCSRFã«ããã¦ãµã¼ãã¯ãªã¯ã¨ã¹ãéãã«1ã¤ã®æ©è½ãæ£ããå®äºãã¦ãã
ã¨ããç¹å¾´ãããã¾ããã¤ã¾ã対çã¨ãã¦èããããã®ã¯åãåã£ããªã¯ã¨ã¹ãã«å¯¾ãã¦å¦çãå®è¡ãããããªããã確èªãã
ãã¨ã«ãªãã¾ãã
確å®å¦çã®åã«èªè¨¼ãè¡ã
ãä¸çªåãããããæ¹æ³ã¯ã¦ã¼ã¶ã«ç¢ºèªãã¦ããããã¨ã§ããéè¦ãªå¦çã®åã«ã¯ã¦ã¼ã¶ã«ããä¸åº¦èªè¨¼ãè¡ããã¤ã¾ããã°ã¤ã³IDã¨ãã¹ã¯ã¼ãã®å ¥åããã¦ããããã¨ã«ãªãã¾ããä»åã®ãã¹ã¯ã¼ãå¤æ´ã®ä¾ã§ãã¨ã以ä¸ã®ããã«ãªãã¾ãã(æ°åãã¦ã¼ã¶æä½ãâããµã¼ãå¦çã§ãã)
1.æ°ãããã¹ã¯ã¼ããå ¥åãã¦ç¢ºå®ãã¿ã³ 2.èªè¨¼ç»é¢ã§ãã°ã¤ã³IDã¨ãã¹ã¯ã¼ããå ¥å ãâå¤æ´å¦çãè¡ã
ããã®é çªã§æä½ãã¦ãããããã«ãªã£ã¦ããã°ãä»åã®ä¾ã®ããã«1çªã®ãªã¯ã¨ã¹ããå½è£ ããã¦ãå¦çãè¡ã£ã¦ãã¾ããã¨ã¯ããã¾ããã
ããããããã®æ¹æ³ã§å¯¾çããã¨ã¦ã¼ã¶ã®æä½ãå¢ãã¦ãã¾ãã¾ãã大äºãªå¦çã®åã ãã¨ãã¦ããã¦ã¼ã¶ã®æä½éãå¢ãã¦ãã¾ã£ãããç´æçã«é²ããªãç»é¢ã表示ãããã¨ããã®ãµã¤ãã¯ä½¿ãã«ãããé¢åã ãã¨æãã¦ãã¾ãããããã¾ãããã¦ã¼ã¶ã«è² æ ããé¡ãããããªããã¨ãããã¨ã§æ¬¡ã«ããã°ã©ã å´ã ãã§åºæ¥ã対çãèãã¦ã¿ã¾ãã
ãªãã¡ã©ã確èªãã
ãã¦ã¼ã¶æä½ãå¢ãããã«åºæ¥ãCSRF対çã¯ãéããã¦ãããªã¯ã¨ã¹ããæ£ãããã®ã確èªããããã¨ã§ããããã§æ£ãããªã¯ã¨ã¹ãã¨ã¯ããµã¤ãå
ã«ãã確å®ãã¿ã³ãæ¼ããã¨ã§éä¿¡ããããªã¯ã¨ã¹ã
ã¨ãããã¨ã«ãªãã¾ããããã確èªããããã«ããªãã¡ã©ã¨ããHTTPãããã®1ã¤ãå©ç¨ãã¾ãã
ããªãã¡ã©ã¨ã¯ããªã¯ã¨ã¹ãå
ã®ãã¼ã¸ã®URL
ã示ãHTTPãããã§ããå¦çã®åã«ãªãã¡ã©ã®å¤ãhttp://shop.example.com
ããå§ã¾ã£ã¦ãããã確èªããã°ãå½è£
ãªã¯ã¨ã¹ããã©ããå¤å®ãããã¨ãå¯è½ã§ãã
1.æ°ãããã¹ã¯ã¼ããå ¥åãã¦ç¢ºå®ãã¿ã³ ãâãªãã¡ã©ã®ãã§ãã¯ãè¡ã ãâå¤æ´å¦çãè¡ã
ããããããã®æ¹æ³ã§ã¯ã¾ã å®ç§ãªå¯¾çã§ã¯ããã¾ããããªãã¡ã©ã¯ãã®ç¹æ§ä¸ããã©ã¤ãã·ã¼é¢ã«åé¡ãæ±ãã¦ããããã©ã¦ã¶ã®ã§ãªãã¡ã©ãéä¿¡ããªãè¨å®ãå¯è½ã§ããã¾ããåè¿°ã®ã¨ããããªãã¡ã©ã¯HTTPãããã®1ã¤ã§ããæ¹ç«ããã¦ãã¾ã£ã¦ã¯å ãåãããã¾ããã
ã¯ã³ã¿ã¤ã ãã¼ã¯ã³ãå©ç¨ãã
ãã¯ã³ã¿ã¤ã ãã¼ã¯ã³ã¨ã¯ããªã¯ã¨ã¹ããæ£ãããã®ãå¤æããããã®æååããªã¯ã¨ã¹ãã®ä¸ã«ä»è¾¼ãææ³ã§ãã
ãä»åã®ãã¹ã¯ã¼ãå¤æ´ã®ä¾ã§ãã¨ã以ä¸ã®ãããªæµãã«ãªãã¾ãã
0.ãã¹ã¯ã¼ãå¤æ´ç»é¢ãéã ãâä¹±æ°æåå(ãã¼ã¯ã³)ãçæ 1.æ°ãããã¹ã¯ã¼ããå ¥åãã¦ç¢ºå®ãã¿ã³(ãã¼ã¯ã³ãä»ä¸ãããªã¯ã¨ã¹ããéä¿¡) ãâãµã¼ãå´ã§ä¿æãã¦ããããã¼ã¯ã³ã¨ãªã¯ã¨ã¹ãã§éä¿¡ããããã¼ã¯ã³ã®æ¯è¼ãè¡ã ãâå¤æ´å¦çãè¡ã
ããã¹ã¯ã¼ãå¤æ´ç»é¢ãéãéã«ãã¼ã¯ã³(ä¹±æ°æåå)ãä½æããã»ãã·ã§ã³ãªã©ã®ãµã¼ãå´ã®é åã§ä¸æä¿åãã¦ããã¾ããã¾ãã確å®ã®ãªã¯ã¨ã¹ãã®æã«ãã®ãã¼ã¯ã³ããã©ã¡ã¼ã¿ã«è¿½å ãã¦éä¿¡ããããµã¼ãå´ã§ãã¼ã¯ã³ã®ç §åãè¡ãã¾ãããµã¼ãå´ã§ä¿åãã¦ãããã¼ã¯ã³ã¨ä¸è´ããã°å¦çãè¡ããä¸è´ããªããã°ä¸æ£ãªãªã¯ã¨ã¹ãã¨ãã¦å¦çãè¡ããªããã¨ãã£ãå¤æãå¯è½ã¨ãªãã¾ãã
ãå½è£ ãªã¯ã¨ã¹ãããããã¼ã¯ã³ãåæã«ä»ä¸ãããªã¯ã¨ã¹ããéä¿¡ãã¦ããµã¼ãå´ã§åããã¼ã¯ã³ãä¿æãã¦ããªãã®ã§å¤å¥ã§ãã¾ããããªãã¡ã©ã¨ã¯éããããã§ã¯ãªããã©ã¡ã¼ã¿ãªã®ã§ã¦ã¼ã¶ä¾åã§å¤±æããããããã¨ãããã¾ãããä»åç´¹ä»ããä¸ã§ã¯ãã®ææ³ãæãé©åã ã¨ãããã§ãããã
ãããã«
ãCSRFã®æ¦è¦ã¨å¯¾çã«ã¤ãã¦ãç´¹ä»ãããã¾ããããããã§ããã§ããããã XSS(ã¯ãã¹ãµã¤ãã¹ã¯ãªããã£ã³ã°)ã¨ååãä¼¼ã¦ãããã¨ã§åéãããããèå¼±æ§ã§ãèªåãç解ãã¥ããã£ãCSRFã«ã¤ãã¦è¨äºã«ãã¦ã¿ã¾ããã
ãWebéçºã«é¢ããåå¼·ãå§ããã°ããã®æ¹ã®æå©ãã«ãªãã°å¹¸ãã§ãã
ã¨ã³ã¸ãã¢ä¸éæ¡ç¨ãµã¤ã
ã©ã¯ã¹ã§ã¯ãã¨ã³ã¸ãã¢ã»ãã¶ã¤ãã¼ã®ä¸éæ¡ç¨ãç©æ¥µçã«è¡ã£ã¦ããã¾ãï¼
ãèå³ããã¾ãããæ¯éã確èªããé¡ããã¾ãã
https://career-recruit.rakus.co.jp/career_engineer/ã«ã¸ã¥ã¢ã«é¢è«ãç³è¾¼ã¿ãã©ã¼ã
ã©ã®è·ç¨®ã«å¿åããã°è¯ããããããªãã¨ããæ¹ã¯ãã«ã¸ã¥ã¢ã«é¢è«ãéæè¡ã£ã¦ããã¾ãã
以ä¸ãã©ã¼ã ãããç³è¾¼ã¿ãã ããã
forms.gleã¤ãã³ãæ å ±
ä¼ç¤¾ã®é°å²æ°ãç¥ãããæ¹ã¯ãæ¯é±éå¬ãã¦ããã¤ãã³ãã«ãåå ãã ããï¼ rakus.connpass.com