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

关于预防重定向被攻击的一个问题

  •  
  •   hacker1031 · 2013-11-21 18:20:45 +08:00 · 2533 次点击
    这是一个创建于 3845 天前的主题,其中的信息可能已经有所发展或是发生改变。
    如果网页上的图片加上的链接是这种正则表达式验证的

    ^http://www.example.com

    用什么办法可达到点击图片重定向到新网站,比如转向

    http://www.other.com

    又如何预防?
    9 条回复    1970-01-01 08:00:00 +08:00
    inee
        1
    inee  
       2013-11-21 18:45:37 +08:00
    mason
    hacker1031
        2
    hacker1031  
    OP
       2013-11-21 18:53:15 +08:00
    ihacku
        3
    ihacku  
       2013-11-21 18:55:07 +08:00
    clickjacking
    inee
        4
    inee  
       2013-11-21 18:56:13 +08:00
    @hacker1031 有不同的方法,有本地搞定
    有网站设定的
    你指哪个?
    inee
        5
    inee  
       2013-11-21 18:56:52 +08:00
    @ihacku 这玩意在IE上就是畅通无阻的
    hacker1031
        6
    hacker1031  
    OP
       2013-11-21 18:59:31 +08:00
    @inee 本地搞定
    hacker1031
        7
    hacker1031  
    OP
       2013-11-21 19:00:36 +08:00
    @ihacku 谢谢提供,参考一下。
    inee
        8
    inee  
       2013-11-21 19:01:31 +08:00
    @hacker1031 国外防火墙搞定
    浏览器扩展搞定预防

    你这其实叫劫持了
    xss能达到
    hacker1031
        9
    hacker1031  
    OP
       2013-11-21 19:20:27 +08:00
    @inee 把问题再细说一下

    比如图片的链接是

    ?url=http://example.com/

    程序中这样处理

    if (mb_ereg('^http://example¥.com/', $url)) {
    // Check OK

    按常理说这种形式可达到重定向目的

    ?url=http://example.com/%0D%0ALocation:+http://trap.example.com/xyz.php

    其实此处只想验证一下“^”正则表达的不足,可上面的办法没达到预想效果。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2442 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 10:05 · PVG 18:05 · LAX 03:05 · JFK 06:05
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.