»ùÓÚiframeµÄCFS(Cross Frame Script)ºÍClickjacking(µã»÷½Ù³Ö)¹¥»÷
¹¥»÷ÔÀí£º
CFS¹¥»÷(Cross Frame Script(¿ç¿ò¼Ü½Å±¾)¹¥»÷)ÊÇÀûÓÃä¯ÀÀÆ÷ÔÊÐí¿ò¼Ü(frame)¿çÕ¾°üº¬ÆäËüÒ³ÃæµÄ©¶´£¬ÔÚÖ÷¿ò¼ÜµÄ´úÂë
ÖмÓÈëscirpt£¬¼àÊÓ¡¢µÁÈ¡Óû§ÊäÈë¡£
Clickjacking(µã»÷½Ù³Ö) ÔòÊÇÊÇÒ»ÖÖÊÓ¾õÆÛÆÊֶΣ¬ÔÚweb¶Ë¾ÍÊÇiframeǶÌ×Ò»¸ö͸Ã÷²»¿É¼ûµÄÒ³Ã棬ÈÃÓû§ÔÚ²»ÖªÇéµÄÇé¿öÏ£¬
µã»÷¹¥»÷ÕßÏëÒªÆÛÆÓû§µã»÷µÄλÖá£
CFS ºÍ ClickjackingÆäʵ¶¼ÊÇ»ùÓÚÍøÒ³iframe²úÉúµÄ¹¥»÷¡£µ±Ã»ÓÐÔ¤·ÀµÄʱºò£¬¹¥»÷Õß¿ÉÒÔÀûÓÃiframeµÄ·½Ê½°üº¬ÄãµÄÍøÒ³£¬
²ÉÓÃÆÛƵķ½Ê½£¬Òýµ¼Óû§¹ýÀ´µã»÷£¬ÀûÓüàÌýµÁÈ¡Óû§ÊäÈëÐÅÏ¢»òÕßÊÇÀûÓÃÑùʽ¿ØÖÆ»òÕßÆÈ¡Óû§µã»÷ij¸öÌض¨µÄÇøÓò£¬¶ø´ïµ½
»ñÈ¡½Ù³ÖµÄÄ¿µÄ¡£
ÈçºÎÔ¤·À£º
ÖªµÀÒ³ÃæÊDZ»±ðÈËiframeµÄʱºò£¬ÄÇô·ÀÖ¹±» FRAME ¼ÓÔØÄãµÄÍøÕ¾Ò³Ãæ¾Í¿ÉÒÔÓÐЧµÄ·ÀÖ¹±»¹¥»÷ÁË¡£
1¡¢HTMLÒ³Ãæ(ÕâÖÖ·½Ê½µÄ»°£¬Ò»Ñù¿ÉÒÔÆƽ⣬¿ÉÒÔ×÷Ϊ»ù´¡µÄÔ¤·À)
metaÊÇÓÃÀ´ÔÚHTMLÎĵµÖÐÄ£ÄâHTTPÐÒéµÄÏìӦͷ±¨ÎÄ¡£ÔÚHTMLÒ³ÃæheaderÖмÓÉÏ'<meta http-equiv="windows-Target" contect="_top">'
Ç¿ÖÆÒ³ÃæÔÚµ±Ç°´°¿ÚÖÐÒÔ¶ÀÁ¢Ò³ÃæÏÔʾ£¬¿ÉÒÔ·ÀÖ¹×Ô¼ºµÄÍøÒ³±»±ðÈ˵±×÷Ò»¸öframeÒ³µ÷ÓÃ.
2¡¢ÀûÓÃjs·ÀÖ¹Ò³Ãæ±»iframeǶÌ×
<script type="text/javascript">
if( top.location != self.location ) top.location.href = self.location;
</script>
ÀûÓÃjsµÄ»°£¬ÆäʵҲͬÑù¿ÉÒÔÆƽ⡣ÈçÏ£º
// ¶¥²ã´°¿ÚÖзÅÈë´úÂë
var location = document.location;
// »òÕß var location = "";
3¡¢Ê¹ÓÃX-Frame-Options
X-FRAME-OPTIONSÊÇ΢ÈíÌá³öµÄÒ»¸öhttpÍ·£¬×¨ÃÅÓÃÀ´·ÀÓùÀûÓÃiframeǶÌ׵ĵã»÷½Ù³Ö¹¥»÷¡£²¢ÇÒÄ¿Ç°ÊÐÃæÉÏÖ÷Á÷µÄä¯ÀÀÆ÷¶¼Ö§³Ö¡£
Õâ¸öÍ·ÓÐÈý¸öÖµ£º
DENY // ¾Ü¾øÈκÎÓò¼ÓÔØ
SAMEORIGIN // ÔÊÐíͬԴÓòϼÓÔØ
ALLOW-FROM // ¿ÉÒÔ¶¨ÒåÔÊÐíframe¼ÓÔصÄÒ³ÃæµØÖ·
ÄÇôÔÚPHPºÍNginx¶ËÈçºÎÉèÖÃÔ¤·ÀÈçÏ£º
PHP±ÈÈç˵ÓõÄÊÇMVC¿ò¼ÜµÄµ¥Ò»Èë¿ÚÎļþ£¬ÄÇôÔÚindex.phpÖÐÖ±½Ó¼ÓÉÏÏÂÃæÕâ¾ä»°£º
header('X-Frame-Options:Deny');
Nginx¿ÉÒÔÔÚÅäÖÃÎļþserver{}ÖмÓÉÏ£º
add_header X-Frame-Options SAMEORIGIN È»ºóÖØÆôNginx¼´¿É
¼ÓÉÏX-Frame-OptionsÖ®ºó£¬·ÃÎÊÍøÒ³£¬»á¿´µ½headerÍ··µ»ØÐÅÏ¢ÖÐÓгöÏÖ"X-Frame-Options:SAMEORIGIN",Èçͼ£º
4¡¢ÁíÍâÕë¶Ôjs¿ÉÒÔ²ÉÓÃÏÂÃæµÄ·½Ê½
<html>
<head>
<style> body{ display : none;}</style>
</head>
<body>
ÎÒÊÇbody
</body>
<script>
if (self == top) {
var theBody = document.getElementsByTagName('body')[0];
theBody.style.display = "block";
} else {
top.location = self.location;
}
</script>
</html>
ÍƼöÐÅÏ¢
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- php³£ÓÃÕýÔò±í´ïʽ
- phpÐÔÄܼà²âÄ£¿éXHProf
- ÈÃCI¿ò¼ÜÖ§³Öservice²ã
- ʹÓÃPHPÉú³É´øLOGOµÄ¸öÐÔ»¯¶þάÂëͼÏñ
- ¹ØÓÚCodeIgniterÄã¿ÉÄܲ»ÖªµÀµÄ5¸ö֪ʶµã
- Memcache ºÁÃ뼶³¬Ê±¼°ÆäËû³£¼ûÎÊÌâ»ã×Ü
- [PHP±Ê¼Ç]PHPQueryÒ»¸ö´¦ÀíDOMµÄÀûÆ÷
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- PHP»ñÈ¡Óû§µÄÕæʵIP£¬²¢ÅжÏÊÇ·ñÄÚÍøIP
- PHP ´íÎóÈÕÖ¾ error_log
- ÀûÓÃbigpipe»úÖÆʵÏÖÒ³ÃæÄ£¿éµÄÒì²½äÖȾ chunked¼¼Êõ
- php¿ØÖÆÎļþÏÂÔØËÙ¶È
- js + php ¶ÁÈ¡¡¢²¥·ÅÊÓƵÁ÷ ¼æÈÝfirefox£¬c....
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- UNICODE Óë UTF-8 µÄ¹Øϵ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- phpʹÓÃmb_detect_encoding¼ì²â×Ö·û´®±àÂë
ÆÀÂÛ