防止经典ASP页面上的表单注入 [英] Preventing form injection on Classic ASP pages

查看:379
本文介绍了防止经典ASP页面上的表单注入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看过很多文章和实用程序来防止表格注入

ASP.NET,但对于传统ASP来说并不算太多。是否有任何良好的输入验证

脚本,您用来避免形式注入攻击?我正在寻找好的

例程我可以在我的所有表单处理页面上重用。谢谢。

解决方案

bregent写道:

我看过很多文章和实用程序用于预防为ASP.NET注入表单,但对于经典ASP来说并不算太多。是否有任何好的输入验证脚本用于避免形式的注入攻击?我正在寻找可以在所有表​​格处理页面上重复使用的好例程。谢谢。




表单注入?

您的意思是跨站点脚本(XSS)吗?

-

Microsoft MVP - ASP / ASP.NET

请回复新闻组。我的From

标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将获得更快的回复。


bregent于2006年10月10日在microsoft.public.inetserver.asp中写道。 general:

我已经看过很多文章和实用程序来阻止ASP.NET的表单注入,但对于传统ASP来说并不算太多。是否有任何好的输入验证脚本可用于避免形式注入攻击?我正在寻找可以在我的所有表格处理页面上重复使用的好例程。谢谢。




如果您不介意丢失非字母数字字符,

并且没有名为O''Brien的用户:


< script runat = server language = jscript>

函数DesInjectString(s){

返回s.replace( /[^az\d\\,.--] + /,'''''')

}

< / script>


未经测试。


-

Evertjan。

荷兰。

(请将x''es更改为我的电子邮件地址中的点数)


以下是一些可以防止注射攻击的规则。

将上述规则应用于存储过程中的代码。

始终传递输入数据通过Command对象参数获取SQL代码。


始终在从数据库中检索到的数据上调用Server.HTMLEncode

发送到客户端t。


避免使用隐藏字段来进行只有服务器需要的有意义的状态。

而是将状态存储在某处服务器(比如在数据库中)并发送给客户一个唯一的(最好只使用一次)ID。


安东尼。

I''ve seen plenty of articles and utilities for preventing form injections for
ASP.NET, but not too much for classic ASP. Are there any good input validation
scripts that you use to avoid form injection attacks? I''m looking for good
routines I can reuse on all of my form processing pages. Thanks.

解决方案

bregent wrote:

I''ve seen plenty of articles and utilities for preventing form
injections for ASP.NET, but not too much for classic ASP. Are there
any good input validation scripts that you use to avoid form
injection attacks? I''m looking for good routines I can reuse on all
of my form processing pages. Thanks.



"form injection"?
Do you mean cross-site scripting (XSS)?
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don''t check it very often. You will get a
quicker response by posting to the newsgroup.


bregent wrote on 10 feb 2006 in microsoft.public.inetserver.asp.general:

I''ve seen plenty of articles and utilities for preventing form
injections for ASP.NET, but not too much for classic ASP. Are there
any good input validation scripts that you use to avoid form injection
attacks? I''m looking for good routines I can reuse on all of my form
processing pages. Thanks.



If you do not mind loosing non-alphanumeric characters,
and don''t have a user named O''Brien:

<script runat=server language=jscript>
function DesInjectString(s){
return s.replace(/[^a-z\d\.,-]+/ig,''?'')
}
</script>

Not tested.

--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)


Here are some rules to follow which will prevent injection attack.

Never build SQL code by string concatenation with input from the client.
Apply the above rule to code found inside Stored procedures.
Always pass input data to SQL code via Command object parameters.

Always call Server.HTMLEncode on data retrieved from the data base before
sending to the client.

Avoid using hidden fields to carry meaningful state that only the server
needs.
Instead store the state somewhere on the server (like in the DB) and send to
the client a unique (preferable use once only) ID.

Anthony.


这篇关于防止经典ASP页面上的表单注入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆