主题:  用ultradev做jsp的网站,他的安全系数有多高?

crystal_5d

职务:普通成员
等级:1
金币:0.0
发贴:34
注册:2001/1/25 0:23:39
#12002/3/4 1:05:05
尤其是多级用户验证这一块,总感觉至少还要手动添加一些别的东西,就象asp一样。
要想为jsp文件保密,应该注意的事情是什么?


[center][code]I love MX Studio !~~[/code][/center]

I''MAD

职务:普通成员
等级:8
金币:11.0
发贴:9502
注册:2001/9/16 20:00:53
#22002/3/4 8:49:46
MM公司的官方声明!~
Issue
The Log In User server behavior in Dreamweaver UltraDev version 4 can allow unauthorized users to successfully log in to a secured site.

Without implementing the code fix described below, a user with adequate coding knowledge can gain access without knowing either a username or password. This will allow them to be granted access permissions based on the first record in the validation table.

Web site security is an important and complex issue. Developers must research methodologies and determine the best approach to protect their sites from unauthorized access. No site can be completely secure. With proper precautions, however, a reasonable level of security can be achieved. More inFORMation on security issues is available from Carnegie Mellon and Microsoft, as well as other sources.

The Log In User server behavior should be considered a low-to-medium security mechanism. Malicious users can still obtain confidential inFORMation using packet sniffers and other tools.

Reason
The password validation code generated by UltraDev allows entry of character strings which can modify the SQL statement used to query the validation table.

Solution
Modify the code in the login page to prohibit the use of single quotes. This will ensure any characters entered in the username or password text boxes are treated as character strings and not as part of a SQL statement.

Insert and/or replace the lines identified below. Be sure to note your existing names for the following elements. After replacing the code, you must edit the new code to refer to your names.

login_table Name of your login validation table.
username_field Name of your username field in login_table.
password_field Name of your password field in login_table.
password_textbox Name of the password textbox on your login page.

vbscript:
Locate the following line:


MM_rsUser.Source = MM_rsUser.Source & " FROM login_table WHERE username_field='" & MM_valUsername &"' AND password_field='" & CStr(Request.FORM("password_textbox")) & "'"
Replace it with:


MM_rsUser.Source = MM_rsUser.Source & " FROM login_table WHERE username_field='" & Replace(MM_valUsername,"'","''") &"' AND password_field='" & Replace(Request.FORM("password_textbox"),"'","''") & "'"


javascript:

Locate the following line:


MM_rsUser.Source += " FROM login_table WHERE username_field='" + MM_valUsername + "' AND password_field='" + String(Request.FORM("password_textbox")) + "'";
Replace it with:


MM_rsUser.Source += " FROM login_table WHERE username_field='" + MM_valUsername.replace(/'/g, "''") + "' AND password_field='" + String(Request.FORM("password_textbox")).replace(/'/g, "''") + "'";


ColdFusion:
Locate the following line:


MM_valUsername=Evaluate("FORM." & "username_textbox");
Add the following line immediately below the above line:


MM_valPassword=Evaluate("FORM." & "password_textbox");
Next, locate the following line:

SELECT #MM_queryFieldList# FROM login_table WHERE username_field='#MM_valUsername#' AND password_field='#Evaluate("FORM." & "password_textbox")#'

Replace it with:

SELECT #MM_queryFieldList# FROM login_table WHERE username_field='#Replace(MM_valUsername,"\'"," ","ALL")#' AND password_field='#Replace(MM_valPassword,"\'"," ","ALL")#'



JSP:
Locate the following line:


String MM_valUsername=request.getParameter("username_textbox");
Add the following line immediately below the above line:


String MM_valPassword=request.getParameter("password_textbox");
Next, locate the following line:

MM_pSQL += " FROM login_table WHERE username_field='" + MM_valUsername + "' AND password_field='" + request.getParameter("password_textbox")) + "'";
Replace it with:

MM_pSQL += " FROM login_table WHERE username_field='" + MM_valUsername.replace('\'', ' ') + "' AND password_field='" + MM_valPassword.replace('\'', ' ') + "'";


Last updated: February 28, 2001
Keywords: login, authorization, security
Created: February 16, 2001

编辑历史:[这消息被Hmily编辑过(编辑时间2002-03-04 08:49:55)]


5D公害

职务:普通成员
等级:9
金币:10.3
发贴:36272
注册:2002/1/13 9:52:57
#32002/3/4 9:58:08
英文看得我晕,一句话,比ASP要好



5D公害

职务:普通成员
等级:9
金币:10.3
发贴:36272
注册:2002/1/13 9:52:57
#42002/3/4 9:58:10
英文看得我晕,一句话,比ASP要好



5D荣誉斑竹

职务:普通成员
等级:3
金币:10.0
发贴:1480
注册:2002/1/15 11:01:54
#52002/3/4 10:08:45
更多的取决于你用的WEB应用服务器。



crystal_5d

职务:普通成员
等级:1
金币:0.0
发贴:34
注册:2001/1/25 0:23:39
#62002/3/5 10:11:22
deepdark在上个帖子中说
引用:
更多的取决于你用的WEB应用服务器。


sun solaris 8


[center][code]I love MX Studio !~~[/code][/center]

longdas

职务:普通成员
等级:1
金币:1.0
发贴:142
注册:2002/3/5 15:11:46
#72002/3/5 15:24:28
好呀。apache会好一点吗



5DJSP技术版主

职务:版主
等级:2
金币:10.0
发贴:436
注册:2002/3/6 15:01:22
#82002/3/6 15:35:42
longdas在上个帖子中说
引用:
好呀。apache会好一点吗



APACHE 不是 JSP SERVER TOMCAT 才是

要想实现安全保密 就把程序写在JAVABEAN里 而非JSP页面里



crystal_5d

职务:普通成员
等级:1
金币:0.0
发贴:34
注册:2001/1/25 0:23:39
#92002/3/8 17:45:30
PANDORA在上个帖子中说
引用:
longdas在上个帖子中说
引用:
好呀。apache会好一点吗



APACHE 不是 JSP SERVER TOMCAT 才是

要想实现安全保密 就把程序写在JAVABEAN里 而非JSP页面里

能不能具体一点,谢谢!!


[center][code]I love MX Studio !~~[/code][/center]