duanboshe0001 2018-08-18 06:45
浏览 69
已采纳

HTML的日期类型输入是否容易受到SQL注入攻击?

I know that when processing user input on server and inserting it into database, we need to use prepared statements to prevent SQL injection.

I noticed something about HTML's <input type="date"> when you choose date, for example, value is not shown after Inspecting element; however, text boxes, check boxes, etc. have values shown. You can try here.

Does it mean that date input is not vulnerable to SQL injection since you cannot modify its value? Or I am on the wrong track?

  • 写回答

1条回答 默认 最新

  • doulu8446 2018-08-18 23:34
    关注

    You are on the wrong track because you have made an incorrect assumption that the user cannot modify the value, when all you are really proving is that a non-malicious user cannot trivially modify or malform the value.

    These are two very different things.

    There are, in reality, no valid exceptions to using prepared statements. It's a genuine tragedy how many tutorials and examples show building SQL statements with string concatenation. This should not be done. There are scenarios where it is "theoretically" safe, but this should not be part of your thinking process.

    Even if you got the data from your own database, you still cannot trust it and you do not need to be thinking about whether or not a value is subject to SQL injection, because the answer is always "yes."

    The only question is how difficult the exploit would be and how many layers of indirection might be involved.

    Malicious users do not usually use your application the way you intend. As noted in comments, command line tools like curl can be used to submit requests to your server that would be indistinguishable from requests sent by a browser. Everything coming in from the client is especially suspect, but even information that isn't from outside should be assumed to be potentially dangerous.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度