shiji
V2EX  ›  问与答

疑似 XSS, 求帮助看看我这种情况能怎么利用

  •  
  •   shiji · May 26, 2017 · 1524 views
    This topic created in 3281 days ago, the information mentioned may be changed or developed.
    接到了个排查安全问题的活。

    <form method="post" action="includes/user.php">
    <input type="hidden" name="desination" value="<?php echo $_SERVER["REQUEST_URI"]; ?>"/>
    ........

    因为这个$_SERVER["REQUEST_URI"]是会转义引号角括号什么的,是不是基本上没有什么可利用的空间?

    提交之后这个 desination 跟数据库也没有交流,只有:
    header("Location: ".strtok($_POST['desination'], '?')."?msg=ok");

    提前谢谢大家
    1 replies    2017-05-26 13:05:21 +08:00
    SoloCompany
        1
    SoloCompany  
       May 26, 2017 via iPhone
    request line 是否转义取决于用户使用的浏览器,建议你测试一下老旧浏览器

    用 curl 构造请求的话肯定可以不转义

    最后,无论如何,在这个地方是应该做 htmlescapr 的
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5876 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 02:41 · PVG 10:41 · LAX 19:41 · JFK 22:41
    ♥ Do have faith in what you're doing.