是否可以注入Cookie、表单、会话数据



我有一个屏幕,在那里我将所有变量打印到屏幕上,并用经典的asp向用户显示。

在这个屏幕上,我显示值​​的";会话"Querystring"形式"Cookie"Server.Variables";给用户。

我正在进行替换,这样一些数据就可以理解了。除此之外,我什么都不做。

显示的值中没有任何内容​​打扰我。

但是,用户是否可以通过篡改Cookie或在请求表中提交恶意代码来做任何有害的事情?

显示值之前的正则表达式等​​给用户。我需要申请什么吗?

显示这些值之前​​在同一页上,我根据值检查用户名和密码​​我从SQL Server分配到会话,并向用户显示下面的所有数据。

你可以把它看作一种phpinfo。

我的经典asp代码

<%
variables=variables &   "<style>h3 {margin:3px;text-decoration: underline;}</style>"
variables=variables &   "<h3>Session</h3>"
ix=0
For Each ix in Session.Contents
variables=variables &"<span style='color:red;font-weight:bold;'>"&ix&"</span>="
variables=variables &  Session.Contents(ix) 
variables=variables &  "<br>"
Next
variables=variables &  "<h3>Querystring</h3>"
for each variable_name in request.QueryString
variable_value=request.QueryString(variable_name)
variables=variables &"<span style='color:red;font-weight:bold;'>"&variable_name&"</span>="
variables=variables &  variable_value
variables=variables &  "<br>"
next
variables=variables &  "<h3>Form</h3>"
for each variable_name in request.Form
variable_value=request.Form(variable_name)
variables=variables &"<span style='color:red;font-weight:bold;'>"&variable_name&"</span>="
variables=variables &  variable_value
variables=variables &  "<br>"
next
variables=variables &  "<h3>Cookie</h3>"
for each x in Request.Cookies
if Request.Cookies(x).HasKeys then
for each y in Request.Cookies(x)
variables=variables&("<span style='color:red;font-weight:bold;'>"&x&"</span>"&"<span style='color:blue;font-weight:bold;'>('"&y&"')</span>=" & Request.Cookies(x)(y))
variables=variables&("<br>")
next
else
variables=variables&("<span style='color:red;font-weight:bold;'>"&x & "</span>=" & Request.Cookies(x) & "<br>")
end if
next
variables=variables &  "<h3>Server.Variables</h3>"
for each x in Request.ServerVariables
variables=variables&("<span style='color:red;font-weight:bold;'>"&x&"</span>="&Request.ServerVariables(""&x&"")&"<br>")
next

Response.Write variables
%>

是-在将值输出到页面之前,您没有对值进行编码。至少在这些值周围使用Server.HTMLEncode。

最新更新