V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
c4tn
V2EX  ›  PHP

奇怪的导航站...

  •  
  •   c4tn · 2014-12-27 23:00:34 +08:00 · 3401 次点击
    这是一个创建于 3411 天前的主题,其中的信息可能已经有所发展或是发生改变。

    访问:www.win8daohang.com/dd.php?gome=1
    比如国美的一个站点,他通过这个访问,如何把referer替换成
    www.win8daohang.com

    见图:http://static.wooyun.org/upload/image/201412/2014122722554972651.png
    正常的访问referer应该来源是
    www.win8daohang.com/dd.php?gome=1

    他怎么做到的...

    7 条回复    2014-12-28 00:11:45 +08:00
    airyland
        1
    airyland  
       2014-12-27 23:22:44 +08:00   ❤️ 1
    没什么奇怪的啊。
    http://www.win8daohang.com/dd.php?gome=1 做了跳转,先跳到了http://www.win8daohang.com而已。

    <html><head><meta http-equiv='pragma' content='no-cache'><meta http-equiv='refresh' content='0; url=/'></head><body></body></html>
    c4tn
        2
    c4tn  
    OP
       2014-12-27 23:28:01 +08:00
    @airyland 感谢已经发送,我发现了他的行为,
    访问www.win8daohang.com/dd.php?gome=1
    第一跳
    <html><head><meta http-equiv='pragma' content='no-cache'><meta http-equiv='refresh' content='0; url=/'></head><body></body></html>

    第二跳
    ...<html><head><meta http-equiv='pragma' content='no-cache'><meta http-equiv='refresh' content='0; url=http://cps.gome.com.cn/home/JoinUnion?sid=4012&wid=3940&feedback=TL101&to=http://www.gome.com.cn'></head><body></body></html>

    这应该是欺骗国美,让一个推广链接,来源是他的首页,

    我想知道这个具体是php实现的还是其他rewrite模块,请指教.
    aaaa007cn
        3
    aaaa007cn  
       2014-12-27 23:29:49 +08:00   ❤️ 1
    http://www.win8daohang.com/dd.php?gome=1
    写了 session cookie
    页面 <meta http-equiv='refresh' content='0; url=/'> 重定向到 http://www.win8daohang.com/
    带着这个 cookie 请求 http://www.win8daohang.com/ 会返回 <meta http-equiv='refresh' content='0; url=目标网站'>
    c4tn
        4
    c4tn  
    OP
       2014-12-27 23:34:00 +08:00
    @aaaa007cn 感谢已经发送,

    并没有set cookies 您的说法貌似不成立

    GET /dd.php?gome=1 HTTP/1.1
    Accept: text/html, application/xhtml+xml, */*
    Accept-Language: zh-CN
    User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko
    Accept-Encoding: gzip, deflate
    Host: www.win8daohang.com
    DNT: 1
    Connection: Keep-Alive
    Cookie: PHPSESSID=3tmlhbvbe142facffq4ojghor6

    HTTP/1.1 200 OK
    Date: Sat, 27 Dec 2014 15:26:01 GMT
    Server: Apache/2.2.15 (CentOS)
    X-Powered-By: PHP/5.3.3
    P3P: CP=CAO PSA OUR
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    Pragma: no-cache
    Content-Length: 130
    Connection: close
    Content-Type: text/html
    Content-Language: zh-CN

    <html><head><meta http-equiv='pragma' content='no-cache'><meta http-equiv='refresh' content='0; url=/'></head><body></body></html>
    aaaa007cn
        5
    aaaa007cn  
       2014-12-27 23:39:16 +08:00   ❤️ 1
    你这个已经有 cookie 了啊
    PHPSESSID=3tmlhbvbe142facffq4ojghor6
    服务器知道 3tmlhbvbe142facffq4ojghor6 这个 session 刚刚请求了 dd.php?gome=1
    在这个 cookie 下次请求 / 时返回一次带跳转的 html
    之后这个 cookie 请求 / 就返回正常的首页
    c4tn
        6
    c4tn  
    OP
       2014-12-27 23:45:53 +08:00
    @aaaa007cn 您能告诉我具体实现细节吗?是php还是webserver本身策略?
    aaaa007cn
        7
    aaaa007cn  
       2014-12-28 00:11:45 +08:00   ❤️ 1
    php 中做的手脚吧
    session 看这里 http://php.net/manual/en/book.session.php

    我是用 curl 来测的

    curl "http://www.win8daohang.com/dd.php?gome=1" -v -c cookie -o daohang1
    首次设置 cookie,返回转向 / 的 html

    curl "http://www.win8daohang.com/" -v -b cookie -c cookie -o daohang2
    返回转向国美的 html

    curl "http://www.win8daohang.com/" -v -b cookie -c cookie -o daohang3
    返回正常首页

    curl "http://www.win8daohang.com/dd.php?gome=1" -v -b cookie -c cookie -o daohang4
    返回转向 / 的 html

    curl "http://www.win8daohang.com/" -v -b cookie -c cookie -o daohang5
    返回转向国美的 html

    你会发现只有第一次请求服务器才发送 Set-Cookie: PHPSESSID=xxx; path=/
    之后服务器不再发送 Set-Cookie
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   977 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 19:37 · PVG 03:37 · LAX 12:37 · JFK 15:37
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.