ä»å¤ã¤ãã HTTPã¬ã¹ãã³ã¹ãããã¼ ï¼ã»ãã¥ãªãã£ç·¨ï¼
Webãµã¼ãã¼ãã¬ã¹ãã³ã¹ãçºè¡ããéã«ãHTTPã¬ã¹ãã³ã¹ãããã¼ã«ä»ããã¨ã»ãã¥ãªãã£ã¬ãã«ã®åä¸ã«ã¤ãªãããããã¼ãã£ã¼ã«ããç´¹ä»ãã¾ãã
å²ã¿å
ã¯æ¨å¥¨ããè¨å®ã®ä¸ä¾ã§ãããã©ã¦ã¶ã«ãã£ã¦ã¯å¯¾å¿ãã¦ããªããããã¼ãã£ã¼ã«ãããªãã·ã§ã³ãªã©ãããã¾ãã®ã§ãã¯ã©ã¤ã¢ã³ãã®ç°å¢ã«ãã£ã¦ã¯æ©è½ããªããã¨ãããã¾ãã
X-Frame-Options
ãã©ã¦ã¶ã frame ã¾ã㯠iframe ã§æå®ãããã¬ã¼ã å ã«ãã¼ã¸ã表示ãããã¨ãå¶å¾¡ããããã®ãããã¼ãã£ã¼ã«ãã§ãã主ã«ã¯ãªãã¯ã¸ã£ããã³ã°ã¨ããæ»æãé²ãããã«ç¨ãããã¾ãã
X-Frame-Options: SAMEORIGIN
- DENY ãã¬ã¼ã å ã«ãã¼ã¸ã表示ãããã¨ãç¦æ¢ï¼åããµã¤ãå ã§ãã£ã¦ãç¦æ¢ã§ãï¼
- SAMEORIGIN èªåèªèº«ã¨çæå ãåããã¬ã¼ã ã®å ´åã«ãã¼ã¸ã表示ãããã¨ã許å¯ï¼ä»ã®ãµã¤ãã«ç¦æ¢ãããå ´åã¯ä¸»ã«ããã使ç¨ãã¾ãï¼
- ALLOW-FROM origin_uri æå®ãããçæå ã®ã¿ãã¼ã¸ã表示ãããã¨ã許å¯ï¼ç¹å®ã®ãµã¤ãã®ã¿ã«è¨±å¯ãããå ´åã¯ããã使ç¨ãã¾ãï¼
X-Content-Type-Options
script ã¾ã㯠stylesheet ã§èªã¿è¾¼ããã¡ã¤ã«ã® MIME ã¿ã¤ããæ£ããï¼è¨±å¯ãããï¼ãã®ã¨ä¸è´ããªãéããã¡ã¤ã«ãèªã¿è¾¼ã¿ã¾ãããéHTMLãHTMLã¨è¦ãªããªã©ãã³ã³ãã³ãå 容ã®èª¤å¤å®ãå©ç¨ãã XSS ãªã©ã®æ»æãé²ãããã«ç¨ãããã¾ãã
X-Content-Type-Options: nosniff
機密情報を含むJSONには X-Content-Type-Options: nosniff をつけるべき - 葉っぱ日記
MIME タイプのセキュリティ リスクの軽減 (Windows)
X-XSS-Protection
ãã©ã¦ã¶ã® XSSãã£ã«ã¿ã¼ã®æ©è½ãæå¹ã«ããXSSæ»æãé²ãããã«ç¨ãããã¾ãã
X-XSS-Protection: 1; mode=block
- 0 XSSãã£ã«ã¿ã¼ãç¡å¹
- 1 XSSãã£ã«ã¿ã¼ãæå¹ï¼IE,Chromeã®å ´å㯠1; mode=block ã使ããï¼
2008/7/2 - IE8 Security Part IV: The XSS Filter
IE8 XSS Filterの仕様が微妙に変更されていた。 - 葉っぱ日記
Content-Security-Policy
å¤é¨ã®ãªã½ã¼ã¹ãä¿¡é ¼ã§ããçæå
以å¤ããèªã¿è¾¼ããªãããã«å¶éãããã¨ãã§ãã¾ããXSSããã¼ã¿ã¤ã³ã¸ã§ã¯ã·ã§ã³æ»æãæ¤åºãã¦è»½æ¸ãããã¨ãããã¾ããï¼ãã ããè¨å®ã«ãã£ã¦ã¯å¤é¨ãªã½ã¼ã¹ãèªã¿è¾¼ããªãããã«ãããã¨ã«ãã£ã¦ãç¾å¨åä½ãã¦ããã¹ã¯ãªãããåããªããªãå¯è½æ§ãããã¾ããï¼
以åã¯ã"X-Content-Security-Policy" ã¨ãããããã¼ãã£ã¼ã«ãåã使ã£ã¦ãã¾ããã
Content-Security-Policy: default-src 'self'
- default-src 'self' åããªãªã¸ã³ï¼åãURLã¹ãã¼ã ããã¹ãããã¼ãçªå·ï¼ããã¯ãã¹ã¦ã®ã³ã³ãã³ããèªã¿è¾¼ãããã«ãããå ´å
- default-src 'self' *.example.com æå®ãããã¡ã¤ã³ã¨ãã¹ã¦ã®ãµããã¡ã¤ã³ããã®ã³ã³ãã³ãã許å¯ãããå ´å
X-Permitted-Cross-Domain-Policies
ãcrossdomain.xml ãï¼Flash ã³ã³ãã³ãããå¥ãã¡ã¤ã³ã«ãããã¡ã¤ã«ãèªã¿è¾¼ãéã«å¿ è¦ã«ãªãè¨å®ãè¨è¿°ããããªã·ã¼ãã¡ã¤ã«ï¼ããµã¤ãã®ããã¥ã¡ã³ãã«ã¼ãã«ç½®ããã¨ãã§ããªãå ´åãªã©ã«ãåæ§ã®å¹æãçºæ®ãããã¨ãã§ãã¾ãã
X-Permitted-Cross-Domain-Policies: master-only
- master-only ãã¹ã¿ã¼ããªã·ã¼ãã¡ã¤ã«ï¼ /crossdomain.xmlï¼ã®ã¿ã許å¯ããã
Strict-Transport-Security
æå®ããããµã¤ãã常㫠HTTPS ãããã³ã«ã使ã£ã¦ã¢ã¯ã»ã¹ããããã«ãã©ã¦ã¶ã«æ示ãã¾ããHTTPã®ãµã¤ãããHTTPSã«ãªãã¤ã¬ã¯ãããããå®å ¨ã«èªå°ããæ¹æ³ã§ãã
Strict-Transport-Security: max-age=31536000; includeSubDomains
- max-age STSãæå¹ã«ããæéãæ³å®ãããå訪åã®æéããéãã«é·ãç®ã«è¨å®ããæ¹ããã
- includeSubDomains ãµããã¡ã¤ã³ã«ãã«ã¼ã«ãé©ç¨ããã
HTTP Strict Transport Security - The Chromium Projects
HTTP Strict Transport Security - Security | MDN
Access-Control-Allow-Origin ãªã© CORS é¢é£
XMLHttpRequestã使ã£ã¦ãä»ã®ãã¡ã¤ã³ãªã©ãããªã½ã¼ã¹ãåå¾ãããã¯ãã¹ãã¡ã¤ã³éä¿¡ããããå ´åã«æå®ãã¾ãã使ãå ´åã«ã¯è©³ããã¯CORS (Cross-Origin Resource Sharing)å§åãªã©ãåèã«ãã¦ä¸ããã
Access-Control-Allow-Origin: http://www.example.com
Access-Control-Allow-Methods: POST, GET, OPTIONS
Access-Control-Allow-Headers: X-TRICORDER
Access-Control-Max-Age: 1728000
ä¸è¨ã¯ "http://www.example.com" ããã®ã¯ãã¹ãã¡ã¤ã³éä¿¡ããããå ´åã®è¨å®ã§ãå½è©²ãªã½ã¼ã¹ã¸ã®åãåããã«ã¯ POST, GET, OPTIONS ãå®è¡å¯è½ãªã¡ã½ãããã«ã¹ã¿ã ãããã¼ã¨ã㦠"X-TRICORDER" ãä»ãããªã¯ã¨ã¹ããéä¿¡ããããªãã©ã¤ãã®ã¬ã¹ãã³ã¹ããã£ãã·ã¥ãã¦ããæéã 1,728,00 ç§ã ã¨ãããã¨ã表ãã¦ãã¾ãã
HTTP access control (CORS) | MDN
X-Download-Options
ã¦ã¼ã¶ã¼ããã¦ã³ãã¼ããããã¡ã¤ã«ãç´æ¥"éã"ãã¨ãé²æ¢ãããå ´åã«æå®ãã¾ãã
X-Download-Options: noopen
- noopen IE8以éã§ã¯ã¦ã¼ã¶ã¼ã¯ãã¡ã¤ã«ãç´æ¥éããã¨ãã§ããããã¼ã«ã«ã«ä¿åãããã¨ã«ãªãã¾ãããã¦ã³ãã¼ãã®ãã¤ã¢ãã°ãã"éã"ããªããªãã¾ãã
IE8 Security Part V: Comprehensive Protection - IEBlog - Site Home - MSDN Blogs
Set-Cookie
Cookie ãã»ãããã¾ãããµã¼ãã¼ãã¯ã©ã¤ã¢ã³ãã«å¯¾ãã¦ç¶æ 管çãå§ããéãªã©ã«ãã¾ãã¾ãªæ å ±ãä¼ãã¾ãã
- secure HTTPSã§éä¿¡ãã¦ããå ´åã«ã®ã¿ Cookie ãéä¿¡ãã
- HttpOnly Cookie ã JavaScript ããã¢ã¯ã»ã¹ã§ããªãããã«ãã
- path å±æ§ã¯ Cookie ãéåºãããã£ã¬ã¯ããªãéå®ããæå®ã§ãããåé¿ããæ¹æ³ãããã»ãã¥ãªãã£æ©æ§ã¨ãã¦ã¯æå¾ ã§ãã¾ããã
- domain å±æ§ã¯å¾æ¹ä¸è´ã«ãªãã¾ããæ示çã«è¤æ°ãã¡ã¤ã³ã«å¯¾ã㦠Cookie ãéåºããå ´åãé¤ãã¦ããã®å±æ§ã¯è¨å®ããªãæ¹ãå®å ¨ã§ãã
Cache-Control
ãã£ã¬ã¯ãã£ãã¨å¼ã°ããã³ãã³ããæå®ãããã¨ã§ããã©ã¦ã¶ã®ãã£ãã·ã³ã°åä½ãæå®ãã¾ãã
Cache-Control: no-cache, no-store, must-revalidate
- no-cache ãã£ãã·ã¥ãµã¼ãã¼ã¯ãªã½ã¼ã¹ãæ ¼ç´ãã¦ã¯ãªããªããã¾ãæå¹æ§ã®å確èªãªãã§ã¯ãã£ãã·ã¥ã使ç¨ãã¦ã¯ãªããªã
- no-store ãã£ãã·ã¥ã¯ãªã¯ã¨ã¹ãã»ã¬ã¹ãã³ã¹ã®ä¸é¨åããã¼ã«ã«ã¹ãã¬ã¼ã¸ã«ä¿åãã¦ã¯ãªããªã
- must-revalidate ãã£ãã·ã¥å¯è½ã§ãããããªãªã¸ã³ãµã¼ãã¼ã«ãªã½ã¼ã¹ã®å確èªãè¦æ±ãã
pragma
HTTP/1.0ã¨ã®å¾æ¹äºææ§ã®ããã ãã«å®ç¾©ããã¦ãããããã¼ãã£ã¼ã«ãã§ãæ¬æ¥ã¯ã¯ã©ã¤ã¢ã³ãããã®ãªã¯ã¨ã¹ãã®ã¿ã«ä½¿ç¨ããã¾ãã"Cache-Control: no-cacheâã¨ä½µè¨ããã¨ããã§ãããã
pragma: no-cache
- no-cache ã¯ã©ã¤ã¢ã³ãããã¹ã¦ã®ä¸éãµã¼ãã¼ã«å¯¾ãã¦ããã£ãã·ã¥ãããå¿çãæã¾ãªããã¨ãè¦æ±ãã
expires
ãªã½ã¼ã¹ã®æå¹æéã®æ¥æãä¼ãã¾ãããã£ãã·ã¥ããããã¨ãæã¾ãªãå ´åã«ã¯ãDate ãããã¼ãã£ã¼ã«ãã®å¤ã¨åãã«è¨å®ãããã"-1"ã¨è¨å®ãã¾ãã
expires: -1
content-type
ã¨ã³ãã£ãã£ããã£ã«å«ã¾ãããªãã¸ã§ã¯ãã®ã¡ãã£ã¢ã¿ã¤ããä¼ãã¾ããcharsetã§ã¯æåã»ãããæå®ãã¾ããæ£ããã¡ãã£ã¢ã¿ã¤ãã®è¨å®ã¨ãæ£ããæåã³ã¼ããæ£ãã表è¨ã§è¨å®ãã¾ãããã
content-type: text/html;charset=utf-8
HTTPã¬ã¹ãã³ã¹ãããã¼ã®è¨å®ã®ä»æ¹
Apache ã§è¿½å ããå ´åã«ã¯ãhttpd.conf ã®ä¸ã§ä¸è¨ã®ã¢ã¸ã¥ã¼ã«ãæå¹ã«ãªã£ã¦ããå¿ è¦ãããã¾ãã
- LoadModule headers_module modules/mod_headers.so
常ã«è¡¨ç¤ºãã HTTP ã¬ã¹ãã³ã¹ãããã¼ã追å ããã«ã¯ãä¸è¨ã®ããã«è¨å®ãè¡ãã¾ãã
Header set HeaderFieldName "value"
Header set X-XSS-Protection "1; mode=blockâ
ã¿ã¤ãã«ã¯ãæèã今夜わかるHTTPãããã§ããããHTTPの教科書ãã®æ¹ãæ°ããæ¬ã§ããã¾ããã»ãã¥ãªãã£ç·¨ã¨ãã¦ã¾ãããã¶ãå®çµã§ãã2ã«ç¶ããâ¦ï¼
ãæè¦ãªã©ãå¾
ã¡ãã¦ãã¾ãããã®ãã¡ OWASP Japan ã® OWASP Night ã§ãç´¹ä»ããããã
- HTTPã®æç§æ¸
- çºå£²å : ç¿æ³³ç¤¾
- ä¾¡æ ¼: ï¿¥ 2,730
- çºå£²æ¥: 2013/05/25
追è¨
2013/12/01 "Access-Control-Allow-Origin"ãªã©CORSé¢é£ã"X-Download-Options"ã追è¨ãã¾ããããã®ä»èª¬æã微修æ£ãã³ã¡ã³ãé ãã @hasegawayosuke ããã@kinugawamasato ããã@ockeghem ããã@hirayasu ãããããã¨ããããã¾ãã