ãã®è¨äºã¯æ å ±ã»ãã¥ãªãã£ç³»è«æç´¹ä» Advent Calendar 2016ã®20æ¥ç®ã®è¨äºã§ããå³å¯ã«ã¯ããã¼ã«ã«ãããã¯ã¼ã¯ã§ã®HTTPSã«ã¤ãã¦é¢å¿ã®ãã人ã®éã§ãã£ã¦ããã»ãã¥ãªãã£åå¼·ä¼ã(notæ£å¼å称)ã®8æã®åã®çºè¡¨ãã¿ã®rewriteã§ããrewriteã§æ¸ããããã¨ã¯æã£ãããã©ããè¦ããå¨ãã¯ã»ãã¥ãªãã£æ¹é¢ã§åãç¥ããã¦ãå¼·ã人ã°ã£ããã ãå 容ãããããå¦è¡è«æã°ã£ããã§ã¡ãã£ã¨ééããããªã¼ã¨ããæãã§ããã¾ããã£ã¦ã¿ã¾ããã¾ãã»ãã¥ãªãã£ç 究è ãã©ããã¸ããæ稿ã®ç®æ¨ã«ãã¦ãããã®ææ¨ãããã£ãã®ã¯ã§ããã
ã¨ããããã§ã¿ã¤ãã«ã®éããBlack Hat USA 2016ã§çºè¡¨ãããHTTPSã®èå¼±æ§ã HEIST: HTTP Encrypted Information can be Stolen through TCP-windows ã®overviewã§ãã
TL;DR
- HTTP, SSL/TLS, TCPã¨ããã«å¯¾ãããã©ã¦ã¶ã®ã¤ã³ã¿ã¼ãã§ã¼ã¹ãå©ç¨ãã¦ãcross-origin responseã®é·ããå²ãåºãææ³
- å§ç¸®ãå©ç¨ããTLSã¸ã®æ»æææ³(CRIME, BREACH)ãman-in-the-middleãªãããã©ã¦ã¶ã®ã¿ã§å®è¡ãããã¨ãã§ãã
- HTTP/2ã§ãåæ§ã®æ»æãå¯è½ãããã«HTTP/2ã®ã»ããæ»æãããããªãæ¡ä»¶ããã
- ï¼ã¨ã¯ããããHTTPSã¯æ»ãã ãã¨ããã®ã¯é大åºåæ°å³ï¼
ä½ããããã®ï¼
ä»ã¾ã§ã®å§ç¸®ãã¼ã¹ã®TLSæ»æææ³ã¯man-in-the-middleãåãããã¨ãåæã¨ãã¦æç«ãã¦ããï¼ï¼å³å¯ã«ã¯éãï¼ã
- CRIME - "1st requirement: the attacker can sniff on your network traffic"
- BREACH - "The Setup. We assume the attacker has the ability to view the victim's encrypted traffic."
ãã®ææ³ã¯ãã®åæãç·©åããããã®ææ³ã
CRIMEæ»æ
Compression Ration Info-leak Made Easyã®ç¥ã
ãã¼ã¿å§ç¸®ãè¡ãHTTPS/SPDYä¸ãæµããCookieã®å 容ã復å ããã»ãã·ã§ã³ãã¤ã¸ã£ãã¯ãå®ç¾ããã
- æ»æè ãæå·æã®é·ããè¦ããã㨠+ åæã«ãã©ã¦ã¶ããè¤æ°ã®æä½ããããªã¯ã¨ã¹ããéãããã¨ãåæã«ãæå·æã®é·ããå©ç¨ãã¦å¹³æãå²ãåºãææ³
DEFLATEå§ç¸®ã¯LZ77ã¨ãããã³ç¬¦å·åã使ãããããã¯å ±éã®é¨åæååãããã¨å§ç¸®ãå¹ãã
LZ77ã®ä¾: Google is so googley -> Google is so g(-13, 5)y
ãã®æ§è³ªãç¨ãã¦ããå®éã®Cookieã+ãäºæ³ãã®çµã¿åããããªã¯ã¨ã¹ãããå§ç¸®ãå¹ããããäºæ³ãã®å 容ã¯å®éã®Cookieå ã«åå¨ããï¼âç¹°ãè¿ãã¦å ¨ä½ããäºæ³ãï¼
ï¼ã»ãã¨ã¯ããã¡ãã£ã¨è¤éï¼
BREACHæ»æ
Browser Reconnaissance and Exfiltration via Adaptive Compression of Hypertextã®ç¥ãããæãã¤ããªã
CRIMEæ»æã®HTTPS + HTTP compression(gzip, DEFLATE)ã«å¯¾ããã´ã¡ãªã¨ã¼ã·ã§ã³ã
CRIMEæ»æãHTTP requestã«å¯¾ãã¦æ»æããã®ã«å¯¾ããBREACHæ»æã¯HTTP responseã«å¯¾ãã¦æ»æãããããªã¯ã¨ã¹ãã®ä¸é¨ãã¬ã¹ãã³ã¹ã«åæ ããã(reflected)ãã¨ãå©ç¨ããã
HEISTæ»æã«ä½¿ãããéå ·
- Service Workersã®Fetch API : XMLHttpRequestã¨éã(Eventã®ä»£ããã«)Promiseãç¨ãããPromiseã®è§£æ±ºã¯ã¬ã¹ãã³ã¹ã®ç¬¬1ãã¤ãã帰ã£ã¦ããæç¹ãã¾ã ã¹ããªã¼ãã³ã°ä¸ã®ã¬ã¹ãã³ã¹ã«å¯¾ãã¦æä½ãã§ããã
- TCP Slow Start Algorithm : ã¬ã¹ãã³ã¹ã¯Maximum Segment Size(MSS)åä½ã«åå²ãããæåã¯initial congestion windowã®åæ°ã®ã»ã°ã¡ã³ãå(ã ãããã®å ´å10)ã ãéä¿¡ãããACKãæ¥ããã¨ã«congestion windowãå°ããã¤å¤§ãããã¦å¸¯åãå¢ããã¦ãã
ï¼ãã¡ãã®å³ã¯åè«æããï¼
ææ³ã®å¤§éæãªæ¦è¦
- Promiseã®è§£æ±ºã¨çµäºã®ã¿ã¤ãã³ã°ãããã(Resource Timing APIã使ãã¨ä¾¿å©)ã®ã§ãã¬ã¹ãã³ã¹ã«ããã£ãéä¿¡æéãããã
- ããã«ãã£ã¦ãã¬ã¹ãã³ã¹ã1 windowã«åã¾ã£ããã2 window以ä¸ã«ãªã£ãããããã
- ãªã®ã§ãã¬ã¹ãã³ã¹ã«reflectããããããªå¤ã®é·ããå°ããã¤ããã£ã¦å¢çå¤ãæ¢ããã¨ã§ãæ¬æ¥ã®ã¬ã¹ãã³ã¹ã®é·ããããã
2 window以ä¸ã®å ´åã¯ï¼
- TCP Slow Startã«ã¯window sizeãå¢ããæ¹æ³ããããACKããããã±ãã1ã¤ã«ã¤ãcongestion windowã¯1大ãããªãã
- ãªã®ã§ããã±ããæ°xã«ãªãããå¶å¾¡ããããªã¯ã¨ã¹ãããããããéã£ã¦ããããããããcongestion windowã®å¤§ãããæä½ãã¦ãããã¨ãã§ãã
- ãªãã¨ããããã¨é·ãã®æ¢ç´¢ç©ºéã¯1 window(>= 10 MSS)ã§ã¯ãªã1MSS(=1460 bytes)ã«ãªã
HTTP/2ã®å ´åã¯ï¼
- HTTP 1.1ã¨ã¯ãã±ããã®ãã¬ã¼ã ãéã/éããæ¹ãéãã®ã§ãªã¼ãã¼ãããã®è¨ç®ãã¡ãã£ã¨éã
- settingsãã¬ã¼ã : Apache, nginxã®ããããã®å ´åã§æ°ã¨é·ããäºæ³å¯è½
- headersãã¬ã¼ã : HPACKã«ãã£ã¦æ¢ã«éãããå¤ã1ãã¤ãã®indexã«å§ç¸®ããããã¨ã«ãã£ã¦ãHTTP 1.1ãããé·ããäºæ³ãããã
ã»ãã¨ããªã - HTTP/2ã§ã¯è¤æ°ã®ãªã½ã¼ã¹ã並åã«ãªã¯ã¨ã¹ããããã¨ãã§ããããããã¿ã¼ã²ããã®ãªã½ã¼ã¹ãã¨ãreflectionãå«ããªã½ã¼ã¹ãã並åã«ãªã¯ã¨ã¹ããããã¨ãã§ãã
- ãããã¯åãTCP connectionã§è¡ããTCP windowãå ±æãã
- ãã£ã¦ãreflectionãå«ããªã½ã¼ã¹ã§TCP windowãæ¶è²»ããããé·ã調æ´ããããã¨ã§ã¿ã¼ã²ãããªã½ã¼ã¹ã®é·ããå²ãåºãã
ããããreflectionãã¾ããããããªãã®ï¼
- BREACHã§ç´¹ä»ããã¦ããOutlook Web Accessã®ä¾ã§ã¯query stringã«å ¥ã£ã¦ããidã®å¤ãbodyä¸ã«ç¾ãããã¨ãå©ç¨ãã¦ãã
- æ£ç´ãã®åæãããªãç¡çãããªæ°ããããâ¦URLã®ä¸é¨ããããã¯ãªã¯ã¨ã¹ãããURLãbodyã«å ¥ãã®ã¯ãããã¡
å®éã®æ»æä¾
- BREACHæ»æã«ã¤ãªãã
- æ¤ç´¢ã¨ã³ããã¤ã³ãã«å¯¾ãã¦HEIST + BREACHæ»æããããã¨ã§ãæ¤ç´¢å¯¾è±¡ã«ãã¹ã¯ã¼ãã¨ãã¯ã¬ã¸ããã«ã¼ãæ
å ±ãå
¥ã£ã¦ãããããæãåºãã
- ã¯ã¬ã«æ å ±ãã¡ã¼ã«ã«å«ãããªãã¨ãã話ã¯ãã¦ããâ¦
対ç
- æãæå¹ãªå¯¾çã¯3rd-party Cookieã®ç¡å¹åãæ»æè ã®ãµã¤ããè¸ãã ã3rd-party Cookieã®å 容ãåæ ããcross-origin requestã®ä¸èº«ãæããã¦ããã¨ããç¶æ³ãé²ããã
- ãã®ã»ãã«ãããã¤ãã®ææ³ãæ示ããã¦ããããã©ãããå®å ¨ã§ã¯ãªããã¨ã®ãã¨ã
ç§è¦
- æ¢åã®æ»æææ³ã®åæãç·©ãããã¨ã§ãã®ææ³ãå度注ç®ãæµ´ã³ããã¨ããã®ãããããç¹ã«ã"man-in-the-middleãå¿ é ã§ã"ã¨ç´¹ä»ãããã¡ãªã¨ãããæ¬å½ã¯ãé·ãç¥ãã ãã§ååãã ã£ããã¨ãããæ¢åã®æ»æææ³ã®æ¬è³ªãæãè¿ããã®ãããã«ããã
- ã§ããã©ã¡ã¼ã¿ã®reflectionãã©ããããã®ãµã¤ãã«æå¹ãªã®ãã¯å¾®å¦ãªæ°ããé大åºåã®ãããããï¼
åèæç®
- Mathy Vanhoef and Tom Van Goethem, "HEIST: HTTP Encrypted Information can be Stolen through TCP-windows", 2016.
- Yoel Gluck, Neal Harris, and Angelo Prado, "BREACH: REVIVING THE CRIME ATTACK", 2013.
- Thai Duong and Julianno Rizzo. "The CRIME attack", 2012.