WEB开发网
开发学院数据库MSSQL Server Sql server应用程序中的高级SQL注入 阅读

Sql server应用程序中的高级SQL注入

 2007-05-18 09:39:43 来源:WEB开发网   
核心提示: 下面是process_login.asp的代码,它是用来控制登陆的:<HTML><BODY bgcolor='000000' text='ffffff'><FONT Face='tahoma' color='ffffff&

下面是process_login.asp的代码,它是用来控制登陆的:

  <HTML>
  <BODY bgcolor='000000' text='ffffff'>
  <FONT Face='tahoma' color='ffffff'>
  <STYLE>
  p { font-size=20pt ! important}
  font { font-size=20pt ! important}
  h1 { font-size=64pt ! important}
  </STYLE>
  <%@LANGUAGE = JScript %>
  <%
  function trace( str ) {
  if( Request.form("debug") == "true" )
  Response.write( str );
  }
  function Login( cn ) {
  var username;
  var password;
  username = Request.form("username");
  password = Request.form("password");
  var rso = Server.CreateObject("ADODB.Recordset");
  var sql = "select * from users where username = '" + username + "' and password = '" + password + "'"; trace( "query: " + sql );
  rso.open( sql, cn );
  if (rso.EOF) {
  rso.close();
  %>
  <FONT Face='tahoma' color='cc0000'>
  <H1> <BR><BR>
  <CENTER>ACCESS DENIED</CENTER>
  </H1>
  </BODY>
  </HTML>
  <% Response.end return; }
  else {
  Session("username") = "" + rso("username");
  %>
  <FONT Face='tahoma' color='00cc00'>
  <H1> <CENTER>ACCESS GRANTED<BR> <BR>
  Welcome, <% Response.write(rso("Username")); Response.write( "</BODY></HTML>" ); Response.end }
  }
  function Main() { //Set up connection
  var username
  var cn = Server.createobject( "ADODB.Connection" );
  cn.connectiontimeout = 20;
  cn.open( "localserver", "sa", "password" );
  username = new String( Request.form("username") );
  if( username.length > 0) {
  Login( cn );
  }
  cn.close();
  }
  Main();
  %>

上一页  1 2 3 4 5 6 7 8  下一页

Tags:SQL Server 应用程序

编辑录入:coldstar [复制链接] [打 印]
赞助商链接