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.

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

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题