如何防止JavaScript注入攻击

编程入门 行业动态 更新时间:2024-10-25 02:25:10
本文介绍了如何防止JavaScript注入攻击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

目前我开发了一个用于处理金融交易的网站。我看到我的一些客户已经完成了JavaScript注入攻击并完成了一些不可能的事务。作为一个例子,我在下订单之前检查了他的现金余额。但其中一些确实通过在地址栏中运行以下javascript来改变它。他们通过查看页面源来获取可变名称。

Currently I have developed a site which is used for handle financial transactions. I have seen that some of my customers have done JavaScript injection attacks and have done some transactions which are not possible. As a example I have checked his cash balance before he place the order. But some of them did change that by running the following javascript in the address bar. They have taken the varible name by looking in to page source.

javascript:void(document.accounts.cashBalence.value="10000000")

由于这很关键,我想快速修复它。那么有没有办法防止JavaScript注入攻击?

Since this is critical I want to fixed it quickly. So is there a way to prevent JavaScript injection attacks?

推荐答案

您可以对变量名称和/或值进行模糊处理或散列。但是, 不要使用JavaScript,而是在服务器端执行每个逻辑。

You can obfuscate or hash variable names and/or values. However, Don't use JavaScript, do every logic in the server-side instead.

更多推荐

如何防止JavaScript注入攻击

本文发布于:2023-11-06 21:31:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1564723.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何防止   JavaScript

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!