标签:des cWeb style blog http ar io color os cookie摘自 : http://www./archives/3125.html 关于cookie的安全知识 :http:///tech/2014/08/16/cookie-theft-and-session-hijacking.html
第三方cookie摘自:http://www./archives/3125.html
第三方cookie试验示例场景: 1、广告服务网站 www., 提供一个广告js脚本 statistics.js,会给客户端设置cookie, 用于识别用户, 2、站点 www.a.com,siteA.html 嵌入对 www.c.com站点的 statistics.js 的引用,并提供 跳转到 www. 网站 cookie显示页面 showcookie.php。 3、站点 www.b.com, siteB.html同2 4、www. showcookie.php 打印标识用户的 cookie。 用户浏览 a 和 b 网站,获得c网站颁发的唯一个一个用户标识cookie, 在他们的页面上点击跳转到c网站的链接, c网站的showcookie页面可以打印 标识用户的 cookie。 作为广告服务商, 不仅仅可以获得访问广告页面的点击量, 利用referer可以区分从哪个网站跳转到目标广告页面(这个跳转过程,一般是请求了广告商的统计链接URL,其中带着广告页面的URL,广告服务上记录下来自的网站,然后跳转到广告页面), 广告服务商可能在好多网站都投放相同广告,同一个用户可能点击了,不同网站的相同广告,利用第三方cookie标识,标识了用户,可以区分出来,这些点击来自同一个用户。
下面给出代码: 网站c的 statistics.php 通过header 接口,设置了第三方cookie 同时其中的js设置cookie的语句,设置后的cookie为 各自网站的域名, 这样看出第一方cookie不一定是第一方代码设置的。据说谷歌的广告策略是,是使用第一方cookie,就是这种js设置的cookie。 <?php header(‘P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"‘); header("Set-Cookie: thirdcookie=1;path=/;"); ?> function setCookie(c_name,value,expiredays) { var exdate=new Date() exdate.setDate(exdate.getDate()+expiredays) document.cookie=c_name+ "=" +escape(value)+ ((expiredays==null) ? "" : ";expires="+exdate.toGMTString()+";domain=www.C.com;") } setCookie("firstSubjectCookie", "1")
siteA.html 点击连接,带着从www.获得的第三方cookie,跳转到第三方的cookie打印页面。 <html> <head> <script type="text/javascript" src="http://www.C.com/statistics.php"></script> <style> </style> </head> <body> <h1>hello world! this is site A</h1> <a href="http://www./showcookie.php">go to www.</a> </body> </html>
siteB.html <html> <head> <script type="text/javascript" src="http://www.C.com/statistics.php"></script> <style> </style> </head> <body> <h1>hello world! this is site B</h1> <a href="http://www./showcookie.php">go to www.</a> </body> </html>
showcookie.php 网站c的 显示cookie页面 <html> <head> <style> </style> </head> <body> <h1>hello world! siteC with cookie= <?php echo $_COOKIE[‘thirdcookie‘]; ?></h1> </body> </html>
截图: showcookie
搜索引擎+网站广告方案经常看到,自己在搜索引擎中搜到的关键字,在其他网页的广告区域显示出来,如下图。 或者在购物网站上的搜索商品,在其他网站上广告位置上显示出来。
研究了第三方cookie,才知道其中原因: 1、你在搜索引擎上搜过的关键字,搜索引擎给你记住,并给设置了一个 用户标识cookie,如下图中 BAIDUID 2、当你访问了嵌有百度推广广告的网页时候,此网页会向百度相同域名请求广告资源, 此请求会带着 BAIDUID cookie 百度接受到这个cookie后,知道你是之前搜索过的用户,在后台中找到你搜索过的关键字,生成广告链接,发给嵌入百度广告的网页,网页显示,如下图,cookie中确实有baidu.com第三方的BAIDUID。
|
|